Model/PTR

From owdev
Jump to: navigation, search

Chunks are wrapped in a Common Chunked Format, primary identifier LDOM

LOCM

big endian - mcol - colission data.

 u16 nr_simple;
 u16 nr_complex;
 u16 nr_other;
 u16 nr_unknown;
 u64* strct_simple;
 u64* strct_complex;
 u64* mesh_desc_data;
 u64* unknown;
 u8 pad[];
struct desc_col_part
 ...

CLDM

 f32 desc_bbox[16];
 u8 unk1;
 u8 unk2; // same as unk1
 u16 unk3;
 u32 unk4;
 f32 unk5;
 u16 nr_materials;
 u16 unk6;
 u64 unk7;
 u64 unk8;
 u64* material_lookup;

DSEM

emitter s... data? attachements? formerly known as unk_struct1?

PRHM

h... reference pose

 u32 nr_bones;
 u32 unk
 u64* bone_data; // size = nr_bones
 u64* unk_data; // size = nr_bones

bone_data

 f32 matrix[16];
 u32 unk[8];

LDGR

ragdoll?

 u64* unk_data;
 u64 unk[4];
 u64 nr_sets;

unk_data

 u64 ffed;
 u64 zero1;
 u32 zero2;
 f32 unk1;
 u32 zero3;
 u64 unk3; // material id?
 u32 zero4;
 f32 unk4;
 f32 unk5;
 u32 zero5[3];
 u32 unk6;
 u32 unk7;
 u32 zero6[5];

MNRM

main mesh data

struct mesh_desc
{
	u32	nr_vertices;
	u8	nr_submesh_desc;
	u8	nr_somethings1;
	u8	nr_somethings2;
	u8	nr_somethings3;
	u8	nr_materials;
	u8	nr_somethings4;
	u8	nr_vertex_buffer_desc;
	u8	nr_index_buffer_desc;
	u32	unk5;
	f32	unk678[12];
	u32	unk9[4];
	f32	unkA[4];
	u32	unkB[4];
	u64*	vertex_buffer_desc;
	u64*	index_buffer_desc;
	u64*	submesh_desc;
	u64*	unk_desc;
};

vertex_buffer_desc

struct vertex_buffer_desc
{
	u32	nr_input_elements;
	u32	unk0;
	u8	stride_stream1;
	u8	stride_stream2;
	u8	nr_vertex_elements_desc;
	u8	unk1;		
	u32	unk2;
	u64*	vertex_elements_desc;	// array of nr_
	u64*	data_stream1;		// see vertex_element_desc
	u64*	data_stream2;		// see vertex_element_desc
};

vertex_element_desc

struct vertex_element_desc		// similarity to D3D11_INPUT_ELEMENT_DESC 
{
	u8	semantic_type;		
	u8	semantic_index;		// example 1st, 2nd, 3rd pair of UVs
	u8	data_format;			
	u8	stream_number;
	u16	classification;		// assumed D3D11_INPUT_CLASSIFICATION
	u16	stride_offset;
};

semantic_type

enum semantic_type			// semantics names can be found in DXBC files. not relevant here.
{
	POSITION	= 0,
	NORMAL		= 1,
	COLOR		= 2,		// unknown/unused
	TANGENT		= 3,
	BONE_INDICES	= 4,
	BONE_WEIGHT	= 5,
	UNKNOWN1	= 6,
	UNKNOWN2	= 7,
	UNKNOWN3	= 8,
	TEXCOORD	= 9,
	VERTEX_ID	= 10
};

data_format

enum data_format			// DXGI_FORMAT_s. RGBA == XYZW. known format behaviours.
{
	R32G32B32_FLOAT	= 2,
	R16G16_FLOAT	= 4,
	R8G8B8A8_UINT	= 6,
	R8G8B8A8_UNORM	= 8,
	R8G8B8A8_SNORM	= 9,
	R32_UINT	= 12
};

index_buffer_desc

struct index_buffer_desc
{
	u32	nr_indices;
	u32	format;			// or nothing. common 16-bit indices
	u64*	data_streami;		
};

submesh_desc

struct submesh_desc			// 'drawcall' assembly info
{
	f32	unk2[10];
	s64	index_something;	// purpose unknown.
	f32	unk1;
	u32	vertex_id_start;	// mul vertex buffer stream stride(s) to get releative offset(s).
	u16	index_id_start;
	u16	pad1;
	u32	unk3[3];
	u16	index_count;
	u16	nr_indices_to_draw;	// 'draw' means div 3 -> triangles to assemble.
	u16	nr_vertices_to_draw;	// 'draw' means run thru vertex shader. index relative.
	u16	offset_bone_id;
	u8	index_buffer_used;	// ? *shrugs*
	u8	pad3[7];
	u8	vertex_buffer_used;
	u8	flags;			// relevant? see submesh_enum
	u8	material;		// see material_lookup
	u8	LOD_flags;		// bit 1 = highest LOD
	u32	unk4;
};

lksm

skeleton

 u64* bone_hierarchy1; // size = nr_bone_hierarchy
 u64* bone_matrices; // size = nr_bones
 u64* bone_matrices_inverted; // size = nr_bones
 u64* bone_matrices3x4; // size = nr_bones
 u64* bone_matrices3x4_inverted; // size = nr_bones
 u64* unk_struct_6;
 u64* bone_id;
 u64* bone_names;
 u64* unk_struct_9;
 u64* bone_id_remapping;
 u64* bone_hierarchy2; // size = nr_bone_hierarchy
 u32 unk1;
 u16 nr_bone_hierarchy;
 u16 nr_bones;
 u16 unk2;
 u16 nr_bone_id_remapping;
 u16 nr_bone_ids;
 u16 nr_unk_struct_6;
 u16 unk4;
 u16 nr_bone_names;
 u16 nr_unk_struct_9;
 u16 unk5;
 u16 nr_padding_data; // nr of used bytes after unk_struct_8?

bone_hierarchy1

 u8 unk1;
 u8 unk2;
 i16 parentId;

bone_matrices

 f32 matrix[16]; // 4x4

bone_matrices_inverted

 f32 matrix[16] ;; // 4x4

bone_matrices3x4

 f32 matrix[12] ;; // 3x4 / 4x3

bone_matrices3x4_inverted

 f32 matrix[12] ;; // 3x4 / 4x3

unk_struct_6

 u32 unk1;
 f32 unk2[4]; 
 u32 pad[3];

bone_id

 u32 value;

bone_names

 u64* bone_name_packet;

bone_name_packet

 u8 value[14];

unk_struct_9

 u16 value;

unk_struct_A

 u16 value;

bone_hierarchy2

 u16 value;