## Appendix A: Templates

This appendix lists the templates used by Microsoft® Direct3D® Retained Mode. A familiarity with Direct3D Retained Mode data types is assumed.

- Template Name: Header
- Template Name: Vector
- Template Name: Coords2d
- Template Name: Quaternion
- Template Name: Matrix4x4
- Template Name: ColorRGBA
- Template Name: ColorRGB
- Template Name: Indexed Color
- Template Name: Boolean
- Template Name: Boolean2d
- Template Name: Material
- Template Name: TextureFilename
- Template Name: MeshFace
- Template Name: MeshFaceWraps
- Template Name: MeshTextureCoords
- Template Name: MeshNormals
- Template Name: MeshVertexColors
- Template Name: MeshMaterialList
- Template Name: Mesh
- Template Name: FrameTransformMatrix
- Template Name: Frame
- Template Name: FloatKeys
- Template Name: TimedFloatKeys
- Template Name: AnimationKey
- Template Name: AnimationOptions
- Template Name: Animation
- Template Name: AnimationSet

### Template Name: Header

UUID

    <3D82AB43-62DA-11cf-AB39-0020AF71E433>

Member Name | Type | Optional Array Size | Optional Data Objects
major | WORD |  | None
minor | WORD |  |
flags | DWORD |  |

Description

This template defines the application-specific header for the Direct3D Retained Mode usage of the DirectX file format. The Retained Mode uses the major and minor flags to specify the current major and minor versions for the Retained Mode file format.

### Template Name: Vector

UUID

    <3D82AB5E-62DA-11cf-AB39-0020AF71E433>

Member Name | Type | Optional Array Size | Optional Data Objects
x | FLOAT |  | None
y | FLOAT |  |
z | FLOAT |  |

Description

This template defines a vector.

### Template Name: Coords2d

UUID

    <F6F23F44-7686-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
u | FLOAT |  | None
v | FLOAT |  |

Description

A two dimensional vector used to define a mesh's texture coordinates.

### Template Name: Quaternion

UUID

    <10DD46A3-775B-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
s | FLOAT |  | None
v | Vector |  |

Description

Currently unused.

### Template Name: Matrix4x4

UUID

    <F6F23F45-7686-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
matrix | array FLOAT | 16 | None

Description

This template defines a 4×4 matrix. This is used as a frame transformation matrix.

### Template Name: ColorRGBA

UUID

    <35FF44E0-6C7C-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
red | FLOAT |  | None
green | FLOAT |  |
blue | FLOAT |  |
alpha | FLOAT |  |

Description

This template defines a color object with an alpha component. This is used for the face color in the material template definition.

### Template Name: ColorRGB

UUID

    <D3E16E81-7835-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
red | FLOAT |  | None
green | FLOAT |  |
blue | FLOAT |  |

Description

This template defines the basic RGB color object.

### Template Name: Indexed Color

UUID

    <1630B820-7842-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size
index | DWORD |
ColorRGBA | indexColor |

Description

This template consists of an index parameter and an RGBA color and is used for defining mesh vertex colors. The index defines the vertex to which the color is applied.

### Template Name: Boolean

UUID

    <4885AE61-78E8-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
WORD | truefalse |  | None

Description

Defines a simple Boolean type. This template should be set to 0 or 1.

### Template Name: Boolean2d

UUID

    <4885AE63-78E8-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
u | Boolean |  | None
v | Boolean |  |

Description

This template defines a set of two Boolean values used in the MeshFaceWraps template to define the texture topology of an individual face.

### Template Name: Material

UUID

    <3D82AB4D-62DA-11cf-AB39-0020AF71E433>

Member Name | Type | Optional Array Size | Optional Data Objects
faceColor | ColorRGBA |  | Any
power | FLOAT |  |
specularColor | ColorRGB |  |
emissiveColor | ColorRGB |  |

Description

This template defines a basic material color that can be applied to either a complete mesh or a mesh's individual faces. The power is the specular exponent of the material. Note that the ambient color requires an alpha component.

TextureFilename is an optional data object used by Direct3D Retained Mode. If this is not present, the face is untextured.

### Template Name: TextureFilename

UUID

    <A42790E1-7810-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
filename | STRING |  | None

Description

This template allows you to specify the file name of a texture to apply to a mesh or a face. This should appear within a material object.

### Template Name: MeshFace

UUID

    <3D82AB5F-62DA-11cf-AB39-0020AF71E433>

Member Name | Type | Optional Array Size | Optional Data Objects
nFaceVertexIndices | DWORD |  | None
faceVertexIndices | array DWORD | nFaceVertexIndicies |

Description

This template is used by the Mesh template to define a mesh's faces. Each element of the nFaceVertexIndices array references a mesh vertex used to build the face.

### Template Name: MeshFaceWraps

UUID

    <4885AE62-78E8-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
nFaceWrapValues | DWORD |  | None
faceWrapValues | Boolean2d |  |

Description

This template is used to define the texture topology of each face in a wrap. The value of the nFaceWrapValues member should be equal to the number of faces in a mesh.

### Template Name: MeshTextureCoords

UUID

    <F6F23F40-7686-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
