j3d.org Code

org.j3d.renderer.java3d.terrain
Interface AppearanceGenerator


public interface AppearanceGenerator

Generator of Java3D Appearance instances for use within the terrain rendering.

The generator is used to create instances of the appearance object on demand for the system internal scene graph representation. The generator is required to act in concert with the TerrainData implementation as the use of this class by the specific terrain rendering algorithms are dependent on the way the data is being handled.

Every time the method of this interface is called the implementation is required to generate a new instance of the Appearance object. The reason for this is to allow the internal representation the flexibility to handle either single texture per terrain data or tiled textures. In the case of tiled textures, we need to use the same basic appearance set up for each tile, but a separate Texture instance is used for each tile. To do that requires a separate appearance instance for each terrain tile. If the TerrainData tells us that there is only a single texture for the entire system, then the rendering code only needs to create one Appearance instance and shares that with all the geometry.

Although you are required to generate new instances of the Appearance object, there is no such requirements on the helper classes it uses. For example, you may choose to share instances of Material or PolygonAttributes (to change from line to polygon mode for example). This is definitely encouraged because sharing these instances allows Java3D to do a lot of rendering optimisations on top of what you currently have now.

Currently this object does not reuse instances. That may be something worth adding in the future.

Version:
$Revision: 1.2 $
Author:
Justin Couch

Method Summary
 javax.media.j3d.Appearance createAppearance()
          Create a new appearance instance.
 

Method Detail

createAppearance

public javax.media.j3d.Appearance createAppearance()
Create a new appearance instance. The instance must be new each time. The returned object should be configured to whatever capabilities you wish, however, it must not be part of a live scene graph, and the texture object must not yet be set.

Returns:
The new appearance instance to use

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org