Java Programing

March 30, 2007

.To facilitate this relationship the Primitiveclass is derived

Filed under: Java 3D Programming — webmaster @ 10:01 pm

Figure 8.2 The Box Primitive Box contains the following Shape3Dobjects: FRONT = 0; BACK = 1; RIGHT = 2; LEFT = 3; TOP = 4; BOTTOM = 5; The identifiers are used as indices into the PrimitiveGroup Node. In other words, to retrieve the FRONT face of the cube, you must call: Shape3D frontFace = box.getShape(Box.FRONT ); This is defined in Box.java as: public Shape3D getShape(int partId) { if (partId < FRONT || partId > BOTTOM) return null; return (Shape3D)((Group)getChild(0)).getChild(partId); } The faces of the Boxare Shape3Dobjects and are children of the first Nodeadded to the Group. The first Nodeof the Groupis a TransformGroupobject that allows the Boxto be moved as a whole. Thus, modifying the scale, rotation, and translation of the TransformGroup s Transform3Dapplies the scale, rotation, and translation to all of its child Nodesalso. The Sun example ConicWorld/BoxExample.java provides an example of creating Boxesand loading and applying texture images to Boxes. //Set Appearance attributes //first, create an appearance Appearance ap = new Appearance(); //create a colored material Color3f aColor = new Color3f(0.1f, 0.1f, 0.1f); Color3f eColor = new Color3f(0.0f, 0.0f, 0.0f); Color3f dColor = new Color3f(0.8f, 0.8f, 0.8f); Color3f sColor = new Color3f(1.0f, 1.0f, 1.0f); Material m = new Material(aColor, eColor, dColor, sColor, 80.0f); 111

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