UFO: Alien Invasion
|
obj model loading More...
Go to the source code of this file.
Data Structures | |
struct | mobjvert_s |
struct | mobjtri_s |
struct | mobj_s |
Macros | |
#define | MAX_OBJ_FACE_VERTS 128 |
Typedefs | |
typedef struct mobjvert_s | mobjvert_t |
typedef struct mobjtri_s | mobjtri_t |
typedef struct mobj_s | mobj_t |
Functions | |
static void | R_LoadObjModelVertexArrays (mobj_t *obj, model_t *mod) |
static void | R_LoadObjModelTris (mobj_t *obj, const mobjvert_t *verts, int count) |
Assembles count tris on the model from the specified array of verts. More... | |
static int | R_LoadObjModelFace (const model_t *mod, mobj_t *obj, const char *line) |
Each line consists of 3 or more vertex definitions, e.g. More... | |
static void | R_LoadObjModelLine (model_t *mod, mobj_t *obj, char *line) |
Parse the object file line. If the structures have been allocated, populate them. Otherwise simply accumulate counts. More... | |
static void | R_LoadObjSkin (model_t *mod) |
static void | R_LoadObjModel_ (model_t *mod, mobj_t *obj, const byte *buffer, int bufSize) |
Drives the actual parsing of the object file. The file is read twice: once to acquire primitive counts, and a second time to load them. More... | |
void | R_LoadObjModel (model_t *mod, byte *buffer, int bufSize) |
obj model loading
Definition in file r_model_obj.cpp.
#define MAX_OBJ_FACE_VERTS 128 |
Definition at line 98 of file r_model_obj.cpp.
Referenced by R_LoadObjModelFace(), and R_LoadObjModelTris().
typedef struct mobjvert_s mobjvert_t |
Definition at line 353 of file r_model_obj.cpp.
References AABB::add(), model_s::alias, Com_Error(), ERR_DROP, i, Mem_Free, Mem_PoolAllocType, Mem_PoolAllocTypeN, mAliasModel_s::meshes, mod_obj, model_s::modBox, model_s::name, mobj_s::normals, mAliasModel_s::num_frames, mAliasModel_s::num_meshes, mobj_s::num_normals, mobj_s::num_texcoords, mobj_s::num_tris, mobj_s::num_verts, OBJZERO, R_LoadObjModel_(), R_LoadObjModelVertexArrays(), R_LoadObjSkin(), mobj_s::texcoords, mobj_s::tris, model_s::type, v, mobj_s::verts, and vid_modelPool.
Referenced by LoadModel(), and R_LoadModelAsync().
|
static |
Drives the actual parsing of the object file. The file is read twice: once to acquire primitive counts, and a second time to load them.
Definition at line 323 of file r_model_obj.cpp.
References Com_Trim(), i, MAX_STRING_CHARS, and R_LoadObjModelLine().
Referenced by R_LoadObjModel().
Each line consists of 3 or more vertex definitions, e.g.
Tokenize the line with Com_Parse
, and parse each vertex definition. Faces with more than 3 vertices must be broken down into triangles.
Definition at line 134 of file r_model_obj.cpp.
References Com_Error(), Com_Parse(), ERR_DROP, i, MAX_OBJ_FACE_VERTS, model_s::name, mobjvert_s::normal, OBJZERO, R_LoadObjModelTris(), mobjvert_s::texcoord, mobj_s::tris, v, and mobjvert_s::vert.
Referenced by R_LoadObjModelLine().
Parse the object file line. If the structures have been allocated, populate them. Otherwise simply accumulate counts.
Definition at line 217 of file r_model_obj.cpp.
References Com_DPrintf(), Com_Error(), DEBUG_RENDERER, ERR_DROP, f, model_s::name, mobj_s::normals, mobj_s::num_normals, mobj_s::num_normals_parsed, mobj_s::num_texcoords, mobj_s::num_texcoords_parsed, mobj_s::num_tris, mobj_s::num_tris_parsed, mobj_s::num_verts, mobj_s::num_verts_parsed, Q_strnull(), R_LoadObjModelFace(), mobj_s::texcoords, mobj_s::tris, and mobj_s::verts.
Referenced by R_LoadObjModel_().
|
static |
Assembles count tris on the model from the specified array of verts.
Definition at line 103 of file r_model_obj.cpp.
References count, i, MAX_OBJ_FACE_VERTS, mobj_s::num_tris_parsed, mobj_s::tris, and mobjtri_s::verts.
Referenced by R_LoadObjModelFace().
Definition at line 58 of file r_model_obj.cpp.
References model_s::alias, i, Mem_PoolAllocTypeN, mAliasModel_s::meshes, mobjvert_s::normal, mobj_s::normals, mAliasMesh_s::normals, mobj_s::num_tris, mAliasMesh_s::num_tris, mobj_s::num_verts, mAliasMesh_s::num_verts, mobjvert_s::texcoord, mobj_s::texcoords, mAliasMesh_s::texcoords, mobj_s::tris, v, VectorCopy, mobjvert_s::vert, mobjtri_s::verts, mobj_s::verts, mAliasMesh_s::verts, and vid_modelPool.
Referenced by R_LoadObjModel().
Definition at line 267 of file r_model_obj.cpp.
References model_s::alias, Com_Parse(), Com_sprintf(), Com_StripExtension(), FS_CheckFile(), FS_FreeFile(), FS_LoadFile(), i, MAX_QPATH, Mem_PoolAllocType, Mem_PoolAllocTypeN, mAliasModel_s::meshes, model_s::name, image_s::name, mAliasSkin_s::name, mAliasMesh_s::num_skins, Q_streq, Q_strncpyz(), R_AliasModelGetSkin(), mAliasSkin_s::skin, mAliasMesh_s::skins, va(), and vid_modelPool.
Referenced by R_LoadObjModel().