P3D File Format - ODOLV7: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - ";[ ]+ " to "; ")
m (Text replacement - "{{HashLink" to "{{Link")
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Feature|UnsupportedDoc}}
{{Feature|UnsupportedDoc}}
{{TOC|side}}
= General =




=General=
== Legend ==
== Legend ==
see [[Generic FileFormat Data Types]]
see [[Generic FileFormat Data Types]]
== CompressedStructures ==
== CompressedStructures ==


(potentially) compressed arrays are endemic to most blocks contained in a p3d.
(potentially) compressed arrays are endemic to most blocks contained in a p3d.


CompressedStruct
<syntaxhighlight lang="cpp">
{
CompressedStruct
  ulong Count;
{
  <type> Array[Count];
ulong Count;
};
<type> Array[Count];
 
};
</syntaxhighlight>


if Count * sizeof(<type>) exceeds 1023 bytes the array is compressed. The '''resulting''' array will be expanded using lzh compression exactly as found in pbo's (for instance)
if Count * sizeof(<type>) exceeds 1023 bytes the array is compressed. The '''resulting''' array will be expanded using lzh compression exactly as found in pbo's (for instance)


After de-compression, the Count remains the same because it is a count of the arraytype.
After decompression, the Count remains the same because it is a count of the arraytype.


For uncompressed arrays (byte count < 1024) the Count and data are treated 'as is'.
For uncompressed arrays (byte count < 1024) the Count and data are treated 'as is'.
Line 24: Line 29:


Thus for various Array <types>
Thus for various Array <types>
*ulong Array:    > 255  // 1024 /  sizeof(ulong)
* ulong Array:    > 255  // 1024 /  sizeof(ulong)
*float thing[2]: > 127  // 1024 / 2*sizeof(float)
* float thing[2]: > 127  // 1024 / 2*sizeof(float)
*SomeStructure:  >      // count * sizeof (SomeStructure) > 1023
* SomeStructure:  >      // count * sizeof (SomeStructure) > 1023




Line 32: Line 37:




=Odol7Stuct=
= Odol7Stuct =
ODOLV7
 
{
See [[P3D Model Info]].
  StandardP3DHeader Header;
<syntaxhighlight lang="cpp">
  LodStruct         Lods[Header.LodCount];
ODOLV7
  [[P3D Model Info|ModelInfo]]        ModelInfo;
{
};
StandardP3DHeader Header;
LodStruct Lods[Header.LodCount];
ModelInfo ModelInfo;
};
</syntaxhighlight>
 


== StandardP3DHeader ==
== StandardP3DHeader ==
StandardP3DHeader
 
{
<syntaxhighlight lang="cpp">
  char     Signature[4];     ''//"ODOL" (vs MLOD eg)''
StandardP3DHeader
  ulong     Version;           ''// 7''
{
  ulong     LodCount;         ''// at least one''
char Signature[4]; //"ODOL" (vs MLOD eg)
}
ulong Version; // 7
ulong LodCount; // at least one
}
</syntaxhighlight>
 


== LodStruct ==
== LodStruct ==
LodStruct
 
