P3D Lod Sections

From Bohemia Interactive Community
Revision as of 00:51, 6 May 2015 by Jaynus (talk | contribs) (derpastica rare models)
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;
 }
 ### V68 ###
     ulong   UknownLongValue1
     if UknownLongValue1 > 0
     {
         float   unknownFloats[11]
     }
 ###########
 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.

If there are any faces specified at all (a memory lod doesn't have them), there must be, at least one section in that lod. If it's the only section, 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