P3D Lod Sections

From Bohemia Interactive Community
Revision as of 03:19, 25 May 2010 by Mikero (talk | contribs) (faceoffsets)
Jump to navigation Jump to search

Template:unsupported-doc

LodSection

LodSection
{
 ulong FaceIndexOffsets[2];     // from / to region of LodFaces used
 ulong MaterialIndexOffsets[2]; // ODOLV4x only
 ulong CommonPointsUserValue;  // see P3D Point and Face Flags
                               // 0xC9 -> LodPoints 0x0C90003F
                               // LodPointFlags are in a separate table for arma, and in the VertexTable for ofp (odol7)
 short CommonTextureIndex;     //
 ulong CommonFaceFlags;        // see P3D Point and Face Flags
 ///////// // ODOLV4x only//////
 long  MaterialIndex;
 if MaterialIndex ==-1
 {
   byte ExtraByte;
 }
 ulong UnknowLong;             // generally 2
 float UnknownResolution;
 float UnknownResolution2;     // generally 1000.0
 ////////////////////////////////
}
  • a Material or Texture index with default value (-1) has no face/material associated with it and consequently the bounds are zero
  • In odol7 TextureIndexes and FaceFlags existed for every LodFace in the LodFace Structure, and repeated (as a block) here.
  • In Arma they are removed from the LodFaces.


FaceIndexOffsets

LodFaces are organised sequentially, in blocks.

The 1st block of faces use the 1st section and so on.

There must be, at least one section in a lod. If it's the only one, it will span the entire lodface structure.


FaceIndexOffsets contain relative memory offsets of the faces used in this section.

Each subsequent section (if any) uses the next, sequential block.

Because Faces contain either triangles, or, quads. The amount of data in each block is variable.

A face quad uses 10 bytes, a face triangle uses 8.

Example:

  • this section uses the first two faces of the face structure;
  • Face 0 = triangle (8 bytes)
  • Face 1 = box (10 bytes)
  • Face 2 (if any) next section (if any)
Lower Offset = 0    // ie start of the face structure since this is the 1st section
Upper Offser = 8+10 // bytes start of next section (if any) or end of faces

The next section (if any) will contain:

Lower Offset = 8+10 // beginning of this block
Upper Offset = 8*nTriangles.ThisBlock+ 10* nQuads.ThisBlock

etc

Related Page(s)

Model File Formats