LBA2:3D model

From LBA File Information
Jump to: navigation, search
3D model
Extension

LM2

Occurence

LBA2

Colour
Programs supporting this format

(none)

References

(none)

LM2 files contain 3D models used for Actors and other objects in LBA2.

Specification[edit]

[ Header ]
00:	s32	bodyFlag
08:	s32	xMin
0C:	s32	xMax
10:	s32	yMin
14:	s32	yMax
18:	s32	zMin
1C:	s32	zMax
20:	u32	Number of bones
24:	u32	Offset to bones
28:	u32	Number of vertices
2C:	u32	Offset to vertices
30:	u32	Number of normals
34:	u32	Offset to normals
38:	u32	Number of unknown1
3C:	u32	Offset to unknown1
40:	u32	Number of polygons
44:	u32	Offset to polygons
48:	u32	Number of lines
4C:	u32	Offset to lines
50:	u32	Number of spheres
54:	u32	Offset to spheres
58:	u32	Number of textures
5C:	u32	Offset to textures
[ / Header ]

[ Bone ]
00:	u16	Parent bone
02:	u16	Vertex
04:	u16	??
06:	u16	??
[ / Bone ]

[ Vertex ]
00:	s16	x
02:	s16	y
04:	s16	z
06:	u16	Bone
Vertex position is relative to its bone position.
And each bone position itself is relative to its parent bone position
[ / Vertex ]

[ Normal ]
00:	s16	x
02:	s16	y
04:	s16	z
06:	u16	??
[ / Normal ]

[ Unknown1 ]
00:	u16	??
02:	u16	??
04:	u16	??
06:	u16	??
[ / Unknown1 ]

[ Polygon section ]
Polygon section is made of one or more blocks. Each blocks can describe one or more Polygon.
	[ Polygon Block]
	00:	u8	Block ID
	01:	u8	00h For triangle and 80h for Quad
	02:	u16	Number of polygons
	04:	u16	Size of data (including this header)
	06:	u16	??
	Each polygon is described with ((size of data - 8) / Number of polygons) bytes :
		[ Polygon ]
		the 12 firsts bytes are mandatory :
		00:	u16	1st point ID
		02:	u16	2nd point ID
		04:	u16	3rd point ID
		06:	u16	4th point ID (only if Quad)
		08:	u8	colour ID
		09:	u8	??
		0A:	u8	??
		0B:	u8	??
		If the polygon is described with more than 12 bytes
		from 0Ch to 2BH, UV info for texture mapping:
		0C:	u8	??
		0D:	u8	U1
		0E:	u8	??
		0F:	u8	V1
		10:	u8	??
		11:	u8	U2
		12:	u8	??
		13:	u8	V2
		14:	u8	??
		15:	u8	U3
		16:	u8	??
		17:	u8	V3
		18:	u8	??
		19:	u8	U4
		2A:	u8	??
		2B:	u8	V4
		If the polygon is described with more than 24 bytes : ??
		[ / Polygon]
	[ / Polygon Block]
[ / Polygon section ]

[ Lines ]
00:	u16	??
02:	u16	colour
04:	u16	vertex1
06:	u16	vertex2
[ / Unknown2 ]

[ Sphere ]
00:	u16	??
02:	u8	??
03:	u8	colour
04:	u16	vertex
06:	u8	size
07:	u8	??
[ / Sphere ]

[ Textures ]
00:	u8	x
01:	u8	y
02:	u8	w
03:	u8	h
[ / Textures ]

Information provided by: xesf