TORCS  1.3.9
The Open Racing Car Simulator
grloadac.cpp File Reference
#include <plib/ssg.h>
#include <zlib.h>
#include "grssgext.h"
#include "grvtxtable.h"
#include "grmultitexstate.h"
#include "grmain.h"
#include "grtexture.h"
Include dependency graph for grloadac.cpp:

Go to the source code of this file.

Classes

struct  _ssgMaterial
 
struct  Tag
 

Macros

#define FGETS(buf, len, file)   gzgets(file, buf, len)
 
#define FGETC(file)   gzgetc(file)
 
#define FOPEN(path, mode)   gzopen(path, mode)
 
#define FCLOSE(fd)   gzclose(fd)
 
#define NOTEXTURE   "empty_texture_no_mapping"
 
#define MAX_MATERIALS   1000 /* This *ought* to be enough! */
 
#define PARSE_CONT   0
 
#define PARSE_POP   1
 
#define OBJ_WORLD   0
 
#define OBJ_POLY   1
 
#define OBJ_GROUP   2
 
#define OBJ_LIGHT   3
 
#define VTXARRAY_GUIONS
 

Functions

static int do_material (char *s)
 
static int do_object (char *s)
 
static int do_name (char *s)
 
static int do_data (char *s)
 
static int do_texture (char *s)
 
static int do_texrep (char *s)
 
static int do_texoff (char *s)
 
static int do_rot (char *s)
 
static int do_loc (char *s)
 
static int do_url (char *s)
 
static int do_numvert (char *s)
 
static int do_numsurf (char *s)
 
static int do_surf (char *s)
 
static int do_mat (char *s)
 
static int do_refs (char *s)
 
static int do_kids (char *s)
 
static int do_obj_world (char *s)
 
static int do_obj_poly (char *s)
 
static int do_obj_group (char *s)
 
static int do_obj_light (char *s)
 
static void skip_spaces (char **s)
 
static void skip_quotes (char **s)
 
static int search (Tag *tags, char *s)
 
static ssgEntity * myssgLoadAC (const char *fname, const ssgLoaderOptions *options)
 
static ssgState * get_state (_ssgMaterial *mat)
 
static ssgState * get_state_ext (char *name)
 
void myssgFlatten (ssgEntity *obj)
 
ssgEntity * grssgCarLoadAC3D (const char *fname, const ssgLoaderOptions *options, int index)
 
ssgEntity * grssgLoadAC3D (const char *fname, const ssgLoaderOptions *options)
 

Variables

int inGroup =0
 
static double t_xmax
 
static double t_ymax
 
static double t_xmin
 
static double t_ymin
 
double shad_xmax
 
double shad_ymax
 
double shad_xmin
 
double shad_ymin
 
double carTrackRatioX =0
 
double carTrackRatioY =0
 
static gzFile loader_fd
 
static int num_materials = 0
 
static sgVec3 * vtab = NULL
 
static sgVec3 * ntab = NULL
 
static sgVec2 * t0tab = NULL
 
static sgVec2 * t1tab = NULL
 
static sgVec2 * t2tab = NULL
 
static sgVec2 * t3tab = NULL
 
static ssgIndexArray * vertlist =NULL
 
static ssgIndexArray * striplist =NULL
 
static int totalnv =0
 
static int totalstripe =0
 
static int usenormal = 0
 
static int nv
 
static int isacar = TRUE
 
static int usestrip =TRUE
 
static int usegroup =TRUE
 
static int mapLevel
 
static int numMapLevel
 
static int indexCar
 
static int isaWindow
 
static ssgLoaderOptions * current_options = NULL
 
static _ssgMaterialcurrent_material = NULL
 
static sgVec4 * current_colour = NULL
 
static ssgBranch * current_branch = NULL
 
static char * current_tfname = NULL
 
static char * current_tbase = NULL
 
static char * current_ttiled = NULL
 
static char * current_tskids = NULL
 
static char * current_tshad = NULL
 
static char * current_data = NULL
 
static _ssgMaterialmlist [MAX_MATERIALS]
 
static sgVec4 * clist [MAX_MATERIALS]
 
static sgMat4 current_matrix
 
static sgVec2 texrep
 
static sgVec2 texoff
 
static Tag top_tags []
 
static Tag object_tags []
 
static Tag surf_tag []
 
static Tag surface_tags []
 
static Tag obj_type_tags []
 
static int last_num_kids = -1
 
static int current_flags = -1
 

Macro Definition Documentation

◆ FCLOSE

#define FCLOSE (   fd)    gzclose(fd)

Definition at line 38 of file grloadac.cpp.

