CMX VERSION 0 - 12 April 2004 (updated object flags 18 March 2011) ============= Mesh Export Format for the Live for Speed Racing Simulator. This document refers to the .CMX files supplied with the CMX Viewer. Important Copyright Notice : ============================ (c) 2004 Scawen Roberts, Eric Bailey, Victor Van Vlaardingen The car meshes in .CMX files may be freely read, converted, saved in other formats and used for non-commercial purposes only. When converted files are distributed, Live for Speed must be mentioned in a README file supplied with the files, along with an explanation that the files were created from original Live for Speed files, and our website address www.liveforspeed.net must be provided. The CMX files may not be used for commercial purposes without written permission from the Live for Speed developers. NOTES : ======= 1) X,Y,Z int values : fixed point world coordinates (1 metre = 65536) 2) Texture flags (MASK) 64 : shiny - use environment map 128 : custom - user defined skin - Non-custom textures are found in the data\pic folder - They are 24-bit raw files unless they have the extension .jpg - Textures marked as custom are jpg and are found in data\skins folder - Textures ending in ALPHA or ATEST are alpha or alphatest textures - They have two files, a 24 bit raw file for colour + 8 bit raw for alpha - e.g. xxxATEST - load the two files xxx.raw and xxxATEST.raw 3) Object configs : (track exports only) note : these are shifted one bit left compared with expected Bit 0 is always set Bit 1 - on in config 0 Bit 2 - on in config 1 etc... 4) Object flags : 64 : object must be ALPHA sorted 5) Surface types : (track exports only) 0 ROAD 1 RUMBLE 2 DIRT 3 GRASS 4 SAND 5 GRAVEL 6 METAL 7 CONCRETE 8 TREE 9 FENCE 10 WALL 11 DIRT_WALL 6) Vertex colours : 4 bytes - Opacity, R, G, B FILE DESCRIPTION : ================== num unit offset description --- ---- ------ ----------- HEADER BLOCK : 6 char 0 LFSCMX : do not read file if no match 1 byte 6 game version : ignore 1 byte 7 game revision : ignore 1 byte 8 CMX version (0) : do not read file if increased 1 byte 9 export type : track : 0 / car : 0 1 byte 10 0 : 1 byte 11 0 : 4 byte 12 0 : 32 char 16 name : text 1 col 48 ground colour : rgb0 - unlit ground colour 8 byte 52 0 : 1 float 60 sky horiz : radius of sky dome 1 float 64 sky vert : height of sky dome 1 int 68 num lightschemes : number 1 int 72 num configs : number (0 for car exports) 1 int 76 num textures : number 1 int 80 num objects : number ......LIGHTSCHEME BLOCKS ......CONFIG BLOCKS ......TEXTURE BLOCKS ......OBJECT BLOCKS LIGHTSCHEME BLOCK : 16 char 0 lightscheme name : name 16 char 16 sky texture name : texture 16 char 32 environment texture : texture 1 col 48 sky colour : rgb0 - average sky colour 1 col 52 sun colour : rgb0 - artist defined 1 float 56 sun intensity : sun colour multiplier 1 float 60 sky boost : sky colour multiplier 1 float 64 sun heading : radians, CCW from forward (Y) 1 float 68 sun pitch : radians, up from ground CONFIG BLOCK (track exports only) 16 char 0 config name : name 1 int 16 num nodes : number of nodes ......NODE BLOCKS NODE BLOCK (track exports only) 1 int 0 centre X : fp 1 int 4 centre Y : fp 1 int 8 centre Z : fp 1 float 12 dir X : float 1 float 16 dir Y : float 1 float 20 dir Z : float 1 float 24 limit left : lightmap limit 1 float 28 limit right : lightmap limit 1 float 32 drive left : road limit 1 float 36 drive right : road limit TEXTURE BLOCK : 16 char 0 texture name : see NOTES (2) 1 int 16 flags : texture flags - see NOTES (2) OBJECT BLOCK : 1 int 0 centre X : fp 1 int 4 centre Y : fp 1 int 8 centre Z : fp 1 int 12 radius : fp 1 word 16 object configs : SEE NOTES (3) 1 word 18 object flags : SEE NOTES (4) 1 word 20 num textures : number 1 word 22 num points : number 1 word 24 num tris : number 1 word 26 0 : ......TEXTURE INFO BLOCKS ......POINT BLOCKS ......TRIANGLE BLOCKS TEXTURE INFO BLOCK : 1 byte 2 flags : bit 0 : sky reflection 1 byte 3 0 : 1 byte 0 texture index : world texture index 1 byte 1 surface type : see NOTES (5) 1 word 4 num points : points in this texture 1 word 6 num tris : tris in this texture POINT BLOCK : 1 int 0 X : fp 1 int 4 Y : fp 1 int 8 Z : fp 1 float 12 NX : float normal X 1 float 16 NY : float normal Y 1 float 20 NZ : float normal Z 1 float 24 U : float U 1 float 28 V : float V 1 int 32 colour : see NOTES (6) TRIANGLE BLOCK : 1 word 0 vertex A : index 1 word 2 vertex B : index 1 word 4 vertex C : index 1 word 6 flags : bit 0 : GLASS