[This is preliminary documentation and is subject to change.]

The mesh triangles. [vertIndexA, vertIndexB, vertIndexC, flag) * triCount] [Size: >= 4 * triCount]

Namespace: org.critterai.nmgen
Assembly: cai-nmgen (in cai-nmgen.dll) Version: 0.4.0.0 (0.4.0.0)

Syntax

         
 C#  Visual Basic  Visual C++ 
public byte[] tris
Public tris As Byte()
public:
array<unsigned char>^ tris

Remarks

The triangles are grouped by sub-mesh.

Vertices

The vertex indices in the triangle array are local to the sub-mesh, not global. To translate into an global index in the vertices array, the values must be offset by the sub-mesh's base vertex index.

Example: If the baseVertexIndex for the sub-mesh is 5 and the triangle entry is (4, 8, 7, 0), then the actual indices for the vertices are (4 + 5, 8 + 5, 7 + 5).

Flags

The flags entry indicates which edges are internal and which are external to the sub-mesh.

Internal edges connect to other triangles within the same sub-mesh. External edges represent portals to other sub-meshes or the null region.

Each flag is stored in a 2-bit position. Where position 0 is the lowest 2-bits and position 4 is the highest 2-bits:

Position 0: Edge AB (>> 0)
Position 1: Edge BC (>> 2)
Position 2: Edge CA (>> 4)
Position 4: Unused

Testing can be performed as follows:

CopyC#
if (((flag >> 2) & 0x3) == 0)
{
    // Edge BC is an external edge.
}

See Also