◆ FGETC

#define FGETC (   file)    gzgetc(file)

Definition at line 36 of file grloadac.cpp.

◆ FGETS

#define FGETS (   buf,
  len,
  file 
)    gzgets(file, buf, len)

Definition at line 35 of file grloadac.cpp.

◆ FOPEN

#define FOPEN (   path,
  mode 
)    gzopen(path, mode)

Definition at line 37 of file grloadac.cpp.

◆ MAX_MATERIALS

#define MAX_MATERIALS   1000 /* This *ought* to be enough! */

Definition at line 98 of file grloadac.cpp.

◆ NOTEXTURE

#define NOTEXTURE   "empty_texture_no_mapping"

Definition at line 97 of file grloadac.cpp.

◆ OBJ_GROUP

#define OBJ_GROUP   2

Definition at line 235 of file grloadac.cpp.

◆ OBJ_LIGHT

#define OBJ_LIGHT   3

Definition at line 236 of file grloadac.cpp.

◆ OBJ_POLY

#define OBJ_POLY   1

Definition at line 234 of file grloadac.cpp.

◆ OBJ_WORLD

#define OBJ_WORLD   0

Definition at line 233 of file grloadac.cpp.

◆ PARSE_CONT

#define PARSE_CONT   0

Definition at line 128 of file grloadac.cpp.

◆ PARSE_POP

#define PARSE_POP   1

Definition at line 129 of file grloadac.cpp.

◆ VTXARRAY_GUIONS

#define VTXARRAY_GUIONS

Function Documentation

◆ do_data()

static int do_data ( char *  s)
static

Definition at line 479 of file grloadac.cpp.

◆ do_kids()

static int do_kids ( char *  s)
static

Definition at line 1002 of file grloadac.cpp.

Here is the call graph for this function:

◆ do_loc()

static int do_loc ( char *  s)
static

Definition at line 638 of file grloadac.cpp.

◆ do_mat()

static int do_mat ( char *  s)
static

Definition at line 765 of file grloadac.cpp.

◆ do_material()

static int do_material ( char *  s)
static

Definition at line 336 of file grloadac.cpp.

Here is the call graph for this function:

◆ do_name()

static int do_name ( char *  s)
static

Definition at line 443 of file grloadac.cpp.

Here is the call graph for this function:

◆ do_numsurf()

static int do_numsurf ( char *  s)
static

Definition at line 736 of file grloadac.cpp.

Here is the call graph for this function:

◆ do_numvert()

static int do_numvert ( char *  s)
static

Definition at line 661 of file grloadac.cpp.

◆ do_obj_group()

static int do_obj_group ( char *  s)
static

Definition at line 240 of file grloadac.cpp.

◆ do_obj_light()

static int do_obj_light ( char *  s)
static

Definition at line 241 of file grloadac.cpp.

◆ do_obj_poly()

static int do_obj_poly ( char *  s)
static

Definition at line 239 of file grloadac.cpp.

◆ do_obj_world()

static int do_obj_world ( char *  s)
static

Definition at line 238 of file grloadac.cpp.

◆ do_object()

static int do_object ( char *  s)
static

Definition at line 387 of file grloadac.cpp.

Here is the call graph for this function:

◆ do_refs()

static int do_refs ( char *  s)
static

Definition at line 776 of file grloadac.cpp.

Here is the call graph for this function:

◆ do_rot()

static int do_rot ( char *  s)
static

Definition at line 622 of file grloadac.cpp.

◆ do_surf()

static int do_surf ( char *  s)
static

Definition at line 751 of file grloadac.cpp.

Here is the call graph for this function:

◆ do_texoff()

static int do_texoff ( char *  s)
static

Definition at line 614 of file grloadac.cpp.

◆ do_texrep()

static int do_texrep ( char *  s)
static

Definition at line 605 of file grloadac.cpp.

◆ do_texture()

static int do_texture ( char *  s)
static

Definition at line 507 of file grloadac.cpp.

Here is the call graph for this function:

◆ do_url()

static int do_url ( char *  s)
static

Definition at line 650 of file grloadac.cpp.

Here is the call graph for this function:

◆ get_state()

static ssgState* get_state ( _ssgMaterial mat)
static

Definition at line 248 of file grloadac.cpp.

Here is the call graph for this function:

◆ get_state_ext()

static ssgState* get_state_ext ( char *  name)
static

Definition at line 311 of file grloadac.cpp.

Here is the call graph for this function:

◆ grssgCarLoadAC3D()

ssgEntity* grssgCarLoadAC3D ( const char *  fname,
const ssgLoaderOptions *  options,
int  index 
)

