|
Specification of LBA1 3D models (*.lm1) --------------------------------------------------------------------------------L I T T L E B I G A D V E N T U R E 1 3D Models Format - used for LBA 3D Object Viewer Revision 1 Author: Alexandre Fontoura [alexfont] Email: alexandrefontoura@oninetspeed.pt Last Modification: 31.08.2006 [#] [ INFORMATION ] ------------------------------------------------------------ This document describes the format in which the LBA1Relentless 3D models are stored in. I used this information in the generation of my LBA 3D Object Viewer. If you find any errors in this document please email me the details, also if you find new stuff please notify me. This information is provided AS IS. [#] [ 3D BASICS ] -------------------------------------------------------------- Here's some 3D little notions this document will talk about. - Points: is an entity with a location in space. - Elements: is a group of various points. - Shades: is the blocking of sunlight by any object, and also the shadow created by that object. - Polygons: is a closed planar path composed of a finite number of sequential line segments. - Vertexs: is a corner of a polygon (where two sides meet). [#] [ FORMAT ] ----------------------------------------------------------------- u16 = unsigned short (16bit) u32 = unsigned int (32bit) byte (8bit) + = to add in the previeous script bytes -------------------------------------------------------------------------------- [ Header ] 00: u16 Body Flag 02: u16 Unknown 04: u16 Unknown 06: u16 Unknown 08: u16 Unknown 0A: u16 Unknown 0C: u16 Unknown 0E: u16 Dummy Offset (to jump to offset 1A) 10..18: - Unused [ / Header ] [ Points ] 1A: u16 Number of points in the body |> Do this "Number of points in the body" times. [ Point ] 00: u16 X Coordinate 02: u16 Y Coordinate 04: u16 Z Coordinate [ / Point ] [ / Points ] +00: u16 Dummy [ Elements ] 02: u16 Number of elements in the body |> Do this "Number of elements in the body" times. [ Element ] 00: u16 First Point 02: u16 Number of Points 04: u16 Base Point 06: u16 Base Element 08: u16 Element Flag 0A: u16 Rotate Z 0C: u16 Rotate Y 0E: u16 Rotate X 10: u16 Unknown 12: u16 Use shade 14: u16 Unknown 16: u16 Unknown 18: u32 Unknown (Z ?) 1A: u32 Unknown (Y ?) 1C: u32 Unknown (X ?) 1E: u16 Unknown [ / Element ] [ / Elements ] +00: u16 Dummy [ Shades ] 02: u16 Number of shades in the body |> Do this "Number of shades in the body" times. [ Shade ] 00: u16 Unknown (Color Light ?) 02: u16 Unknown (Color Light ?) 04: u16 Unknown (Color Light ?) 06: u16 Unknown [ / Shade ] [ / Shades ] +00: u16 Dummy [ Polygons ] 02: u16 Number of polygons in the body |> Do this "Number of polygons in the body" times. [ Polygon ] 00: byte Render Type 01: byte Number of Vertexs 02: u16 Color index [ Vertexs ] |> Note, do only one of the followings "Render Types". [ IF Render Type >= 9 ] (One shade for each vertex) [ Vertex ] 00: u16 Shade Entry 02: u16 Point number / 6 [ / Vertex ] [ / IF ] [ ELSE IF Render Type >= 7 ] (Only one shade value is used for this polygon (all vertexs)) 00: u16 Polygon Shade [ Vertex ] 02: u16 Point number / 6 [ / Vertex ] [ / IF ] [ ELSE ] (No shade is used) [ Vertex ] 00: u16 Point number / 6 [ / Vertex ] [ / IF ] [ / Vertexs ] [ / Polygon ] [ / Polygons ] +00: u16 Dummy [ Lines ] 02: u16 Number of lines in the body |> Do this "Number of lines in the body" times. [ Line ] 00: u32 Unknown (Color ?) 04: u16 Point number / 6 06: u16 Point number / 6 [ / Line ] [ / Lines ] +00: u16 Dummy [ Spheres ] 02: u16 Number of spheres in the body |> Do this "Number of spheres in the body" times. [ Sphere ] 00: u32 Color 04: u16 Size 06: u16 Center [ / Sphere ] [ / Spheres ] [#] [ NOTES ] ------------------------------------------------------------------ The format above is applicable for models without animations, like the inventory models. To check if a model doesn't have subject an animation you must test the Body Flag: . Body Flag & 0x02 (no animation applicable) So if the model have an animations, this is, didn't past the above test, you need to make the following calculations. Note, you must make this after get the Header bytes and before the rest of the body bytes. - First you need to go till the Elements number offset. - Then you must make a cicle for all Elements: - Add 38 in the offset - Now in the offset value (offset+6) you must replace with the following calculation: (offset+6) = ((offset+6) * 36) / 38 ... and that's all. [#] [ END ] -------------------------------------------------------------------- |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||