Scenegraph Palettes |
Palettes are the basic elements of the Shockwave 3D§ scenegraph, collecting all sharable assets in a Shockwave 3D scene. An entry in an asset's palette contains basic information about that asset, as well as pointers to other palettes or resources that fully describe the asset.
Assets are added to and retrieved from palettes by name. Querying a palette with a name returns a palette ID, which is essentially the asset's index in the queried palette. This ID can then be used to perform other operations, such as adding or recovering resources used by the asset.
Every palette contains a default entry at ID 0. In the Node Hierarchy Palette, for example, this is the scene root. In the Shader Resource Palette, for example, this entry represents the default surface properties of a model.
Each entry in this palette captures Shockwave 3D scene hierarchy information. Only objects derived from IFXNode are included. These include:
Group nodes: Empty transform nodes that create and maintain hierarchy in the scene. They join children nodes together so they can be manipulated simultaneously using a single transform. By default there is a single World (scene root) group node that acts as the root of the scenegraph. It has no parent and cannot be deleted from the scene.
Model nodes:Positioning nodes that tell the scenegraph where a model is located in the scene. Model nodes also contain information that determines the Model Resource for the Model. The Model also contains parameters to any Modifier objects attached to the Model Resource, as well as parameters for the Model Resource itself.
Light nodes: Positioning nodes that defines the placement, orientation, and state of the Light Resource they represent.
View nodes: Shockwave 3D equivalents for a camera. There is no resource for views, so each view node encapsulates all view information. This includes field-of-view, size, position, and buffer clear states and values.
Each node specifies its parent, its type (light, view, model, group), and its local transformation matrix.
The node hierarchy palette also stores the node's resource palette ID (with the exception of group nodes and camera nodes, which only exist in the node hierarchy palette), and contains pointers to the user property and modifier parameter lists for the nodes.
Each light in the scene is listed in this palette. Because the Node Hierarchy Palette contains all scene information about the light, the Light Resource Palette simply holds the pointer to the Light Resource object for the light, which stores the type, color, and effects produced by the light. Spot lights contain extra data to determine the umbra and penumbra angle.
Each shader in the scene is listed in this palette and points to a Shader Resource object, which in turn points to entries in both the Material and Texture palettes. There will be entries for a Material ID and several Texture IDs (base, bump, and others).
This palette lists all the different named sets of basic material properties. Those properties are stored in a Material Resource object, which specifies properties like a material's diffuse, ambient, and specular color, opacity, elasticity, and shininess.
This palette lists texture objects, high-level structures that represent the values associated with a texture. This may include the ID of the texture, as well as its blending modes and depth. A texture object is the parent of a texture source, or may be combined with other texture objects using a texture operator.
There are two types of texture resources: a compressed JPEG image file, which is decompressed and initialized on demand from the scenegraph, and raw image data, which is processed and initialized. Parameters passed to the Texture Source determine how a Texture is compressed and stored when it is written to a Shockwave 3D file.
The texture operator combines multiple texture sources or texture objects into a single texture object. Operators include blend, blur, mask, and saturate. These operations can be animated to produce different effects.
This palette lists all motions that may be used in a scene, pointing to a Motion Resource object describing the motion. A motion consists of one or more named motion tracks, each of which contains one or more motion keyframes.
This palette lists all the mixers that may be used in a scene, pointing to a IFXMixerConstruct object. Mixer Constructs are responsible for mapping named motions stored in a Motion Resource object to named bones in a Model Resource object. When a motion is pushed onto the play list for an object, an instance of the Mixer Construct called the IFXSkeletonMixer is created, which is used to manipulate the playback for the motion on the object.
This palette lists each object containing geometry in the Shockwave 3D scenegraph, pointing to that object's Model Resource.
The Model Resource object is a special case of an IFXModifier class, and contains numerous pointers to other palettes and objects. It points to a chain of modifiers (for example, UV Mapping, Skeleton, Keyframe, and Primitive Generators) controlled by the modifier parameter list attached to a given scene node in the Node Hierarchy Palette, which specifies deformations or motion of the object over time. It also points to an IFXModelData object, which contains:
The object's geometry data, stored in a form optimized for rendering (IFXMeshGroup).
A set of update records for the mesh that allows it to be reduced, vertex by vertex, to a null mesh (IFXUpdatesGroup).
A description of the object's mesh connectivity (IFXNeighborMesh).
A model-specific Style Palette. This special palette contains a list of the different "styles" or "shader groups" used by an object. A style is simply a structure used to specify which Shader is used to render each mesh in a model resource. The shader entries in a style have a 1:1 mapping with the meshes in the associated model. In other words, if there are three meshes in a model, the associated style for that model will contain three shader entries. Mesh 0 will use the style palette's shader ID 0, Mesh 1 will use the style palette's shader ID 1, and Mesh 2 will use the style palette's shader ID 2.
§See asterisked (*) statement at Legal Information © 2001 Intel Corporation.