Definition at line 1115 of file grloadac.cpp.

Here is the call graph for this function:

◆ grssgLoadAC3D()

ssgEntity* grssgLoadAC3D ( const char *  fname,
const ssgLoaderOptions *  options 
)

Definition at line 1149 of file grloadac.cpp.

Here is the call graph for this function:

◆ myssgFlatten()

void myssgFlatten ( ssgEntity *  obj)

Definition at line 1091 of file grloadac.cpp.

◆ myssgLoadAC()

static ssgEntity * myssgLoadAC ( const char *  fname,
const ssgLoaderOptions *  options 
)
static

Definition at line 1188 of file grloadac.cpp.

Here is the call graph for this function:

◆ search()

static int search ( Tag tags,
char *  s 
)
static

Definition at line 169 of file grloadac.cpp.

Here is the call graph for this function:

◆ skip_quotes()

static void skip_quotes ( char **  s)
static

Definition at line 145 of file grloadac.cpp.

Here is the call graph for this function:

◆ skip_spaces()

static void skip_spaces ( char **  s)
static

Definition at line 138 of file grloadac.cpp.

Variable Documentation

◆ carTrackRatioX

double carTrackRatioX =0

Definition at line 49 of file grloadac.cpp.

◆ carTrackRatioY

double carTrackRatioY =0

Definition at line 50 of file grloadac.cpp.

◆ clist

sgVec4* clist[MAX_MATERIALS]
static

Definition at line 100 of file grloadac.cpp.

◆ current_branch

ssgBranch* current_branch = NULL
static

Definition at line 90 of file grloadac.cpp.

◆ current_colour

sgVec4* current_colour = NULL
static

Definition at line 89 of file grloadac.cpp.

◆ current_data

char* current_data = NULL
static

Definition at line 96 of file grloadac.cpp.

◆ current_flags

int current_flags = -1
static

Definition at line 246 of file grloadac.cpp.

◆ current_material

_ssgMaterial* current_material = NULL
static

Definition at line 88 of file grloadac.cpp.

◆ current_matrix

sgMat4 current_matrix
static

Definition at line 102 of file grloadac.cpp.

◆ current_options

ssgLoaderOptions* current_options = NULL
static

Definition at line 87 of file grloadac.cpp.

◆ current_tbase

char* current_tbase = NULL
static

Definition at line 92 of file grloadac.cpp.

◆ current_tfname

char* current_tfname = NULL
static

Definition at line 91 of file grloadac.cpp.

◆ current_tshad

char* current_tshad = NULL
static

Definition at line 95 of file grloadac.cpp.

◆ current_tskids

char* current_tskids = NULL
static

Definition at line 94 of file grloadac.cpp.

◆ current_ttiled

char* current_ttiled = NULL
static

Definition at line 93 of file grloadac.cpp.

◆ indexCar

int indexCar
static

Definition at line 83 of file grloadac.cpp.

◆ inGroup

int inGroup =0

Definition at line 32 of file grloadac.cpp.

◆ isacar

int isacar = TRUE
static

Definition at line 78 of file grloadac.cpp.

◆ isaWindow

int isaWindow
static

Definition at line 85 of file grloadac.cpp.

◆ last_num_kids

int last_num_kids = -1
static

Definition at line 245 of file grloadac.cpp.

◆ loader_fd

gzFile loader_fd
static

Definition at line 53 of file grloadac.cpp.

◆ mapLevel

int mapLevel
static

Definition at line 81 of file grloadac.cpp.

◆ mlist

_ssgMaterial* mlist[MAX_MATERIALS]
static

Definition at line 99 of file grloadac.cpp.

◆ ntab

sgVec3* ntab = NULL
static

Definition at line 67 of file grloadac.cpp.

◆ num_materials

int num_materials = 0
static

Definition at line 65 of file grloadac.cpp.

◆ numMapLevel

int numMapLevel
static

Definition at line 82 of file grloadac.cpp.

◆ nv

int nv
static

Definition at line 77 of file grloadac.cpp.

◆ obj_type_tags

Tag obj_type_tags[]
static
Initial value:
=
{
{ "world", do_obj_world },
{ "poly" , do_obj_poly },
{ "group", do_obj_group },
{ "light", do_obj_light },
{ NULL, NULL }
}
static int do_obj_poly(char *s)
Definition: grloadac.cpp:239
static int do_obj_group(char *s)
Definition: grloadac.cpp:240
static int do_obj_world(char *s)
Definition: grloadac.cpp:238
static int do_obj_light(char *s)
Definition: grloadac.cpp:241

