P3D Named Selections: Difference between revisions
| No edit summary |  (merged odol structtures) | ||
| Line 70: | Line 70: | ||
| *Arma2: LZO compressed. | *Arma2: LZO compressed. | ||
|    LodNamedSelection |    LodNamedSelection | ||
|    { |    { | ||
|      asciiz       |      asciiz      SelectedName;                          // "rightleg" or "neck" eg | ||
|      ulong        |      ulong       NoOfFaces; | ||
|      ushort       |      ushort      FaceIndexes[NoOfFaces]; | ||
|      ulong       Always0Count; |      ulong       Always0Count; | ||
|      unknownType Array[Always0Count] |      unknownType Array[Always0Count] | ||
|      tbool       IsSectional;                                 //Appears in the sections[]= list of a model.cfg |      tbool       IsSectional;                                 //Appears in the sections[]= list of a model.cfg | ||
|      ulong       NoOfUlongs; |      ulong       NoOfUlongs; | ||
|      ulong       UnknownArray[NoOfUlongs];  |      ulong       UnknownArray[NoOfUlongs]; | ||
|      ulong        |      ulong       nVertices; | ||
|      ushort       |      ushort      VerticesIndexes[nVertices]; | ||
|      ulong       nTextureWeights; |      ulong       nTextureWeights; | ||
|      byte         |      byte        VerticesWeights[nTextureWeights]; | ||
|    } |    } | ||
| [[Category:BIS_File_Formats]] | [[Category:BIS_File_Formats]] | ||
| [[Category:ArmA: File Formats]] | [[Category:ArmA: File Formats]] | ||
Revision as of 08:16, 14 May 2010
Intro
currently a place holder until this is better organised
MLOD
Named Selections are contained in the Taggs structure in MLOD file format
 struct structTag_SelectedWeighted
 {
    TinyBool                   Active;               //Always true
    asciiz                     "<Any Ascii Characters>\0";
    ulong                      NoOfBytes;            //eg. Will always be NoOfPoints + NoOfFaces
    byte[NoOfPoints]           SelectedWeightedPoints;
    byte[NoOfFaces]            SelectedFaces;
 }
NB: The byte array's indicate a zero-based offset into the corresponding Points & Faces structures.
To clarify, the purpose of this 'chunk' is to denote which points & faces belong to a given 'Named Selection' and also to denote the 'per-point-weight' associated with this selection.
Each byte in the SelectedWeightedPoints array denotes a value 0 to 255 (0 to FF hex).
And, serves a dual purpose in...
- 1. Denoting the selectedness and
- 2. Denoting per point weighting.
- Zero (0) or 0x00 hex indicates the corresponding point in the LODs Points array is not selected.
 
 
- Any value other than zero indicates that the point is not only part of the selection but also has a weighting value.
 
 
- One (1) or 0x01 hex indicates the corresponding point in the LODs Points array is selected and has 100% weighting.
 
 
- Every value between 2 and 255 (0x02 to 0xFF hex) indicates the percentage weight of the corresponding point and that it is part of the selection.
- Two (2) being almost 100% weighted and 255 being almost 0% weighted.
 
 
Following is some appropriate pseudo-code to illustrate.
byte2weight
float32 byte2weight = (256 - weight)/255;
if (byte2weight > 1.0) then byte2weight = 0;
Where 'weight' is a unit8 (single byte) in the range...  0 >= weight <= 255 or 0x00 >= weight <= 0xFF.
weight2byte
unit8 weight2byte = round(256 - (255 x weight),0);
if (weight2byte == 256) then weight2byte = 0;
Where 'weight' is a float32 in the range...  0.0 >= weight <= 1.0.
ODOL
All arrays are subject to the 1024 rule. Which type of compression depends on odol version
- ODOL7 and ODOL40: LZSS compressed
- Arma2: LZO compressed.
 LodNamedSelection
 {
   asciiz      SelectedName;                          // "rightleg" or "neck" eg
   ulong       NoOfFaces;
   ushort      FaceIndexes[NoOfFaces];
   ulong       Always0Count;
   unknownType Array[Always0Count]
   tbool       IsSectional;                                 //Appears in the sections[]= list of a model.cfg
   ulong       NoOfUlongs;
   ulong       UnknownArray[NoOfUlongs];
   ulong       nVertices;
   ushort      VerticesIndexes[nVertices];
   ulong       nTextureWeights;
   byte        VerticesWeights[nTextureWeights];
 }
