Support Forum G3D Web Page |
Parses 3DS model files. More...
Classes | |
struct | ChunkHeader |
class | FaceMat |
class | Map |
A texture map. More... | |
class | Object |
class | UniversalMaterial |
Public Member Functions | |
void | parse (BinaryInput &bi, const String &basePath="<AUTO>") |
Public Attributes | |
BinaryInput * | b |
int | currentMaterial |
int | currentObject |
Index into objectArray of the object addressed by the current keyframe chunk. More... | |
Vector3 | currentPivot |
Matrix3 | currentRotation |
Used in Keyframe chunk. More... | |
Vector3 | currentScale |
Vector3 | currentTranslation |
G3D::uint32 | endFrame |
int | fileVersion |
Version number of the file. More... | |
Array< UniversalMaterial > | materialArray |
Table< String, int > | materialNameToIndex |
Maps material names to indices into the MaterialArray. More... | |
int | meshVersion |
Array< Object > | objectArray |
G3D::uint32 | startFrame |
Animation start and end frames from KFFRAMES chunk. More... | |
Protected Types | |
enum | ChunkHeaderID { MAIN3DS = 0x4d4d, M3D_VERSION = 0x0002, EDIT3DS = 0x3D3D, MESH_VERSION = 0x3D3E, EDITMATERIAL = 0xAFFF, MATNAME = 0xA000, MATAMBIENT = 0xA010, MATDIFFUSE = 0xA020, MATSPECULAR = 0xA030, MATSHININESS = 0xA040, MATSHIN2PCT = 0xA041, MATSHIN3PC = 0xA042, MATTRANSPARENCY = 0xA050, MATXPFALL = 0xA052, MATREFBLUR = 0xA053, MATSELFILLUM = 0xA080, MATTWOSIDE = 0xA081, MATDECAL = 0xA082, MATADDITIVE = 0xA083, MATSELFILPCT = 0xA084, MATWIRE = 0xA085, MATSUPERSMP = 0xA086, MATWIRESIZE = 0xA087, MATFACEMAP = 0xA088, MATXPFALLIN = 0xA08A, MATPHONG = 0xA08C, MATWIREABS = 0xA08E, MATSHADING = 0xA100, MATTEXTUREMAP1 = 0xA200, MAT_MAP_FILENAME = 0xA300, MAT_MAP_TILING = 0xA351, MAT_MAP_USCALE = 0xA354, MAT_MAP_VSCALE = 0xA356, MAT_MAP_UOFFSET = 0xA358, MAT_MAP_VOFFSET = 0xA35A, MATTEXTUREMAP2 = 0xA33A, MATOPACITYMAP = 0xA210, MATBUMPMAP = 0xA230, MATGLOSSYMAP = 0xA204, MATSHININESSMAP = 0xA33C, MATEMISSIVEMAP = 0xA33D, MATREFLECTIONMAP = 0xA220, EDIT_CONFIG1 = 0x0100, EDIT_CONFIG2 = 0x3E3D, EDIT_VIEW_P1 = 0x7012, EDIT_VIEW_P2 = 0x7011, EDIT_VIEW_P3 = 0x7020, EDIT_VIEW1 = 0x7001, EDIT_BACKGR = 0x1200, EDIT_AMBIENT = 0x2100, EDITOBJECT = 0x4000, OBJTRIMESH = 0x4100, TRIVERT = 0x4110, TRIFACE = 0x4120, TRIFACEMAT = 0x4130, TRI_TEXCOORDS = 0x4140, TRISMOOTH = 0x4150, TRIMATRIX = 0x4160, EDITKEYFRAME = 0xB000, KFAMBIENT = 0xB001, KFMESHINFO = 0xB002, KFNAME = 0xB010, KFPIVOT = 0xB013, KFMORPHANGLE = 0xB015, KFTRANSLATION = 0xB020, KFROTATION = 0xB021, KFSCALE = 0xB022, KFCAMERA = 0xB003, KFCAMERATARGET = 0xB004, KFOMNILIGHT = 0xB005, KFSPOTTARGET = 0xB006, KFSPOTLIGHT = 0xB007, KFFRAMES = 0xB008, KFFOV = 0xB023, KFROLL = 0xB024, KFCOLOR = 0xB025, KFMORPH = 0xB026, KFHOTSPOT = 0xB027, KFFALLOFF = 0xB028, KFHIDE = 0xB029, KFHIERARCHY = 0xB030, RGBF = 0x0010, RGB24 = 0x0011, INT_PCT = 0x0030, FLOAT_PCT = 0x0031 } |
Protected Member Functions | |
void | processChunk (const ChunkHeader &prevChunkHeader) |
Reads the next chunk from a file and processes it. More... | |
void | processMapChunk (Map &map, const ChunkHeader &materialChunkHeader) |
Called from processMaterialChunk. More... | |
void | processMaterialChunk (UniversalMaterial &material, const ChunkHeader &materialChunkHeader) |
Called from processChunk. More... | |
void | processObjectChunk (Object &object, const ChunkHeader &objectChunkHeader) |
Called from processChunk. More... | |
void | processTriMeshChunk (Object &object, const ChunkHeader &objectChunkHeader) |
Called from processObjectChunk. More... | |
Color3 | read3DSColor () |
Read either of the 3DS color chunk types and return the result. More... | |
float | read3DSPct () |
Read a percentage chunk. More... | |
Vector3 | read3DSVector () |
Reads a vector in the 3DS coordinate system and converts it to the G3D coordinate system. More... | |
ChunkHeader | readChunkHeader () |
Reads the next chunk from the file and returns it. More... | |
Vector3 | readLin3Track () |
The translation and scale information in a keyframe is packed with additional interpolation information. More... | |
Matrix3 | readRotTrack () |
void | readTCB () |
Reads (and ignores) TCB information from a track part of a keyframe chunk. More... | |
Parses 3DS model files.
This class maps the 3DS file format to a runtime object, which is then converted to a more useful runtime format and stored in G3D::ArticulatedModel.
|
protected |
void G3D::Parse3DS::parse | ( | BinaryInput & | bi, |
const String & | basePath = "<AUTO>" |
||
) |
|
protected |
Reads the next chunk from a file and processes it.
|
protected |
Called from processMaterialChunk.
|
protected |
Called from processChunk.
|
protected |
Called from processChunk.
|
protected |
Called from processObjectChunk.
|
protected |
Read either of the 3DS color chunk types and return the result.
|
protected |
Read a percentage chunk.
|
protected |
Reads a vector in the 3DS coordinate system and converts it to the G3D coordinate system.
|
protected |
Reads the next chunk from the file and returns it.
|
protected |
The translation and scale information in a keyframe is packed with additional interpolation information.
This reads all of it, then throws away everything except the 3D vector.
|
protected |
|
protected |
Reads (and ignores) TCB information from a track part of a keyframe chunk.
BinaryInput* G3D::Parse3DS::b |
int G3D::Parse3DS::currentMaterial |
int G3D::Parse3DS::currentObject |
Index into objectArray of the object addressed by the current keyframe chunk.
Vector3 G3D::Parse3DS::currentPivot |
Matrix3 G3D::Parse3DS::currentRotation |
Used in Keyframe chunk.
Vector3 G3D::Parse3DS::currentScale |
Vector3 G3D::Parse3DS::currentTranslation |
G3D::uint32 G3D::Parse3DS::endFrame |
int G3D::Parse3DS::fileVersion |
Version number of the file.
Array<UniversalMaterial> G3D::Parse3DS::materialArray |
Maps material names to indices into the MaterialArray.
int G3D::Parse3DS::meshVersion |
G3D::uint32 G3D::Parse3DS::startFrame |
Animation start and end frames from KFFRAMES chunk.