Re #448 Temporarily removed reflexions on car wheels, for testing

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3962 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: beb6b58ae6526d0698bc1d170184c0d11a5d8f73
Former-commit-id: 0136bad6fae4c735b16f79f8d4163a57f7b7e74c
This commit is contained in:
pouillot 2011-10-09 16:42:43 +00:00
parent b8392473c1
commit 743e6ab40d
4 changed files with 56 additions and 7 deletions

View file

@ -234,7 +234,7 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
ssgEntity *whl3d = 0;
if (wheel_mod_name && strlen(wheel_mod_name)) {
snprintf(wheel_file_name, 32, "%s%d.acc", wheel_mod_name, j);
whl3d = grssgCarLoadAC3D(wheel_file_name, NULL, car->index);
whl3d = grssgCarWheelLoadAC3D(wheel_file_name, NULL, car->index);
}
// If we have a 3D wheel, use it, otherwise use auto- generated wheel...

View file

@ -78,6 +78,7 @@ static int totalstripe=0;
static int usenormal = 0;
static int nv;
static int isacar = TRUE;
static int isawheel = TRUE;
static int usestrip=TRUE;
static int usegroup=TRUE;
static int mapLevel;
@ -275,7 +276,7 @@ static ssgState *get_state ( _ssgMaterial *mat )
if (isaWindow) {
st -> enable ( GL_BLEND );
st -> setTranslucent () ;
} else if (isacar) {
} else if (isacar || isawheel) {
st -> enable ( GL_BLEND );
st -> setOpaque () ;
} else if ( mat -> rgb[3] < 0.99 ) {
@ -927,7 +928,7 @@ static int do_refs( char *s )
#ifdef NORMAL_TEST
/* GUIONS TEST that draw all the normals of a car */
if(isacar == TRUE) {
if(isacar || isawheel) {
ssgVertexArray *vlinelist = new ssgVertexArray(nv*2);
for (i = 0; i < nv; i++) {
sgVec3 tv;
@ -946,7 +947,7 @@ static int do_refs( char *s )
if (numMapLevel > grMaxTextureUnits) {
numMapLevel = grMaxTextureUnits;
}
if (isacar == TRUE) {
if (isacar) {
mapLevel=LEVELC;
if (tlist1 && grMaxTextureUnits > 1) {
mapLevel = LEVELC2;
@ -956,7 +957,11 @@ static int do_refs( char *s )
mapLevel = LEVELC3;
numMapLevel = 3;
}
} else if (isawheel) {
mapLevel = LEVEL0;
numMapLevel = 1;
}
#define VTXARRAY_GUIONS
#ifdef VTXARRAY_GUIONS
if (usestrip == FALSE)
@ -1072,7 +1077,7 @@ static int do_kids ( char *s )
/* check the number of texture units */
if (numMapLevel>grMaxTextureUnits)
numMapLevel=grMaxTextureUnits;
if (isacar==TRUE) {
if (isacar) {
mapLevel=LEVELC;
if (tlist1 && grMaxTextureUnits>2) {
mapLevel=LEVELC2;
@ -1082,6 +1087,9 @@ static int do_kids ( char *s )
mapLevel=LEVELC3;
numMapLevel=3;
}
} else if (isawheel) {
mapLevel = LEVEL0;
numMapLevel = 1;
}
/*ssgVtxArray* vtab = new ssgVtxArray ( gltype,
vlist, nrm, tlist0, col , vertlist) ;*/
@ -1152,6 +1160,7 @@ ssgEntity *grssgCarLoadAC3D ( const char *fname, const grssgLoaderOptions* optio
{
isacar=TRUE;
isawheel=FALSE;
usestrip=FALSE;
indexCar=index;
t_xmax=-999999.0;
@ -1182,9 +1191,45 @@ ssgEntity *grssgCarLoadAC3D ( const char *fname, const grssgLoaderOptions* optio
}
ssgEntity *grssgCarWheelLoadAC3D ( const char *fname, const grssgLoaderOptions* options, int carIndex )
{
isacar=FALSE;
isawheel=TRUE;
usestrip=FALSE;
indexCar=carIndex;
t_xmax=-999999.0;
t_ymax=-999999.0;
t_xmin=+999999.0;
t_ymin=+999999.0;
GfLogTrace("Loading %s\n", fname);
ssgEntity *obj = myssgLoadAC ( fname, options ) ;
if ( obj == NULL )
return NULL ;
/* Do some simple optimisations */
ssgBranch *model = new ssgBranch () ;
model -> addKid ( obj ) ;
if(usestrip==FALSE)
{
/*myssgFlatten(obj);*/
ssgFlatten ( obj ) ;
ssgStripify ( model ) ;
}
carTrackRatioX= (t_xmax-t_xmin)/(shad_xmax-shad_xmin);
carTrackRatioY= (t_ymax-t_ymin)/(shad_ymax-shad_ymin);
return model ;
}
ssgEntity *grssgLoadAC3D ( const char *fname, const grssgLoaderOptions* options )
{
isacar=FALSE;
isawheel=FALSE;
usegroup=FALSE;
usestrip=FALSE;

View file

@ -63,7 +63,10 @@ class grssgLoaderOptions : public ssgLoaderOptions
extern void grssgSetCurrentOptions(grssgLoaderOptions* options);
//! Load a car AC3D model from a file
extern ssgEntity *grssgCarLoadAC3D(const char *fname, const grssgLoaderOptions* options, int index);
extern ssgEntity *grssgCarLoadAC3D(const char *fname, const grssgLoaderOptions* options, int carIndex);
//! Load a car wheel AC3D model from a file
extern ssgEntity *grssgCarWheelLoadAC3D(const char *fname, const grssgLoaderOptions* options, int carIndex);
//! Load an AC3D model from a file
extern ssgEntity *grssgLoadAC3D(const char *fname, const grssgLoaderOptions* options);

View file

@ -99,7 +99,8 @@ ssgBase *grVtxTable::clone (int clone_flags)
grVtxTable::grVtxTable (int _numMapLevel,int _mapLevel)
{
//GfLogDebug("grVtxTable::grVtxTable(default TABLE, nml=%d, ml=%d)\n", _numMapLevel, _mapLevel);
//GfLogDebug("grVtxTable::grVtxTable(default TABLE, nml=%d, ml=%d)\n",
// _numMapLevel, _mapLevel);
numMapLevel = _numMapLevel;
mapLevelBitmap = _mapLevel;