Block attributes

From Mm2kiwi
Revision as of 02:00, 12 August 2005 by Fre-Ber (talk | contribs) (Triangle fans)

Jump to: navigation, search

Common

Most attributes of the PSDL-file are specialized, created for a specific purpose. Some, however, are general attributes with several uses. This section describes them.

Triangle fans

Triangle fan attribute

To create ground surfaces triangle fans are usually used. These are constructed by a list of vertices surrounding a pivot vertex in a counter-clockwise order. Often the triangle fan is degenerated to a convex polygon. This means that the pivot vertex is located on the perimeter of the attribute.

The triangle attributes are, in fact, an entire family of attributes. Eight different attributes can be used depending on the number of vertices the surface requires. Attribute 0x30 is the most general one, this can handle any number of vertices. Attributes 0x31 - 0x37 are limited to 1 - 7 triangles respectively. Attribute 0x31 requires three vertices, attribute 0x37 requires nine vertices.

struct Attribute_0030
{
    ushort            id = 0x30;
    ushort            nVertices;
    ushort[nVertices] vertexRefs; // Indices in the vertex list
}
struct Attribute_0031
{
    ushort    id = 0x31;
    ushort[3] vertexRefs; // Indices in the vertex list
}
struct Attribute_0032
{
    ushort    id = 0x32;
    ushort[4] vertexRefs; // Indices in the vertex list
}
struct Attribute_0033
{
    ushort    id = 0x33;
    ushort[5] vertexRefs; // Indices in the vertex list
}
struct Attribute_0034
{
    ushort    id = 0x34;
    ushort[6] vertexRefs; // Indices in the vertex list
}
struct Attribute_0035
{
    ushort id = 0x35;
    ushort[7] vertexRefs; // Indices in the vertex list
}
struct Attribute_0036
{
    ushort    id = 0x36;
    ushort[8] vertexRefs; // Indices in the vertex list
}
struct Attribute_0037
{
    ushort    id = 0x37;
    ushort[9] vertexRefs; // Indices in the vertex list
}