{
See:
  [[#VertexTable|VertexTable]]   VertexTable;
* {{Link|#VertexTable}}
  float         UnknownFloat1;
* {{Link|#Textures}}
  float         UnknownFloat2;
* [[P3D Lod Edges]]
  XYZTriplet     MinPos;
* [[P3D Lod Faces]]
  XYZTriplet     MaxPos;
* [[P3D Lod Sections]]
  XYZTriplet     AutoCenterPos;
* [[P3D Named Selections]]
  float         UnknownFloat3;
* {{Link|#NamedProperty}}
  [[#Textures|Textures]]      Textures;
* [[P3D Lod Frames]]
  [[P3D Lod Edges|LodEdges]]      LodEdges;
* [[P3D Lod Proxies]]
  ulong         NoOfFaces;
 
  ulong         OffsetToLodSections;
 
  [[P3D Lod Faces|LodFace]]        LodFaces[NoOfFaces];               // ie polygons
<syntaxhighlight lang="cpp">
  ulong         nSections;
LodStruct
  [[P3D Lod Sections|LODSection]]    LODSections[nSections];
{
  ulong         nNamedSelections;
VertexTable VertexTable;
  [[P3D Named Selections|NamedSelection]] NamedSelections[nNamedSelections];
float UnknownFloat1;
  ulong         nTokens;
float UnknownFloat2;
  [[#NamedProperty|NamedProperty]]  NamedProperties[nTokens];
XYZTriplet MinPos;
  ulong         nFrames;
XYZTriplet MaxPos;
  [[P3D Lod Frames|Frame]]          Frames[nFrames];
XYZTriplet AutoCenterPos;
  ulong         IconColor;
float UnknownFloat3;
  ulong         SelectedColor;
Textures Textures;
  ulong         Unknown;
LodEdges LodEdges;
  ulong         nProxies;
ulong NoOfFaces;
  [[P3D Lod Proxies|LodProxy]]      LodProxies[nProxies];
ulong OffsetToLodSections;
};
LodFace LodFaces[NoOfFaces]; // ie polygons
ulong nSections;
LODSection LODSections[nSections];
ulong nNamedSelections;
NamedSelection NamedSelections[nNamedSelections];
ulong nTokens;
NamedProperty NamedProperties[nTokens];
ulong nFrames;
Frame Frames[nFrames];
ulong IconColor;
ulong SelectedColor;
ulong Unknown;
ulong nProxies;
LodProxy LodProxies[nProxies];
};
</syntaxhighlight>


=== VertexTable ===
=== VertexTable ===
  struct
 
  {  
See [[P3D Point and Face Flags]].
    ulong       Count;
<syntaxhighlight lang="cpp">
    ulong       PointFlags[Count]; // compressed. see [[P3D Point and Face Flags]]
struct
    ulong       Count;
{  
    UVPair     UV1[Count];         // compressed  
ulong Count;
    ulong       Count;
ulong PointFlags[Count]; // compressed
    XYZTriplet Points[Count];     // UNcompressed
ulong Count;
    ulong       Count;
UVPair UV1[Count]; // compressed  
    XYZTriplet Normals[Count];     // UNcompressed
ulong Count;
  }
XYZTriplet Points[Count]; // UNcompressed
ulong Count;
XYZTriplet Normals[Count]; // UNcompressed
}
</syntaxhighlight>


*Count is the same value for all four tables.
*Count is the same value for all four tables.


=== Textures ===
=== Textures ===
  struct
 
  {
<syntaxhighlight lang="cpp">
  '''ulong'''  Count;
struct
  '''asciiz''' Textures[...];         ''// "data/1.paa\0data/2.paa\0"...
{
  }
ulong Count;
asciiz Textures[...]; // "data/1.paa\0data/2.paa\0"...
}
</syntaxhighlight>


Count corresponds to the number of concatenated strings. It is required, since, architecturally at least, one of more of the asciiz strings could be null.
Count corresponds to the number of concatenated strings. It is required, since, architecturally at least, one of more of the asciiz strings could be null.


=== NamedProperty ===
<syntaxhighlight lang="cpp">
struct
{
Asciiz Property; // e.g "noshadow" = "1"
Asciiz Value;
}
</syntaxhighlight>


=== NamedProperty ===
  struct
  {
    Asciiz Property;// "noshadow" = "1" eg
    Asciiz Value;
  }


= Related Page(s) =


=Related Page(s)=
== LZ in ODOL ==
== LZ in ODOL ==
see [[Compressed LZSS File Format]]
see [[Compressed LZSS File Format]]


[[BIS_File_Formats#3D_Model_File_Formats|Model File Formats]]
[[BIS File Formats#3D Model File Formats|Model File Formats]]
 
 
[[Category:BIS_File_Formats]]
[[Category:BIS_File_Formats]]

Latest revision as of 17:43, 4 January 2023

bi symbol white.png
Disclaimer: This page describes internal undocumented structures of Bohemia Interactive software.

This page contains unofficial information.

Some usage of this information may constitute a violation of the rights of Bohemia Interactive and is in no way endorsed or recommended by Bohemia Interactive.
Bohemia Interactive is not willing to tolerate use of such tools if it contravenes any general licenses granted to end users of this community wiki or BI products.

General

Legend

see Generic FileFormat Data Types


CompressedStructures

(potentially) compressed arrays are endemic to most blocks contained in a p3d.

CompressedStruct
{
	ulong	Count;
	<type>	Array[Count];
};

if Count * sizeof(<type>) exceeds 1023 bytes the array is compressed. The resulting array will be expanded using lzh compression exactly as found in pbo's (for instance)

After decompression, the Count remains the same because it is a count of the arraytype.

For uncompressed arrays (byte count < 1024) the Count and data are treated 'as is'.


Thus for various Array <types>

  • ulong Array: > 255 // 1024 / sizeof(ulong)
  • float thing[2]: > 127 // 1024 / 2*sizeof(float)
  • SomeStructure: > // count * sizeof (SomeStructure) > 1023


Note that potentially compressed arrays in these structures only have an known output length. the decompressor therefore must work on infinite input length.


Odol7Stuct

See P3D Model Info.

ODOLV7
{
	StandardP3DHeader	Header;
	LodStruct			Lods[Header.LodCount];
	ModelInfo			ModelInfo;
};


StandardP3DHeader

StandardP3DHeader
{
	char	Signature[4];	//"ODOL" (vs MLOD eg)
	ulong	Version;		// 7
	ulong	LodCount;		// at least one
}


LodStruct

See:


LodStruct
{
	VertexTable		VertexTable;
	float			UnknownFloat1;
	float			UnknownFloat2;
	XYZTriplet		MinPos;
	XYZTriplet		MaxPos;
	XYZTriplet		AutoCenterPos;
	float			UnknownFloat3;
	Textures		Textures;
	LodEdges		LodEdges;
	ulong			NoOfFaces;
	ulong			OffsetToLodSections;
	LodFace			LodFaces[NoOfFaces]; // ie polygons
	ulong			nSections;
	LODSection		LODSections[nSections];
	ulong			nNamedSelections;
	NamedSelection	NamedSelections[nNamedSelections];
	ulong			nTokens;
	NamedProperty	NamedProperties[nTokens];
	ulong			nFrames;
	Frame			Frames[nFrames];
	ulong			IconColor;
	ulong			SelectedColor;
	ulong			Unknown;
	ulong			nProxies;
	LodProxy		LodProxies[nProxies];
};

VertexTable

See P3D Point and Face Flags.

	struct
	{ 
	ulong		Count;
	ulong		PointFlags[Count];	// compressed
	ulong		Count;
	UVPair		UV1[Count];			// compressed 
	ulong		Count;
	XYZTriplet	Points[Count];		// UNcompressed
	ulong		Count;
	XYZTriplet	Normals[Count];		// UNcompressed
	}
  • Count is the same value for all four tables.

Textures

struct
{
ulong	Count;
asciiz	Textures[...]; // "data/1.paa\0data/2.paa\0"...
}

Count corresponds to the number of concatenated strings. It is required, since, architecturally at least, one of more of the asciiz strings could be null.

NamedProperty

struct
{
	Asciiz Property; // e.g "noshadow" = "1"
	Asciiz Value;
}


Related Page(s)

LZ in ODOL

see Compressed LZSS File Format

Model File Formats