This page describes elements used to define model shape and vertex attributes data. Mutliple models making up a scene can be recorded in a model data file (.cmdl). If a model consists of more than one material, primivites (polygons, etc.) for each material are grouped. The primitives grouped for each material are called shapes. A shape consists of vertext attribute data (a vertex buffer) and an index buffer that points to it. Information required to call the glDrawElement
function is gathered here.
The <SeparateDataShapeCtr> element is used to define a single shape. This element basically includes a data array for vertex attributes data, an index array for defining primitives, center coordinates for the shape, skinning mode, etc.
The <Shapes> element appears inside the <SkeletalModel> element only once. It indicates the start of the definition of the <SeparateDataShapeCtr> element. If a scene includes more than one shape, multiple <SeparateDataShapeCtr> elements can be defined.
<NintendoWareIntermediateFile> |
Elements for the vertex coordinates, normal vector, and texture coordinates making up a shape are called vertex attributes. This data is called vertex attributes data. The elements listed in the table below are included in the vertex attributes that make up a shape. The required combinations of vertex attributes are determined based on the material and shading. Typically, shapes have mutliple instances of vertex attributes data.
Actual data is defined for each vertex attribute. The <Vector#VertexStreamCtr> element is used to define the data for each vertex attribute. Here, # represents the number of elements and indicates the number of numeric values per vertex. It is used to stand for any one of 1, 2, 3 or 4. This element basically includes the type of attribute, number of data items, and numeric type.
If attributes with a fixed value are included among the vertices in a shape, constant data can be used instead of data strings. (For example, the normal vector for a planar model fits this description. ) This allows data size to be kept small. The
The <VertexAttributes> element appears inside the <SeparateDataShapeCtr> element only once. It indicates the start of the definition of the <Vector#VertexStreamCtr> element. If a shape includes more than one vertex attribute, multiple <Vector#VertexStreamCtr> elements can be defined.
<NintendoWareIntermediateFile> |
The size of binary data at runtime can be reduced by setting integer types for the numeric values of vertex attribute data. The act of converting data values to integer types is called quantization. This is set in the <Vector#VertexStreamCtr> element. You can apply differing quantizations to each vertex attribute. Data values converted to integer type can be restored to original values by applying a floating point scaling value. For example, if the scaling value is 0.00390625 (= 1/256), 256 is restored to 1.0 and 128 is restored to 0.5. Integer value types include those given in the table below. Note that the integer value type and scaling value used for restoration are independent parameters. The scaling value is not necessarily determined based on the range of integer value types.
There are restrictions on the range of numeric values available with integer types. For example, when converting a vertex coordinate value located far away from the origin into an integer, an offset must be applied in the vicinity of 0.0 first before quantizing the value. This offset value can be specified for each shape. Values can then be restored as follows in combination with the scaling value.
The <PositionOffset> element is used to define the quantization offset value for vertex coordinates. The <PositionOffset> element only appears once in the <SeparateDataShapeCtr> element.
<NintendoWareIntermediateFile> |
Type | Description |
Short | 16-bit signed integer. Set from -32768 (minimum) to 32767 (maximum). |
Ushort | 16-bit unsigned integer. Set from 0 (minimum) to 65535 (maximum). |
Byte | 8-bit signed integer. Set from -128 (minimum) to 127 (maximum). |
Ubyte | 8-bit unsigned integer. Set from 0 (minimum) to 255 (maximum). |
Primitives available for rendering can be defined as triangles, lines or points by indexing the data strings representing vertex attribute data. The <PrimitiveSetCtr> element is used to define primitives. This element basically includes the type of primitive, index array, and skinning parameters. (Skinning parameters are required even for fixed shapes that do not undergo skinning.) For details, see the page Definition of a Scene's Hierarchical Structure.)
Primitive types include those given in the table below. The <UbyteIndexStreamCtr> element is used to define the primitive type and index array.
The <PrimitiveSets> element appears inside the <SeparateDataShapeCtr> element only once. It indicates the start of the definition of the <PrimitiveSetCtr> element. If a shape includes more than one primitive, multiple <PrimitiveSetCtr> elements can be defined. Shapes and primitives have a one-to-one correspondence for models that do not undergo skinning. However, a shape may be split up into multiple primitives for models that do undergo skinning. For details see, Defining Skinning
<NintendoWareIntermediateFile> |
The <UbyteIndexStreamCtr> element for defining index arrays appears in the <PrimitiveSetCtr> element only once. The hierarchy from the <PrimitiveSetCtr> element to the <UbyteIndexStreamCtr> element is fixed.
: |
Type | Description |
Points | Point primitive. |
Lines | Line primitive. |
LineStrip | Line strip primitive. |
Triangles | Triangle list primitive. |
TriangleStrip | Triangle strip primitive. |
TriangleFan | Triangle fan primitive. |
PointSprites | Point sprite primitive. |
SilhouetteTriangles | Triangle list primitive with silhouette. |
SilhouetteStrip | Triangle strip primitive with silhouette. |
Subdivision | Subdivision primitive. |
SubdivisionLoop | Subdivision loop primitive. |
CONFIDENTIAL