Transform3D t3d = new Transform3D(); t3d.setEuler( new Vector3d(
Transform3D t3d = new Transform3D(); t3d.setEuler( new Vector3d( Math.PI / 2.0, Math.PI, 0 ) ); tg.setTransform( t3d ); //create appearance and material for the Cone Appearance app = new Appearance(); Color3f black = new Color3f(0.4f, 0.2f, 0.1f); app.setMaterial(new Material(objColor, black, objColor, black, 90.0f)); //create the Primitive and add to the parent BranchGroup tg.addChild( new Cone( 1, 3, Primitive.GENERATE_NORMALS, app ) ); viewerAvatar.addChild( tg ); return viewerAvatar; } //create a simple Raster text label used to help identify //the viewer. PlatformGeometry createPlatformGeometry( String szText ) { PlatformGeometry pg = new PlatformGeometry(); pg.addChild( createLabel( szText, 0f, 2f, 0f ) ); return pg; } //creates a simple Raster text label (similar to Text2D) private Shape3D createLabel( String szText, float x, float y, float z ) { BufferedImage bufferedImage = new BufferedImage( 25, 14, BufferedImage.TYPE_INT_RGB ); Graphics g = bufferedImage.getGraphics(); g.setColor( Color.white ); g.drawString( szText, 2, 12 ); ImageComponent2D imageComponent2D = new ImageComponent2D( ImageComponent2D.FORMAT_RGB, bufferedImage ); //create the Raster for the image javax.media.j3d.Raster renderRaster = new javax.media.j3d.Raster( new Point3f( x, y, z ), javax.media.j3d.Raster.RASTER_COLOR, 0, 0, bufferedImage.getWidth(), bufferedImage.getHeight(), imageComponent2D, null ); return new Shape3D( renderRaster ); } 6.3.1 Avatars and platform geometry The SimpleUniverseclass allows you to attach geometry to the viewer of your 3D scene. There are two methods of attaching viewer geometry using the SimpleUniverseclass: ViewingPlatform.setPlatformGeometryor Viewer.setAvatar. The ViewingPlatform can be accessed from the SimpleUniverseby calling getViewingPlatformor calling getViewer to access the Viewerobject. There does not seem to be any difference between these two methods. 91
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.