Java Reference
In-Depth Information
Figure 14. Fourth code segment of BillboardDemo.java
124. for (int i = 0; i < location1.length; i++)
125. {
126. translate.set(location1[i]);
127. t3D.setTranslation(translate);
128. translateGroup = new TransformGroup(t3D);
129. TGroup = new TransformGroup();
130. TGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
131. billboard = new Billboard(TGroup);
132. billboard.setSchedulingBounds(bSphere);
133. objRoot.addChild(translateGroup);
134. objRoot.addChild(billboard);
135. translateGroup.addChild(TGroup);
136. TGroup.addChild(new Sphere(0.1f,app));
137. }
138. for (int i = 0; i < location.length; i++)
139. {
140. translate.set(location[i]);
141. t3D.setTranslation(translate);
142. translateGroup = new TransformGroup(t3D);
143. TGroup = new TransformGroup();
144. TGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
145. billboard = new Billboard(TGroup);
146. billboard.setSchedulingBounds(bSphere);
147. objRoot.addChild(translateGroup);
148. objRoot.addChild(billboard);
149. translateGroup.addChild(TGroup);
150. TGroup.addChild(createTree());
151. }
152. viewplatformTrans = su.getViewingPlatform().getViewPlatformTransform();
153. translate.set( 0.0f, 0.3f, 0.0f);
154. t3D.setTranslation(translate);
155. viewplatformTrans.setTransform(t3D);
156. KeyNavigatorBehavior keyNavBeh = new KeyNavigatorBehavior(viewplatformTrans);
157. keyNavBeh.setSchedulingBounds(new BoundingSphere(new Point3d(),1000.0));
158. objRoot.addChild(keyNavBeh);
159. Background background = new Background();
160. background.setColor(0.3f, 0.3f, 1.0f); // set background colour
161. background.setApplicationBounds(new BoundingSphere());
162. objRoot.addChild(background);
163. objRoot.compile();
164. return objRoot;
165. } // end of CreateSceneGraph method of Billboard
166.
Search WWH ::




Custom Search