Java Reference
In-Depth Information
Figure 13. Third code segment of BillboardDemo.java
87. public BranchGroup createSceneGraph(SimpleUniverse su)
88. {
89. TransformGroup viewplatformTrans = null;
90. BranchGroup objRoot = new BranchGroup();
91. ColoringAttributes ca = new ColoringAttributes();
92. ca.setColor(1.0f,0.0f,0.0f);
93. Appearance app = new Appearance();
94. app.setColoringAttributes(ca);
95. Vector3f translate = new Vector3f();
96. Transform3D t3D= new Transform3D();
97. TransformGroup translateGroup = null;
98. TransformGroup TGroup = null;
99. Billboard billboard = null;
100. BoundingSphere bSphere = new BoundingSphere();
101. objRoot.addChild(createGrass());
102. objRoot.addChild(createGrass1());
103. objRoot.addChild(createRunway());
104. Vector3f location[] = new Vector3f [9];
105. location[0] = new Vector3f(10f, 0.2f,-40.0f);
106. location[1] = new Vector3f(-10.0f, 0.2f,-30.0f);
107. location[2] = new Vector3f(10f, 0.2f,-20.0f);
108. location[3] = new Vector3f(-10.0f, 0.2f,-10.0f);
109. location[4] = new Vector3f(10f, 0.2f,0.0f);
110. location[5] = new Vector3f(-10.0f, 0.2f,10.0f);
111. location[6] = new Vector3f(10f, 0.2f,20.0f);
112. location[7] = new Vector3f(-10.0f, 0.2f,30.0f);
113. location[8] = new Vector3f(10f, 0.2f,40.0f);
114. Vector3f location1[] = new Vector3f [9];
115. location1[0] = new Vector3f(0.0f, 0.0f,-40.0f);
116. location1[1] = new Vector3f(0.0f, 0.0f,-30.0f);
117. location1[2] = new Vector3f(0.0f, 0.0f,-20.0f);
118. location1[3] = new Vector3f(0.0f, 0.0f,-10.0f);
119. location1[4] = new Vector3f(0.0f, 0.0f,0.0f);
120. location1[5] = new Vector3f(0.0f, 0.0f,10.0f);
121. location1[6] = new Vector3f(0.0f, 0.0f,20.0f);
122. location1[7] = new Vector3f(0.0f, 0.0f,30.0f);
123. location1[8] = new Vector3f(0.0f, 0.0f,40.0f);
The Billboard constructor is added as a child to the object root.
The billboard object or the object shape is added as a child to the transform group
created earlier.
Search WWH ::




Custom Search