nTextureCoords | DWORD |  | None
textureCoords | array Coords2d | nTextureCoords |

Description

This template defines a mesh's texture coordinates.

### Template Name: MeshNormals

UUID

    <F6F23F43-7686-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
nNormals | DWORD |  | None
normals | array Vector | nNormals |
nFaceNormals | DWORD |  |
faceNormals | array MeshFace | nFaceNormals |

Description

This template defines normals for a mesh. The first array of vectors is the normal vectors themselves, and the second array is an array of indexes specifying which normals should be applied to a given face. The value of the nFaceNormals member should be equal to the number of faces in a mesh.

### Template Name: MeshVertexColors

UUID

    <1630B821-7842-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
nVertexColors | DWORD |  | None
vertexColors | array IndexedColor | nVertexColors |

Description

This template specifies vertex colors for a mesh, instead of applying a material per face or per mesh.

### Template Name: MeshMaterialList

UUID

    <F6F23F42-7686-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
nMaterials | DWORD |  | Material
nFaceIndexes | DWORD |  |  |
FaceIndexes | array DWORD | nFaceIndexes |

Description

This template is used in a mesh object to specify which material applies to which faces. The nMaterials member specifies how many materials are present, and materials specify which material to apply.

### Template Name: Mesh

UUID

    <3D82AB44-62DA-11cf-AB39-0020AF71E433>

Member Name | Type | Optional Array Size | Optional Data Objects
nVertices | DWORD |  | Any
vertices | array Vector | nVertices |
nFaces | DWORD |  |
faces | array MeshFace | nFaces |

Description

This template defines a simple mesh. The first array is a list of vertices, and the second array defines the faces of the mesh by indexing into the vertex array.

Optional Data Elements

The following optional data elements are used by Direct3D Retained Mode.

MeshFaceWraps | If this is not present, wrapping for both u and v defaults to false.
MeshTextureCoords | If this is not present, there are no texture coordinates.
MeshNormals | If this is not present, normals are generated using the GenerateNormals method of the API.
MeshVertexColors | If this is not present, the colors default to white.
MeshMaterialList | If this is not present, the material defaults to white.

### Template Name: FrameTransformMatrix

UUID

    <F6F23F41-7686-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
frameMatrix | Matrix4x4 |  | None

Description

This template defines a local transform for a frame (and all its child objects).

### Template Name: Frame

UUID

    <3D82AB46-62DA-11cf-AB39-0020AF71E433>

Member Name | Type | Optional Array Size | Optional Data Objects
None |  |  | Any

Description

This template defines a frame. Currently, the frame can contain objects of the type Mesh and a FrameTransformMatrix.

Optional Data Elements

The following optional data elements are used by Direct3D Retained Mode.

FrameTransformMatrix | If this is not present, no local transform is applied to the frame.
Mesh | Any number of mesh objects that become children of the frame. These objects can be specified inline or by reference.

### Template Name: FloatKeys

UUID

    <10DD46A9-775B-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
nValues | DWORD |  | None
values | array FLOAT | nValues |

Description

This template defines an array of floats and the number of floats in that array. This is used for defining sets of animation keys.

### Template Name: TimedFloatKeys

UUID

    <F406B180-7B3B-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
time | DWORD |  | None
tfkeys | FloatKeys |  |

Description

This template defines a set of floats and a positive time used in animations.

### Template Name: AnimationKey

UUID

    <10DD46A8-775B-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
keyType | DWORD |  | None
nKeys | DWORD |  |
keys | array TimedFloatKeys | nKeys |

Description

This template defines a set of animation keys. The keyType member specifies whether the keys are rotation, scale or position keys (using the integers 0, 1, or 2 respectively).

### Template Name: AnimationOptions

UUID

    <E2BF56C0-840F-11cf-8F52-0040333594A3>

Member Name | Type | Optional Array Size | Optional Data Objects
openclosed | DWORD |  | None
positionquality | DWORD |  |

Description

This template allows you to set the Direct3D Retained Mode Animation options. The openclosed parameter can be either 0 for a closed or 1 for an open animation. The positionquality parameter is used to set the position quality for any position keys specified and can either be 0 for spline positions or 1 for linear positions. By default, an animation is closed.

### Template Name: Animation

UUID

    <3D82AB4F-62DA-11cf-AB39-0020AF71E433>

Member Name | Type | Optional Array Size | Optional Data Objects
None |  |  | Any

Description

This template contains animations referencing a previous frame. It should contain one reference to a frame and at least one set of AnimationKeys. It also can contain an AnimationOptions data object.

Optional Data Elements

The following optional data elements are used by Direct3D Retained Mode.

AnimationKey | An animation is meaningless without AnimationKeys.
AnimationOptions | If this element is not present, an animation is closed.

### Template Name: AnimationSet

UUID

    <3D82AB50-62DA-11cf-AB39-0020AF71E433>

Member Name | Type | Optional Array Size | Optional Data Objects
none |  |  | Animation

Description

An AnimationSet contains one or more Animation objects and is the equivalent to the Direct3D Retained Mode concept of animation sets. This means each animation within an animation set has the same time at any given point. Increasing the animation set's time will increase the time for all the animations it contains.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.