Definition at line 224 of file grloadac.cpp.

◆ object_tags

Tag object_tags[]
static
Initial value:
=
{
{ "name" , do_name },
{ "data" , do_data },
{ "texture" , do_texture },
{ "texrep" , do_texrep },
{ "texoff" , do_texoff },
{ "rot" , do_rot },
{ "loc" , do_loc },
{ "url" , do_url },
{ "numvert" , do_numvert },
{ "numsurf" , do_numsurf },
{ "kids" , do_kids },
{ NULL, NULL }
}
static int do_data(char *s)
Definition: grloadac.cpp:479
static int do_rot(char *s)
Definition: grloadac.cpp:622
static int do_name(char *s)
Definition: grloadac.cpp:443
static int do_texoff(char *s)
Definition: grloadac.cpp:614
static int do_url(char *s)
Definition: grloadac.cpp:650
static int do_texture(char *s)
Definition: grloadac.cpp:507
static int do_numvert(char *s)
Definition: grloadac.cpp:661
static int do_loc(char *s)
Definition: grloadac.cpp:638
static int do_kids(char *s)
Definition: grloadac.cpp:1002
static int do_texrep(char *s)
Definition: grloadac.cpp:605
static int do_numsurf(char *s)
Definition: grloadac.cpp:736

Definition at line 195 of file grloadac.cpp.

◆ shad_xmax

double shad_xmax

Definition at line 45 of file grloadac.cpp.

◆ shad_xmin

double shad_xmin

Definition at line 47 of file grloadac.cpp.

◆ shad_ymax

double shad_ymax

Definition at line 46 of file grloadac.cpp.

◆ shad_ymin

double shad_ymin

Definition at line 48 of file grloadac.cpp.

◆ striplist

ssgIndexArray* striplist =NULL
static

Definition at line 73 of file grloadac.cpp.

◆ surf_tag

Tag surf_tag[]
static
Initial value:
=
{
{ "SURF" , do_surf },
{ NULL, NULL }
}
static int do_surf(char *s)
Definition: grloadac.cpp:751

Definition at line 211 of file grloadac.cpp.

◆ surface_tags

Tag surface_tags[]
static
Initial value:
=
{
{ "mat" , do_mat },
{ "refs" , do_refs },
{ NULL, NULL }
}
static int do_refs(char *s)
Definition: grloadac.cpp:776
static int do_mat(char *s)
Definition: grloadac.cpp:765

Definition at line 217 of file grloadac.cpp.

◆ t0tab

sgVec2* t0tab = NULL
static

Definition at line 68 of file grloadac.cpp.

◆ t1tab

sgVec2* t1tab = NULL
static

Definition at line 69 of file grloadac.cpp.

◆ t2tab

sgVec2* t2tab = NULL
static

Definition at line 70 of file grloadac.cpp.

◆ t3tab

sgVec2* t3tab = NULL
static

Definition at line 71 of file grloadac.cpp.

◆ t_xmax

double t_xmax
static

Definition at line 40 of file grloadac.cpp.

◆ t_xmin

double t_xmin
static

Definition at line 42 of file grloadac.cpp.

◆ t_ymax

double t_ymax
static

Definition at line 41 of file grloadac.cpp.

◆ t_ymin

double t_ymin
static

Definition at line 43 of file grloadac.cpp.

◆ texoff

sgVec2 texoff
static

Definition at line 104 of file grloadac.cpp.

◆ texrep

sgVec2 texrep
static

Definition at line 103 of file grloadac.cpp.

◆ top_tags

Tag top_tags[]
static
Initial value:
=
{
{ "MATERIAL", do_material },
{ "OBJECT" , do_object },
}
static int do_object(char *s)
Definition: grloadac.cpp:387
static int do_material(char *s)
Definition: grloadac.cpp:336

Definition at line 188 of file grloadac.cpp.

◆ totalnv

int totalnv =0
static

Definition at line 74 of file grloadac.cpp.

◆ totalstripe

int totalstripe =0
static

Definition at line 75 of file grloadac.cpp.

◆ usegroup

int usegroup =TRUE
static

Definition at line 80 of file grloadac.cpp.

◆ usenormal

int usenormal = 0
static

Definition at line 76 of file grloadac.cpp.

◆ usestrip

int usestrip =TRUE
static

Definition at line 79 of file grloadac.cpp.

◆ vertlist

ssgIndexArray* vertlist =NULL
static

Definition at line 72 of file grloadac.cpp.

◆ vtab

sgVec3* vtab = NULL
static

Definition at line 66 of file grloadac.cpp.