P3D Lod Faces: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(added vertex order)
mNo edit summary
Line 32: Line 32:
The each of 3 (or 4) indexes look up their respective vertextable, which contains, points, normals, uvsets etc.
The each of 3 (or 4) indexes look up their respective vertextable, which contains, points, normals, uvsets etc.


The TextureIndex is a zero based array. If set to -1, there are no textures for this face or section
The TextureIndex is a zero based array. If set to -1, there are no textures  
 
FaceFlags and Texture Index have been moved to [[P3D Lod Sections|LodSections]] in Arma





Revision as of 19:48, 16 May 2010

Template:unsupported-doc

Alias 'Polygons'

LodFace

LodFace
{
  //////////// MLOD ////////////////////////
  char              TextureName[32]       // SP3X ONLY (ofp)
  ulong             type;                 // 3==Triangle or 4==Box
  PsuedoVertexTable PsuedoVertexTables[4];//
  ulong             FaceFlags;            // P3D Point and Face Flags
  Asciiz            TextureName;          // P3DM ONLY (arma)
  Asciiz            MaterialName;         // P3DM ONLY (arma)
  ////////// ODOL   ////////////////////////
  ulong             FaceFlags;            //ODOL7 ONLY see P3D Point and Face Flags
  short             TextureIndex;         //ODOL7 ONLY
  byte              type;                 // 3==Triangle or 4==Box
  ushort            VertexTableIndex[type]//
  //////////////////////////////////////////
}

There are always 3, or 4, vertices.

  • 3 point vertices describe a triangle.
  • 4 point vertices describe a rectangle.

The indices must be transformed as follows

  • triangles  : 1st posn, 2nd posn, 0th posn.
  • quadrangles : 1st, 2nd, 3rd, 0th

The each of 3 (or 4) indexes look up their respective vertextable, which contains, points, normals, uvsets etc.

The TextureIndex is a zero based array. If set to -1, there are no textures

FaceFlags and Texture Index have been moved to LodSections in Arma


PsuedoVertexTable

PsuedoVertexTable
{
 ulong PointsIndex;
 ulong NormalsIndex;
 float U,V;
}


Irrespective whether a Face has 3 or 4 verts. There are always 4 vertex points described. In the case of a triangle the 4th vertex will have all zero entries.

Polygon Vertex Order

For a visible 3-vertex polygon:

AB // clockwise order
C 
.
AC // CounterClock
B 

The same for 4-vertex polygon:

AB // clockwise
DC 
.
AD // CounterClock
BC 

Your 3D device will cull invisible polygons. An invisible polygon is a polygon that has the other direction order. For example, DirectX default setting is 'cull counterclockwise polygons', so only clockwise is visible.

Vertices must be reordered for clockwise vertex order (default for DirectX), and not changed for counterclockwise order:

for 3-vertices polygon: 
1. 1st vertice descriptor 
2. 3rd vertice descriptor 
3. 2nd vertice descriptor 
4. (not used, zero filled) 
for 4-vertices polygon: 
1. 1st vertice descriptor 
2. 4th vertice descriptor 
3. 3rd vertice descriptor 
4. 2nd vertice descriptor


Model File Formats