Java Programing

March 30, 2007

The Shape3Dclass is essential to defining viewable geometry

Filed under: Java 3D Programming — webmaster @ 2:41 pm

The Shape3Dclass is essential to defining viewable geometry in Java 3D. The Shape3Dclass packages the geometry information for a visual object along with the appearance information that governs how the geometry is rendered. The Appearanceclass is covered in chapter 9 and includes a variety of rendering attributes (material, line, surface attributes, etc.). In addition, each Shape3Dmaintains a Boundsobject for use in collision detection and intersection testing between PickRays (lines) and other Shape3Dobjects in the scene. As is customary, Shape3Densures access to internal variables and attributes is subject to the capability bits that have been set for the Shape3Dobject. An example class derived from Shape3Dis the ColorCubeclass. The source code for the ColorCube class is available in the com.sun.java.j3d.utils.geometrypackage where ColorCubeis defined. The basic principle is to define geometry using one of the Geometry-derived classes such as QuadArrayand then assign the geometry to the Shape3Dusing setGeometry(…). GeometryArray-derived classes can also store the normal vectors, colors, and texture coordinates for each vertex defined. 8.1.1 The user data field A useful feature, defined in Shape3D s SceneGraphObjectbase class, is that each Shape3Dhas a user data object associated with it. This allows an arbitrary Object-derived class to be attached to the Shape3D object using: public void setUserData(java.lang.Object userData); public java.lang.Object getUserData(); The user data object can then be queried in response to scenegraph operations, for example selecting with the mouse. A selection utility will typically return the Shape3Dobject that was selected and an application-specific data structure will need to be retrieved to apply the results of the selection operation this can be stored in the user data field of the Shape3Dobject. The user data field can also be used to remove a scenegraph object once it has been added a useful function. This technique is described in chapter 5. 8.2 Primitives java.lang.Object | +–javax.media.j3d.SceneGraphObject | +–javax.media.j3d.Node | +–javax.media.j3d.Group | +–com.sun.j3d.utils.geometry.Primitive 108

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Java Web Hosting