Web hosting top - BranchGroup sceneBranchGroup = createSceneBranchGroup(); sceneBranchGroup.compile(); //add the scene
BranchGroup sceneBranchGroup = createSceneBranchGroup(); sceneBranchGroup.compile(); //add the scene BranchGroup to the Locale locale.addBranchGraph( sceneBranchGroup ); Note that this code will not yet make the geometry visible until a Viewand a ViewPlatformare created. This is the subject of the next section. 6.2 View, ViewPlatform, and Locale Now that a Localehas been created and populated with geometry, Java 3D must be instructed to render the Locale. The key to Java 3D rendering is the Viewclass which attaches to the ViewPlatforminstance that is within the scenegraph. The Viewcontrols Java 3D rendering and must have an attached Canvas3D component to render into. Multiple Canvas3Dinstances can be attached to the View, allowing multiple (identical) copies of the Viewto be rendered simultaneously. The clipping planes for the View control how much of the scene is rendered. In the example, CLIPPING the front plane is 10 meters from the viewer, while the back clipping plane is 110 meters from PLANES the viewer. However, since the viewer has been moved back 20 meters from the origin, the scene will be rendered from 10 to +90 in the Z direction. Note that one cannot set arbitrary clipping planes. The clipping planes have a physical significance in that they define a view frustum. The view frustum defines the pyramidal volume of 3D space that is rendered. The ViewPlatformis a simple Java 3D Leaf Nodeand can be added to the Locale as shown by the Java3dApplet code: Based on Java3dApplet.java //create the ViewPlatform BranchGroup BranchGroup vpBranchGroup = new BranchGroup(); //create a TransformGroup to scale the ViewPlatform //(and hence View) TransformGroup tg = new TransformGroup(); //create the ViewPlatform ViewPlatform vp = new ViewPlatform(); vp.setViewAttachPolicy( View.RELATIVE_TO_FIELD_OF_VIEW ); //attach the ViewPlatform to the TransformGroup tg.addChild( vp ); //attach the TransformGroup to the BranchGroup vpBranchGroup.addChild( tg ); //finally, add the ViewPlatform BranchGroup to the Locale locale.addBranchGraph( vpBranchGroup ); Note that the TransformGroupcreated just before the ViewPlatformcan be used to scale, translate, or rotate the scene rendered by the Viewattached to the ViewPlatform. For example: //Move the camera BACK a little. Note that Transformation //matrices above the ViewPlatform are inverted by the View //renderer prior to rendering. By moving the camera back 20 86
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.