Creating Geometry
Until now we have used the ColorCube class for our geometrical object.
Now we will construct our own cube as a subclass of Shape3D
To specify a Shape3D object we have to set the Geometry and the Appearance.
The Geometry will be a cube, but now we have to define the vertices by hand.
The Appearance will be a texture mapping, where a jpg image is pasted onto
the faces of the polyhedron (cube)
There are other ways of creating Geometric objects.
For simple objects such
as spheres, cones, cylinders there are Geometric primitives that can be used.
For these, one can change the Appearance but not the Geometry. Inconveniently
they extend a different hierarchy (eg Node -> Group -> Primitive -> Sphere
for Sphere primitive vs. Node -> Leaf -> Shape3D -> ColorCube for ColorCube)
For complex objects created by other programs, eg VRML objects or CAD output
there are various loaders that can be used.
The class TextureTestCube on the next page can replace ColorCube in our test program.
The resulting Applet is the one on the start page
previous
start
toc
next