r_model_obj.c File Reference

obj model loading More...

#include "r_local.h"
#include "../../shared/parse.h"
Include dependency graph for r_model_obj.c:

Go to the source code of this file.

Data Structures

struct  mobjvert_s
struct  mobjtri_s
struct  mobj_s

Defines

#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.
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.
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.
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.
void R_LoadObjModel (model_t *mod, byte *buffer, int bufSize)

Detailed Description

obj model loading

Definition in file r_model_obj.c.


Define Documentation

#define MAX_OBJ_FACE_VERTS   128

Definition at line 102 of file r_model_obj.c.

Referenced by R_LoadObjModelFace(), and R_LoadObjModelTris().


Typedef Documentation

typedef struct mobj_s mobj_t
typedef struct mobjtri_s mobjtri_t
typedef struct mobjvert_s mobjvert_t

Function Documentation

void R_LoadObjModel ( model_t mod,
byte buffer,
int  bufSize 
)
static void R_LoadObjModel_ ( model_t mod,
mobj_t obj,
const byte buffer,
int  bufSize 
) [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 290 of file r_model_obj.c.

References byte, Com_Trim(), i, MAX_STRING_CHARS, qfalse, qtrue, and R_LoadObjModelLine().

Referenced by R_LoadObjModel().

static int R_LoadObjModelFace ( const model_t mod,
mobj_t obj,
const char *  line 
) [static]

Each line consists of 3 or more vertex definitions, e.g.

 57/13/31 58/14/32 59/15/33 21/15/19 

Tokenize the line with Com_Parse, and parse each vertex definition. Faces with more than 3 vertices must be broken down into triangles.

Returns:
the number of triangles produced for the specified line.

Definition at line 140 of file r_model_obj.c.

References Com_Error(), Com_Parse(), ERR_DROP, i, MAX_OBJ_FACE_VERTS, model_s::name, mobjvert_s::normal, qtrue, R_LoadObjModelTris(), mobjvert_s::texcoord, mobj_s::tris, and mobjvert_s::vert.

Referenced by R_LoadObjModelLine().

static void R_LoadObjModelLine ( model_t mod,
mobj_t obj,
char *  line 
) [static]
static void R_LoadObjModelTris ( mobj_t obj,
const mobjvert_t verts,
int  count 
) [static]

Assembles count tris on the model from the specified array of verts.

Definition at line 107 of file r_model_obj.c.

References i, MAX_OBJ_FACE_VERTS, mobj_s::num_tris_parsed, mobj_s::tris, and mobjtri_s::verts.

Referenced by R_LoadObjModelFace().

static void R_LoadObjModelVertexArrays ( mobj_t obj,
model_t mod 
) [static]
static void R_LoadObjSkin ( model_t mod  )  [static]

Generated by  doxygen 1.6.2