The struct of .obj format.
char header[11] = {
ff,ff,ff,ff,"OBJ0250"}
int matdb //number of mesh all mesh have a
new material
char matnames[matdb][30]; 1. name of textura
neve
char matnames2[matdb][30]; 2. name of
texture
BYTE mattype[matdb] =
//Material types:
low 4 bits are the type of material effect
SHADER_MULTITEXTURE = 0
SHADER_BUMPDOT3, or SHADER_BUMP, or SHADER_BUMPWATER = 8
SHADER_BUMPWATER = 14
EFFECT_NONE = 15
EFFECT_ENVSPHERE = 9
high 4 bits are the tile settings
UWrap[0] |=64
VWrap[0] |=128
UWrap[1] |=16
VWrap[1] |=32
float matvalue[matdb] = emission parameter
of material
float matalpha[matdb] = 0.0f - 1.0f
int vertexdb
int polydb
float pos.x[vertexdb]
float pos.z[vertexdb]
float pos.y[vertexdb]
float tex.u[vertexdb]
float tex.v[vertexdb]
float tex.u2[vertexdb]
float tex.v2[vertexdb]
float color.alpha[vertexdb]
float color.r[vertexdb]
float color.g[vertexdb]
float color.b[vertexdb]
float normal.x[vertexdb]
float normal.y[vertexdb]
float normal.z[vertexdb]
int index[polydb*3] //vertex index in triangle list
int meshid[polydb] //material id on poly
int helpers
struct helperstruct {
char name[30];
char type_name[30];
float matrix[16];
}
helperstruct helper[helpers]
Extended data:
Chunks:
WORD type_of_chunk
int size_of_chunk
chunk data:
...
...
...
end of chunk: WORD 0
type_of_chunks:
#definee EOF = 0
End of file, no more data.
#define OBJHEADER_GLOSS 1
float matglossines[matdb]
#define OBJHEADER_BBOX 2
int bbids - number of sub boxes
...
...
#define OBJHEADER_ANIM 3
int anims - number of anims
for anim=0;<anims
int type = ANIM_KEYMATRIXES, type of key
for (int ani=0;ani<keys;ani++) {
sread(&DDDengine.anim[animcount].keytime[ani],sizeof(DDDengine.anim[0].keytime[0]),1,f);
sread(&DDDengine.anim[animcount].matrixes[ani],sizeof(DDDengine.anim[0].matrixes[0]),1,f);
}
#define OBJHEADER_SELFILUMINATIONCOLOR 4
float matselfinlumination[matdb]
#define OBJHEADER_BACKFACE 5
bool backface_mode - it is ceded in the name
of file also
#define OBJHEADER_BONES 6
int number_of_bones
for bone=0;<number_of_bones {
BYTE number_of_bones_in_hierarchy
BYTE subbones_id[number_of_bones_in_hierarchy]
}
MAXBLEND=8
BYTE vertexbone[vertexdb][MAXBLEND] - -1,
if there is no bone
float vetrtexbelnd[vertexdb][MAXBLEND]
#define OBJHEADER_BONES_MATRIX 7
int number_of_bones
matrix[number_of_bones]