Web site designers - //meters, you can see geometry objects that are

//meters, you can see geometry objects that are positioned at 0,0,0. Transform3D t3d = new Transform3D(); t3d.setTranslation( new Vector3d( 0.0, 0.0, 20.0 ) ); tg.setTransform( t3d ); Now we need to create the Viewobject itself and attach it to the ViewPlatformthat was added to the scenegraph. //create the View object View view = new View(); //create the PhysicalBody and PhysicalEnvironment for the View //and attach to the View PhysicalBody pb = new PhysicalBody(); PhysicalEnvironment pe = new PhysicalEnvironment(); view.setPhysicalEnvironment( pe ); view.setPhysicalBody( pb ); //attach the View to the ViewPlatform view.attachViewPlatform( vp ); //set the near and far clipping planes for the View view.setBackClipDistance( 110 ); view.setFrontClipDistance( 10 ); Finally, create a Canvas3Dcomponent (an AWT object) and add it to the View s list of Canvases to be rendered into. //create the Canvas3D that the View will render into. //get the graphics capabilities of the system and create //the best Canvas3D possible. GraphicsConfigTemplate3D gc3D = new GraphicsConfigTemplate3D(); gc3D.setSceneAntialiasing( GraphicsConfigTemplate.PREFERRED ); GraphicsDevice gd[] = GraphicsEnvironment. getLocalGraphicsEnvironment().getScreenDevices(); Canvas3D c3d = new Canvas3D( gd[0].getBestConfiguration( gc3D ) ); //set the size of the Canvas3D c3d.setSize( 512, 512 ); //add the Canvas3D to the View so that it is rendered into view.addCanvas3D( c3d ); //add the Canvas3D component to a parent AWT or Swing Panel add( c3d ); 6.3 SimpleUniverse To simplify creating the Viewside of the scenegraph, Sun has provided the SimpleUniverseclass (figure 6.2). SimpleUniverseis defined in the com.sun.j3d.utilspackage and as such should not be considered part of the core Java 3D API. The SimpleUniverseclass hides some of the complexity of manually defining the Viewside of the scenegraph at the expense of the flexibility of using the core API classes only. 87
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.

Leave a Reply