-added graphic compounds in mpa11
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9170 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 2c65a919dc764e8a97daeb47659858d30fba49b5 Former-commit-id: 08d6895c78cc183f97134cfe603f43cc0d47ace1
This commit is contained in:
parent
2d82b8ad37
commit
81d372b2cf
3 changed files with 728 additions and 334 deletions
|
@ -454,6 +454,8 @@ typedef struct
|
|||
tdble enginerpmMaxPw;
|
||||
tdble engineMaxTq;
|
||||
tdble engineMaxPw;
|
||||
tdble engineMaxTempWater;
|
||||
tdble engineTempWater;
|
||||
tdble gearRatio[MAX_GEARS]; /**< including final drive */
|
||||
int gearNb; /**< incl reverse and neutral */
|
||||
int gearOffset; /**< gearRatio[gear + gearOffset] is the ratio for gear */
|
||||
|
@ -494,6 +496,8 @@ typedef struct
|
|||
#define _enginerpmMaxPw priv.enginerpmMaxPw
|
||||
#define _engineMaxTq priv.engineMaxTq
|
||||
#define _engineMaxPw priv.engineMaxPw
|
||||
#define _engineMaxTempWater priv.engineMaxTempWater
|
||||
#define _engineTempWater priv.engineTempWater
|
||||
#define _gearRatio priv.gearRatio
|
||||
#define _gearNb priv.gearNb
|
||||
#define _gearOffset priv.gearOffset
|
||||
|
@ -836,6 +840,7 @@ typedef struct CarElt
|
|||
#define PRM_FUELCONS "fuel cons factor"
|
||||
#define PRM_ENGBRKCOEFF "brake coefficient"
|
||||
#define PRM_ENGBRKLINCOEFF "brake linear coefficient"
|
||||
#define PRM_ENGINEMAXTEMPWATER "max temperature water"
|
||||
#define PRM_POWER "power"
|
||||
#define PRM_TURBO "turbo"
|
||||
#define PRM_TURBO_RPM "turbo rpm"
|
||||
|
@ -857,6 +862,7 @@ typedef struct CarElt
|
|||
#define LST_RANGES "Ranges"
|
||||
#define PRM_THRESHOLD "threshold"
|
||||
#define PRM_CAR "car"
|
||||
|
||||
#define PRM_WHEELSON "wheels"
|
||||
#define PRM_TEMPLATE "template"
|
||||
#define PRM_ENV "env"
|
||||
|
@ -869,6 +875,13 @@ typedef struct CarElt
|
|||
#define PRM_SW_MODELHR "hi res model"
|
||||
#define PRM_SW_ANGLE "angle"
|
||||
|
||||
#define SECT_COMPOUND_MODEL "compound model"
|
||||
#define PRM_SOFTMODEL "model soft"
|
||||
#define PRM_MEDIUMMODEL "model medium"
|
||||
#define PRM_HARDMODEL "model hard"
|
||||
#define PRM_WETMODEL "model wet"
|
||||
#define PRM_EXTWETMODEL "model extrem wet"
|
||||
|
||||
#define LST_DRIVER "Driver"
|
||||
#define PRM_DRIVERSTEER "steer"
|
||||
#define PRM_DRIVERMODEL "driver"
|
||||
|
@ -882,7 +895,13 @@ typedef struct CarElt
|
|||
#define PRM_WATER_A_MODEL "water analogique model"
|
||||
#define PRM_OIL_A_MODEL "oil analogic model"
|
||||
|
||||
#define PRM_RPM_D_MODEL "rpm digital model"
|
||||
#define LST_RPM_LED "rpm led"
|
||||
#define PRM_RPM_LED_OFF "rpm led model off"
|
||||
#define PRM_RPM_LED_ON "rpm led model on"
|
||||
|
||||
#define LST_DIGIT_GEAR "digit gear"
|
||||
#define PRM_GEAR_MODEL "gear model"
|
||||
|
||||
#define PRM_SPEED_D_MODEL "speed digital model"
|
||||
#define PRM_SPD_D_MODEL "spd digital model"
|
||||
#define PRM_FUEL_D_MODEL "fuel digital model"
|
||||
|
@ -898,6 +917,11 @@ typedef struct CarElt
|
|||
#define SECT_COCKPIT "cockpit"
|
||||
#define PRM_MODELCOCKPIT "model cockpit"
|
||||
|
||||
#define SECT_SEPARATE_MODEL "separate model"
|
||||
#define PRM_METAL_BODY "metal model"
|
||||
#define PRM_CARBON_BODY "carbon model"
|
||||
#define PRM_MIRROR "mirror model"
|
||||
|
||||
#define SECT_WING_MODEL "wing model"
|
||||
#define PRM_WING_1 "model short oval"
|
||||
#define PRM_WING_2 "model long oval"
|
||||
|
@ -1003,6 +1027,12 @@ typedef enum
|
|||
#define PRM_FRONT_WHEEL_3D "3d front wheel"
|
||||
#define PRM_REAR_WHEEL_3D "3d rear wheel"
|
||||
|
||||
#define PRM_WHEELSOFT_3D "3d wheel soft"
|
||||
#define PRM_WHEELMEDIUM_3D "3d wheel medium"
|
||||
#define PRM_WHEELHARD_3D "3d wheel hard"
|
||||
#define PRM_WHEELWET_3D "3d wheel wet"
|
||||
#define PRM_WHEELEXTWET_3D "3d wheel extrem wet"
|
||||
|
||||
/* Lights */
|
||||
#define VAL_LIGHT_HEAD1 "head1"
|
||||
#define VAL_LIGHT_HEAD2 "head2"
|
||||
|
@ -1016,9 +1046,12 @@ typedef enum
|
|||
#define PRM_DAMAGE_SUSPENSION "damage/suspension"
|
||||
#define PRM_DAMAGE_ALIGNMENT "damage/alignment"
|
||||
#define PRM_DAMAGE_AERO "damage/aero"
|
||||
#define PRM_DAMAGE_ENGINE "damage/engine"
|
||||
#define PRM_MODEL_AEROFLOW "model/aero/flow"
|
||||
#define PRM_MODEL_AERO_FACTOR "model/aero/factor"
|
||||
#define PRM_MODEL_TYRE_TEMPERATURE "model/tyre/temperature"
|
||||
#define PRM_MODEL_TYRE_TEMPERATURE "model/tyres/temperature"
|
||||
#define PRM_MODEL_TYRE_COMPOUNDS "model/tyres/compounds"
|
||||
#define PRM_MODEL_ENGINE_TEMPERATURE "model/engine/temperature"
|
||||
|
||||
// Collision constants.
|
||||
#define SEM_COLLISION 0x01
|
||||
|
|
|
@ -32,9 +32,10 @@
|
|||
#include "grutil.h"
|
||||
#include "grcarlight.h" //grUpdateCarlight
|
||||
|
||||
|
||||
ssgBranch *CarsAnchorTmp = 0;
|
||||
|
||||
bool grCompounds = false;
|
||||
|
||||
static int grCarIndex;
|
||||
|
||||
static ssgSimpleState *brakeState = NULL;
|
||||
|
@ -44,14 +45,16 @@ void
|
|||
grInitCommonState(void)
|
||||
{
|
||||
/* brake */
|
||||
if (brakeState == NULL) {
|
||||
if (brakeState == NULL)
|
||||
{
|
||||
brakeState = new ssgSimpleState;
|
||||
brakeState->ref();
|
||||
brakeState->disable(GL_LIGHTING);
|
||||
brakeState->disable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
if (commonState == NULL) {
|
||||
if (commonState == NULL)
|
||||
{
|
||||
commonState = new ssgSimpleState;
|
||||
commonState->ref();
|
||||
commonState->disable(GL_LIGHTING);
|
||||
|
@ -60,9 +63,10 @@ grInitCommonState(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static ssgTransform *
|
||||
initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
||||
initWheel(tCarElt *car, int wheel_index, bool compound, const char *wheel_mod_name,
|
||||
const char *medium_mod_name, const char *hard_mod_name,
|
||||
const char *wet_mod_name, const char *extwet_mod_name)
|
||||
{
|
||||
int i, j, k;
|
||||
float alpha;
|
||||
|
@ -77,7 +81,8 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
static const tdble brakeAngle = 2.0 * M_PI / (tdble)brakeBranch;
|
||||
static const tdble brakeOffset = 0.1;
|
||||
|
||||
switch(wheel_index) {
|
||||
switch(wheel_index)
|
||||
{
|
||||
case FRNT_RGT:
|
||||
curAngle = -(M_PI / 2.0 + brakeAngle);
|
||||
b_offset = brakeOffset - car->_tireWidth(wheel_index) / 2.0;
|
||||
|
@ -108,7 +113,8 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
brk_vtx->add(vtx);
|
||||
|
||||
hubRadius = car->_brakeDiskRadius(wheel_index) * 0.6;
|
||||
for (i = 0; i < brakeBranch; i++) {
|
||||
for (i = 0; i < brakeBranch; i++)
|
||||
{
|
||||
alpha = (float)i * 2.0 * M_PI / (float)(brakeBranch - 1);
|
||||
vtx[0] = hubRadius * cos(alpha);
|
||||
vtx[1] = b_offset;
|
||||
|
@ -116,14 +122,14 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
brk_vtx->add(vtx);
|
||||
}
|
||||
|
||||
|
||||
clr[0] = clr[1] = clr[2] = 0.0;
|
||||
clr[3] = 1.0;
|
||||
brk_clr->add(clr);
|
||||
nrm[0] = nrm[2] = 0.0;
|
||||
|
||||
// Make normal point outside to have proper lighting.
|
||||
switch(wheel_index) {
|
||||
switch(wheel_index)
|
||||
{
|
||||
case FRNT_RGT:
|
||||
case REAR_RGT:
|
||||
nrm[1] = -1.0;
|
||||
|
@ -148,7 +154,8 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
brk_clr = new ssgColourArray(1);
|
||||
brk_nrm = new ssgNormalArray(1);
|
||||
|
||||
for (i = 0; i < (brakeBranch / 2 + 2); i++) {
|
||||
for (i = 0; i < (brakeBranch / 2 + 2); i++)
|
||||
{
|
||||
alpha = curAngle + (float)i * 2.0 * M_PI / (float)(brakeBranch - 1);
|
||||
vtx[0] = car->_brakeDiskRadius(wheel_index) * cos(alpha);
|
||||
vtx[1] = b_offset;
|
||||
|
@ -160,7 +167,6 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
brk_vtx->add(vtx);
|
||||
}
|
||||
|
||||
|
||||
clr[0] = clr[1] = clr[2] = 0.1;
|
||||
clr[3] = 1.0;
|
||||
brk_clr->add(clr);
|
||||
|
@ -180,7 +186,8 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
brk_clr = new ssgColourArray(1);
|
||||
brk_nrm = new ssgNormalArray(1);
|
||||
|
||||
for (i = 0; i < (brakeBranch / 2 - 2); i++) {
|
||||
for (i = 0; i < (brakeBranch / 2 - 2); i++)
|
||||
{
|
||||
alpha = - curAngle + (float)i * 2.0 * M_PI / (float)(brakeBranch - 1);
|
||||
vtx[0] = (car->_brakeDiskRadius(wheel_index) + 0.02) * cos(alpha);
|
||||
vtx[1] = b_offset;
|
||||
|
@ -192,7 +199,6 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
brk_vtx->add(vtx);
|
||||
}
|
||||
|
||||
|
||||
clr[0] = 0.2;
|
||||
clr[1] = 0.2;
|
||||
clr[2] = 0.2;
|
||||
|
@ -218,6 +224,7 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
wheel->addKid(whrotation);
|
||||
ssgSelector *whselector = new ssgSelector;
|
||||
whrotation->addKid(whselector);
|
||||
|
||||
grCarInfo[grCarIndex].wheelselector[wheel_index] = whselector;
|
||||
|
||||
float wheelRadius = car->_rimRadius(wheel_index) + car->_tireHeight(wheel_index);
|
||||
|
@ -226,19 +233,24 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
// Create wheels for 4 speeds (stillstanding - fast --> motion blur, look at the texture).
|
||||
// Note: These hard-coded values should really be read from the car's XML file
|
||||
char wheel_file_name[32];
|
||||
for (j = 0; j < 4; j++) {
|
||||
|
||||
if (compound)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
ssgBranch *whl_branch = new ssgBranch;
|
||||
|
||||
// Load speed-dependant 3D wheel model if available
|
||||
ssgEntity *whl3d = 0;
|
||||
if (wheel_mod_name && strlen(wheel_mod_name)) {
|
||||
if (wheel_mod_name && strlen(wheel_mod_name))
|
||||
{
|
||||
snprintf(wheel_file_name, 32, "%s%d.acc", wheel_mod_name, j);
|
||||
whl3d = grssgCarWheelLoadAC3D(wheel_file_name, NULL, car->index);
|
||||
}
|
||||
GfLogInfo(" Loading wheel %s\n", wheel_file_name);
|
||||
|
||||
// If we have a 3D wheel, use it, otherwise use auto- generated wheel...
|
||||
if (whl3d) {
|
||||
if (whl3d)
|
||||
{
|
||||
// Adapt size of the wheel
|
||||
ssgTransform *whl_size = new ssgTransform;
|
||||
sgMat4 wheelsz;
|
||||
|
@ -253,7 +265,8 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
whl_size->addKid(whl3d);
|
||||
whl3d = whl_size;
|
||||
|
||||
if (wheel_index == FRNT_RGT || wheel_index == REAR_RGT) {
|
||||
if (wheel_index == FRNT_RGT || wheel_index == REAR_RGT)
|
||||
{
|
||||
// flip wheel around so it faces the right way
|
||||
ssgTransform *whl_mesh_transform = new ssgTransform;
|
||||
sgCoord wheelpos;
|
||||
|
@ -261,19 +274,272 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
whl_mesh_transform->setTransform( &wheelpos);
|
||||
whl_mesh_transform->addKid(whl3d);
|
||||
whl_branch->addKid(whl_mesh_transform);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
whl_branch->addKid(whl3d);
|
||||
}
|
||||
}
|
||||
|
||||
whselector->addKid(whl_branch);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
ssgBranch *whl_branch = new ssgBranch;
|
||||
|
||||
// Load speed-dependant 3D wheel model if available
|
||||
ssgEntity *whl3d = 0;
|
||||
if (medium_mod_name && strlen(medium_mod_name))
|
||||
{
|
||||
snprintf(wheel_file_name, 32, "%s%d.acc", medium_mod_name, j);
|
||||
whl3d = grssgCarWheelLoadAC3D(wheel_file_name, NULL, car->index);
|
||||
GfLogInfo(" Loading wheel %s\n", wheel_file_name);
|
||||
|
||||
// If we have a 3D wheel, use it, otherwise use auto- generated wheel...
|
||||
if (whl3d)
|
||||
{
|
||||
// Adapt size of the wheel
|
||||
ssgTransform *whl_size = new ssgTransform;
|
||||
sgMat4 wheelsz;
|
||||
|
||||
sgSetVec4(wheelsz[0], wheelRadius * 2, SG_ZERO, SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[1], SG_ZERO, car->_tireWidth(wheel_index), SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[2], SG_ZERO, SG_ZERO, wheelRadius * 2, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[3], SG_ZERO, SG_ZERO, SG_ZERO, SG_ONE) ;
|
||||
|
||||
whl_size->setTransform(wheelsz);
|
||||
|
||||
whl_size->addKid(whl3d);
|
||||
whl3d = whl_size;
|
||||
|
||||
if (wheel_index == FRNT_RGT || wheel_index == REAR_RGT)
|
||||
{
|
||||
// flip wheel around so it faces the right way
|
||||
ssgTransform *whl_mesh_transform = new ssgTransform;
|
||||
sgCoord wheelpos;
|
||||
sgSetCoord(&wheelpos, 0, 0, 0, 180, 0, 0);
|
||||
whl_mesh_transform->setTransform( &wheelpos);
|
||||
whl_mesh_transform->addKid(whl3d);
|
||||
whl_branch->addKid(whl_mesh_transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
whl_branch->addKid(whl3d);
|
||||
}
|
||||
}
|
||||
|
||||
whselector->addKid(whl_branch);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
ssgBranch *whl_branch = new ssgBranch;
|
||||
|
||||
// Load speed-dependant 3D wheel model if available
|
||||
ssgEntity *whl3d = 0;
|
||||
if (hard_mod_name && strlen(hard_mod_name))
|
||||
{
|
||||
snprintf(wheel_file_name, 32, "%s%d.acc", hard_mod_name, j);
|
||||
whl3d = grssgCarWheelLoadAC3D(wheel_file_name, NULL, car->index);
|
||||
GfLogInfo(" Loading wheel %s\n", wheel_file_name);
|
||||
|
||||
// If we have a 3D wheel, use it, otherwise use auto- generated wheel...
|
||||
if (whl3d)
|
||||
{
|
||||
// Adapt size of the wheel
|
||||
ssgTransform *whl_size = new ssgTransform;
|
||||
sgMat4 wheelsz;
|
||||
|
||||
sgSetVec4(wheelsz[0], wheelRadius * 2, SG_ZERO, SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[1], SG_ZERO, car->_tireWidth(wheel_index), SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[2], SG_ZERO, SG_ZERO, wheelRadius * 2, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[3], SG_ZERO, SG_ZERO, SG_ZERO, SG_ONE) ;
|
||||
|
||||
whl_size->setTransform(wheelsz);
|
||||
|
||||
whl_size->addKid(whl3d);
|
||||
whl3d = whl_size;
|
||||
|
||||
if (wheel_index == FRNT_RGT || wheel_index == REAR_RGT)
|
||||
{
|
||||
// flip wheel around so it faces the right way
|
||||
ssgTransform *whl_mesh_transform = new ssgTransform;
|
||||
sgCoord wheelpos;
|
||||
sgSetCoord(&wheelpos, 0, 0, 0, 180, 0, 0);
|
||||
whl_mesh_transform->setTransform( &wheelpos);
|
||||
whl_mesh_transform->addKid(whl3d);
|
||||
whl_branch->addKid(whl_mesh_transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
whl_branch->addKid(whl3d);
|
||||
}
|
||||
}
|
||||
|
||||
whselector->addKid(whl_branch);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
ssgBranch *whl_branch = new ssgBranch;
|
||||
|
||||
// Load speed-dependant 3D wheel model if available
|
||||
ssgEntity *whl3d = 0;
|
||||
if (wet_mod_name && strlen(wet_mod_name))
|
||||
{
|
||||
snprintf(wheel_file_name, 32, "%s%d.acc", wet_mod_name, j);
|
||||
whl3d = grssgCarWheelLoadAC3D(wheel_file_name, NULL, car->index);
|
||||
GfLogInfo(" Loading wheel %s\n", wheel_file_name);
|
||||
|
||||
// If we have a 3D wheel, use it, otherwise use auto- generated wheel...
|
||||
if (whl3d)
|
||||
{
|
||||
// Adapt size of the wheel
|
||||
ssgTransform *whl_size = new ssgTransform;
|
||||
sgMat4 wheelsz;
|
||||
|
||||
sgSetVec4(wheelsz[0], wheelRadius * 2, SG_ZERO, SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[1], SG_ZERO, car->_tireWidth(wheel_index), SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[2], SG_ZERO, SG_ZERO, wheelRadius * 2, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[3], SG_ZERO, SG_ZERO, SG_ZERO, SG_ONE) ;
|
||||
|
||||
whl_size->setTransform(wheelsz);
|
||||
|
||||
whl_size->addKid(whl3d);
|
||||
whl3d = whl_size;
|
||||
|
||||
if (wheel_index == FRNT_RGT || wheel_index == REAR_RGT)
|
||||
{
|
||||
// flip wheel around so it faces the right way
|
||||
ssgTransform *whl_mesh_transform = new ssgTransform;
|
||||
sgCoord wheelpos;
|
||||
sgSetCoord(&wheelpos, 0, 0, 0, 180, 0, 0);
|
||||
whl_mesh_transform->setTransform( &wheelpos);
|
||||
whl_mesh_transform->addKid(whl3d);
|
||||
whl_branch->addKid(whl_mesh_transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
whl_branch->addKid(whl3d);
|
||||
}
|
||||
}
|
||||
|
||||
whselector->addKid(whl_branch);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
ssgBranch *whl_branch = new ssgBranch;
|
||||
|
||||
// Load speed-dependant 3D wheel model if available
|
||||
ssgEntity *whl3d = 0;
|
||||
if (extwet_mod_name && strlen(extwet_mod_name))
|
||||
{
|
||||
snprintf(wheel_file_name, 32, "%s%d.acc", extwet_mod_name, j);
|
||||
whl3d = grssgCarWheelLoadAC3D(wheel_file_name, NULL, car->index);
|
||||
GfLogInfo(" Loading wheel %s\n", wheel_file_name);
|
||||
|
||||
// If we have a 3D wheel, use it, otherwise use auto- generated wheel...
|
||||
if (whl3d)
|
||||
{
|
||||
// Adapt size of the wheel
|
||||
ssgTransform *whl_size = new ssgTransform;
|
||||
sgMat4 wheelsz;
|
||||
|
||||
sgSetVec4(wheelsz[0], wheelRadius * 2, SG_ZERO, SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[1], SG_ZERO, car->_tireWidth(wheel_index), SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[2], SG_ZERO, SG_ZERO, wheelRadius * 2, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[3], SG_ZERO, SG_ZERO, SG_ZERO, SG_ONE) ;
|
||||
|
||||
whl_size->setTransform(wheelsz);
|
||||
|
||||
whl_size->addKid(whl3d);
|
||||
whl3d = whl_size;
|
||||
|
||||
if (wheel_index == FRNT_RGT || wheel_index == REAR_RGT)
|
||||
{
|
||||
// flip wheel around so it faces the right way
|
||||
ssgTransform *whl_mesh_transform = new ssgTransform;
|
||||
sgCoord wheelpos;
|
||||
sgSetCoord(&wheelpos, 0, 0, 0, 180, 0, 0);
|
||||
whl_mesh_transform->setTransform( &wheelpos);
|
||||
whl_mesh_transform->addKid(whl3d);
|
||||
whl_branch->addKid(whl_mesh_transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
whl_branch->addKid(whl3d);
|
||||
}
|
||||
}
|
||||
|
||||
whselector->addKid(whl_branch);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
ssgBranch *whl_branch = new ssgBranch;
|
||||
|
||||
// Load speed-dependant 3D wheel model if available
|
||||
ssgEntity *whl3d = 0;
|
||||
if (wheel_mod_name && strlen(wheel_mod_name))
|
||||
{
|
||||
snprintf(wheel_file_name, 32, "%s%d.acc", wheel_mod_name, j);
|
||||
whl3d = grssgCarWheelLoadAC3D(wheel_file_name, NULL, car->index);
|
||||
GfLogInfo(" Loading wheel %s\n", wheel_file_name);
|
||||
}
|
||||
|
||||
// If we have a 3D wheel, use it, otherwise use auto- generated wheel...
|
||||
if (whl3d)
|
||||
{
|
||||
// Adapt size of the wheel
|
||||
ssgTransform *whl_size = new ssgTransform;
|
||||
sgMat4 wheelsz;
|
||||
|
||||
sgSetVec4(wheelsz[0], wheelRadius * 2, SG_ZERO, SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[1], SG_ZERO, car->_tireWidth(wheel_index), SG_ZERO, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[2], SG_ZERO, SG_ZERO, wheelRadius * 2, SG_ZERO) ;
|
||||
sgSetVec4(wheelsz[3], SG_ZERO, SG_ZERO, SG_ZERO, SG_ONE) ;
|
||||
|
||||
whl_size->setTransform(wheelsz);
|
||||
|
||||
whl_size->addKid(whl3d);
|
||||
whl3d = whl_size;
|
||||
|
||||
if (wheel_index == FRNT_RGT || wheel_index == REAR_RGT)
|
||||
{
|
||||
// flip wheel around so it faces the right way
|
||||
ssgTransform *whl_mesh_transform = new ssgTransform;
|
||||
sgCoord wheelpos;
|
||||
sgSetCoord(&wheelpos, 0, 0, 0, 180, 0, 0);
|
||||
whl_mesh_transform->setTransform( &wheelpos);
|
||||
whl_mesh_transform->addKid(whl3d);
|
||||
whl_branch->addKid(whl_mesh_transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
whl_branch->addKid(whl3d);
|
||||
}
|
||||
|
||||
// If we don't have a 3D wheel, use auto-generated wheel...
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
static const int wheelBranch = 16;
|
||||
static const sgVec2 toffset[4] =
|
||||
{ { 0.0, 0.5 }, { 0.5, 0.5 }, { 0.0, 0.0 }, { 0.5, 0.0 } };
|
||||
|
||||
/* Try and load rim texture if not already done */
|
||||
if (!grCarInfo[grCarIndex].wheelTexture) {
|
||||
if (!grCarInfo[grCarIndex].wheelTexture)
|
||||
{
|
||||
const char *wheelTexFName =
|
||||
GfParmGetStr(car->_carHandle, SECT_GROBJECTS, PRM_WHEEL_TEXTURE, "tex-wheel.png");
|
||||
grCarInfo[grCarIndex].wheelTexture = grSsgLoadTexState(wheelTexFName);
|
||||
|
@ -288,7 +554,8 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
|
||||
whl_nrm->add(nrm);
|
||||
clr[3] = 1.0;
|
||||
for (i = 0; i < wheelBranch; i++) {
|
||||
for (i = 0; i < wheelBranch; i++)
|
||||
{
|
||||
alpha = (float)i * 2.0 * M_PI / (float)(wheelBranch - 1);
|
||||
vtx[0] = wheelRadius * cos(alpha);
|
||||
vtx[2] = wheelRadius * sin(alpha);
|
||||
|
@ -331,12 +598,15 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
colorfactor[0] = 0.3f;
|
||||
colorfactor[1] = 1.0f;
|
||||
nrm[1] *= -1.0f;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
colorfactor[0] = 1.0f;
|
||||
colorfactor[1] = 0.3f;
|
||||
}
|
||||
|
||||
for (k = 0; k < 2; k++) {
|
||||
for (k = 0; k < 2; k++)
|
||||
{
|
||||
whl_vtx = new ssgVertexArray(wheelBranch + 1);
|
||||
ssgTexCoordArray *whl_tex = new ssgTexCoordArray(wheelBranch + 1);
|
||||
whl_clr = new ssgColourArray(1);
|
||||
|
@ -356,7 +626,9 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
tex[1] = 0.25 + toffset[j][1];
|
||||
whl_tex->add(tex);
|
||||
vtx[1] = (float)(2 * k - 1) * car->_tireWidth(wheel_index) / 2.0;
|
||||
for (i = 0; i < wheelBranch; i++) {
|
||||
|
||||
for (i = 0; i < wheelBranch; i++)
|
||||
{
|
||||
alpha = (float)i * 2.0 * M_PI / (float)(wheelBranch - 1);
|
||||
vtx[0] = wheelRadius * cos(alpha);
|
||||
vtx[2] = wheelRadius * sin(alpha);
|
||||
|
@ -365,6 +637,7 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
tex[1] = 0.25 + 0.25 * sin(alpha) + toffset[j][1];
|
||||
whl_tex->add(tex);
|
||||
}
|
||||
|
||||
whl = new ssgVtxTable(GL_TRIANGLE_FAN, whl_vtx, whl_nrm, whl_tex, whl_clr);
|
||||
whl->setState(grCarInfo[grCarIndex].wheelTexture);
|
||||
whl->setCullFace(0);
|
||||
|
@ -379,16 +652,22 @@ initWheel(tCarElt *car, int wheel_index, const char *wheel_mod_name)
|
|||
|
||||
whselector->addKid(whl_branch);
|
||||
}
|
||||
}
|
||||
|
||||
return wheel;
|
||||
}
|
||||
|
||||
|
||||
#define GR_SHADOW_POINTS 6
|
||||
|
||||
void
|
||||
grInitShadow(tCarElt *car)
|
||||
{
|
||||
const char* pszShadow =
|
||||
GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_SHADOW_TYPE, GR_ATT_SHADOW_NONE);
|
||||
GfLogInfo("Shadow Type SSG : %s\n", pszShadow);
|
||||
|
||||
{
|
||||
GfLogInfo("Init shadow static SSG\n");
|
||||
char buf[512];
|
||||
const char *shdTexName;
|
||||
int i;
|
||||
|
@ -423,7 +702,8 @@ grInitShadow(tCarElt *car)
|
|||
#define MULT 1.1
|
||||
vtx[2] = 0.0;
|
||||
for (i = 0, x = car->_dimension_x * MULT / 2.0; i < GR_SHADOW_POINTS / 2;
|
||||
i++, x -= car->_dimension_x * MULT / (float)(GR_SHADOW_POINTS - 2) * 2.0) {
|
||||
i++, x -= car->_dimension_x * MULT / (float)(GR_SHADOW_POINTS - 2) * 2.0)
|
||||
{
|
||||
/*vtx[0] = x;
|
||||
vtx[1] = car->_dimension_y * MULT / 2.0;
|
||||
shd_vtx->add(vtx);
|
||||
|
@ -456,24 +736,27 @@ grInitShadow(tCarElt *car)
|
|||
grCarInfo[car->index].shadowAnchor->addKid(grCarInfo[car->index].shadowCurr);
|
||||
ShadowAnchor->addKid(grCarInfo[car->index].shadowAnchor);
|
||||
grCarInfo[car->index].shadowBase->ref();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
grPropagateDamage (ssgEntity* l, sgVec3 poc, sgVec3 force, int cnt)
|
||||
{
|
||||
//showEntityType (l);
|
||||
if (l->isAKindOf (ssgTypeBranch())) {
|
||||
if (l->isAKindOf (ssgTypeBranch()))
|
||||
{
|
||||
|
||||
ssgBranch* br = (ssgBranch*) l;
|
||||
|
||||
for (int i = 0 ; i < br -> getNumKids () ; i++ ) {
|
||||
for (int i = 0 ; i < br -> getNumKids () ; i++ )
|
||||
{
|
||||
ssgEntity* ln = br->getKid (i);
|
||||
grPropagateDamage(ln, poc, force, cnt+1);
|
||||
}
|
||||
}
|
||||
|
||||
if (l->isAKindOf (ssgTypeVtxTable())) {
|
||||
if (l->isAKindOf (ssgTypeVtxTable()))
|
||||
{
|
||||
sgVec3* v;
|
||||
int Nv;
|
||||
ssgVtxTable* vt = (ssgVtxTable*) l;
|
||||
|
@ -500,9 +783,11 @@ grPropagateDamage (ssgEntity* l, sgVec3 poc, sgVec3 force, int cnt)
|
|||
void
|
||||
grPropagateDamage (tSituation *s)
|
||||
{
|
||||
for (int i = 0; i < s->_ncars; i++) {
|
||||
for (int i = 0; i < s->_ncars; i++)
|
||||
{
|
||||
tCarElt* car = s->cars[i];
|
||||
if (car->priv.collision_state.collision_count > 0) {
|
||||
if (car->priv.collision_state.collision_count > 0)
|
||||
{
|
||||
tCollisionState* collision_state = &car->priv.collision_state;
|
||||
grPropagateDamage(grCarInfo[car->index].carEntity,
|
||||
collision_state->pos, collision_state->force, 0);
|
||||
|
@ -510,7 +795,6 @@ grPropagateDamage (tSituation *s)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
grPreInitCar(tCarElt *car)
|
||||
{
|
||||
|
@ -546,7 +830,8 @@ grInitCar(tCarElt *car)
|
|||
|
||||
TRACE_GL("loadcar: start");
|
||||
|
||||
if (!CarsAnchorTmp) {
|
||||
if (!CarsAnchorTmp)
|
||||
{
|
||||
CarsAnchorTmp = new ssgBranch();
|
||||
}
|
||||
|
||||
|
@ -806,28 +1091,34 @@ grInitCar(tCarElt *car)
|
|||
/* Set a selector on the driver */
|
||||
ssgBranch *b = (ssgBranch *)carEntity->getByName((char*)"DRIVER");
|
||||
grCarInfo[index].driverSelector = new ssgSelector;
|
||||
if (b) {
|
||||
if (b)
|
||||
{
|
||||
ssgBranch *bp = b->getParent(0);
|
||||
bp->addKid(grCarInfo[index].driverSelector);
|
||||
grCarInfo[index].driverSelector->addKid(b);
|
||||
bp->removeKid(b);
|
||||
grCarInfo[index].driverSelector->select(1);
|
||||
grCarInfo[index].driverSelectorinsg = true;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
grCarInfo[index].driverSelectorinsg = false;
|
||||
}
|
||||
|
||||
/* Set a selector on the rearwing */
|
||||
ssgBranch *rw = (ssgBranch *)carEntity->getByName((char*)"REARWING");
|
||||
grCarInfo[index].rearwingSelector = new ssgSelector;
|
||||
if (rw) {
|
||||
if (rw)
|
||||
{
|
||||
ssgBranch *bp = b->getParent(0);
|
||||
bp->addKid(grCarInfo[index].rearwingSelector);
|
||||
grCarInfo[index].rearwingSelector->addKid(b);
|
||||
bp->removeKid(b);
|
||||
grCarInfo[index].rearwingSelector->select(1);
|
||||
grCarInfo[index].rearwingSelectorinsg = true;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
grCarInfo[index].rearwingSelectorinsg = false;
|
||||
}
|
||||
|
||||
|
@ -862,36 +1153,63 @@ grInitCar(tCarElt *car)
|
|||
/*if (grCarInfo[grCarIndex].wheelTexture->getRef() > 0)
|
||||
grCarInfo[grCarIndex].wheelTexture->deRef();*/
|
||||
grCarInfo[index].wheelTexture = 0;
|
||||
const char *wheelFront3DModFileNamePrfx =
|
||||
GfParmGetStr(handle, SECT_GROBJECTS, PRM_FRONT_WHEEL_3D, "");
|
||||
const char *wheelRear3DModFileNamePrfx =
|
||||
GfParmGetStr(handle, SECT_GROBJECTS, PRM_REAR_WHEEL_3D, "");
|
||||
const char *wheel3DModFileNamePrfx =
|
||||
GfParmGetStr(handle, SECT_GROBJECTS, PRM_WHEEL_3D, "wheel");
|
||||
const char *wheelSoft3DModNamePrfx = GfParmGetStr(handle, SECT_GROBJECTS, PRM_WHEELSOFT_3D, "");
|
||||
const char *wheelMedium3DModNamePrfx = GfParmGetStr(handle, SECT_GROBJECTS, PRM_WHEELMEDIUM_3D, "");
|
||||
const char *wheelHard3DModNamePrfx = GfParmGetStr(handle, SECT_GROBJECTS, PRM_WHEELHARD_3D, "");
|
||||
const char *wheelWet3DModNamePrfx = GfParmGetStr(handle, SECT_GROBJECTS, PRM_WHEELWET_3D, "");
|
||||
const char *wheelExtremWet3DModNamePrfx = GfParmGetStr(handle, SECT_GROBJECTS, PRM_WHEELEXTWET_3D, "");
|
||||
const char *wheelFront3DModFileNamePrfx = GfParmGetStr(handle, SECT_GROBJECTS, PRM_FRONT_WHEEL_3D, "");
|
||||
const char *wheelRear3DModFileNamePrfx = GfParmGetStr(handle, SECT_GROBJECTS, PRM_REAR_WHEEL_3D, "");
|
||||
const char *wheel3DModFileNamePrfx = GfParmGetStr(handle, SECT_GROBJECTS, PRM_WHEEL_3D, "wheel");
|
||||
|
||||
grGammaValue = 1.8;
|
||||
grMipMap = 0;
|
||||
grCompounds = false;
|
||||
|
||||
if (*wheelFront3DModFileNamePrfx)
|
||||
if (*wheelSoft3DModNamePrfx)
|
||||
{
|
||||
wheel[FRNT_RGT] = initWheel(car, FRNT_RGT, wheelFront3DModFileNamePrfx);
|
||||
wheel[FRNT_LFT] = initWheel(car, FRNT_LFT, wheelFront3DModFileNamePrfx);
|
||||
}
|
||||
else
|
||||
{
|
||||
wheel[FRNT_RGT] = initWheel(car, FRNT_RGT, wheel3DModFileNamePrfx);
|
||||
wheel[FRNT_LFT] = initWheel(car, FRNT_LFT, wheel3DModFileNamePrfx);
|
||||
grCompounds = true;
|
||||
wheel[FRNT_RGT] = initWheel(car, FRNT_RGT, true, wheelSoft3DModNamePrfx, wheelMedium3DModNamePrfx,
|
||||
wheelHard3DModNamePrfx , wheelWet3DModNamePrfx, wheelExtremWet3DModNamePrfx);
|
||||
wheel[FRNT_LFT] = initWheel(car, FRNT_LFT, true, wheelSoft3DModNamePrfx, wheelMedium3DModNamePrfx,
|
||||
wheelHard3DModNamePrfx , wheelWet3DModNamePrfx, wheelExtremWet3DModNamePrfx);
|
||||
|
||||
wheel[REAR_RGT] = initWheel(car, REAR_RGT, true, wheelSoft3DModNamePrfx, wheelMedium3DModNamePrfx,
|
||||
wheelHard3DModNamePrfx , wheelWet3DModNamePrfx, wheelExtremWet3DModNamePrfx);
|
||||
wheel[REAR_LFT] = initWheel(car, REAR_LFT, true, wheelSoft3DModNamePrfx, wheelMedium3DModNamePrfx,
|
||||
wheelHard3DModNamePrfx , wheelWet3DModNamePrfx, wheelExtremWet3DModNamePrfx);
|
||||
|
||||
GfLogInfo("Loading compound %s\n", wheelSoft3DModNamePrfx);
|
||||
GfLogInfo("Loading compound %s\n", wheelMedium3DModNamePrfx);
|
||||
GfLogInfo("Loading compound %s\n", wheelHard3DModNamePrfx);
|
||||
GfLogInfo("Loading compound %s\n", wheelWet3DModNamePrfx);
|
||||
GfLogInfo("Loading compound %s\n", wheelExtremWet3DModNamePrfx);
|
||||
}
|
||||
|
||||
if (*wheelRear3DModFileNamePrfx)
|
||||
if (*wheelFront3DModFileNamePrfx && !grCompounds)
|
||||
{
|
||||
wheel[REAR_RGT] = initWheel(car, REAR_RGT, wheelRear3DModFileNamePrfx);
|
||||
wheel[REAR_LFT] = initWheel(car, REAR_LFT, wheelRear3DModFileNamePrfx);
|
||||
GfLogInfo("Loading Front 3d mod : %s\n", wheelFront3DModFileNamePrfx);
|
||||
wheel[FRNT_RGT] = initWheel(car, FRNT_RGT, false, wheelFront3DModFileNamePrfx, NULL, NULL , NULL, NULL);
|
||||
wheel[FRNT_LFT] = initWheel(car, FRNT_LFT, false, wheelFront3DModFileNamePrfx, NULL, NULL , NULL, NULL);
|
||||
}
|
||||
else
|
||||
else if(*wheel3DModFileNamePrfx && !grCompounds)
|
||||
{
|
||||
wheel[REAR_RGT] = initWheel(car, REAR_RGT, wheel3DModFileNamePrfx);
|
||||
wheel[REAR_LFT] = initWheel(car, REAR_LFT, wheel3DModFileNamePrfx);
|
||||
GfLogInfo("Loading Front mod : %s\n", wheel3DModFileNamePrfx);
|
||||
wheel[FRNT_RGT] = initWheel(car, FRNT_RGT, false, wheel3DModFileNamePrfx, NULL, NULL , NULL, NULL);
|
||||
wheel[FRNT_LFT] = initWheel(car, FRNT_LFT, false, wheel3DModFileNamePrfx, NULL, NULL , NULL, NULL);
|
||||
}
|
||||
|
||||
if (*wheelRear3DModFileNamePrfx && !grCompounds)
|
||||
{
|
||||
GfLogInfo("Loading Rear 3d mod : %s\n", wheelRear3DModFileNamePrfx);
|
||||
wheel[REAR_RGT] = initWheel(car, REAR_RGT, false, wheelRear3DModFileNamePrfx, NULL, NULL , NULL, NULL);
|
||||
wheel[REAR_LFT] = initWheel(car, REAR_LFT, false, wheelRear3DModFileNamePrfx, NULL, NULL , NULL, NULL);
|
||||
}
|
||||
else if(*wheel3DModFileNamePrfx && !grCompounds )
|
||||
{
|
||||
GfLogInfo("Loading Rear 3d mod : %s\n", wheel3DModFileNamePrfx);
|
||||
wheel[REAR_RGT] = initWheel(car, REAR_RGT, false, wheel3DModFileNamePrfx, NULL, NULL , NULL, NULL);
|
||||
wheel[REAR_LFT] = initWheel(car, REAR_LFT, false, wheel3DModFileNamePrfx, NULL, NULL , NULL, NULL);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
|
@ -913,9 +1231,12 @@ grInitCar(tCarElt *car)
|
|||
carEntity = grssgCarLoadAC3D(param, NULL, index);;
|
||||
DBG_SET_NAME(carEntity, "LOD", index, i-1);
|
||||
carBody->addKid(carEntity);
|
||||
if (!strcmp(GfParmGetStr(handle, buf, PRM_WHEELSON, "no"), "yes")) {
|
||||
|
||||
if (!strcmp(GfParmGetStr(handle, buf, PRM_WHEELSON, "no"), "yes"))
|
||||
{
|
||||
/* add wheels */
|
||||
for (j = 0; j < 4; j++){
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
carBody->addKid(wheel[j]);
|
||||
}
|
||||
}
|
||||
|
@ -983,6 +1304,9 @@ grInitCar(tCarElt *car)
|
|||
steerLoc->addKid( grCarInfo[index].steerRot[1] );
|
||||
steerBranch->addKid( steerLoc );
|
||||
grCarInfo[index].steerSelector->addKid( steerBranch );
|
||||
|
||||
snprintf(path, 256, "%s/%s", SECT_GROBJECTS, LST_RPM_LED);
|
||||
nranges = GfParmGetEltNb(handle, path) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1122,16 +1446,19 @@ grInitCar(tCarElt *car)
|
|||
|
||||
static void
|
||||
grDrawShadow(tCarElt *car, int visible)
|
||||
{
|
||||
{
|
||||
int i;
|
||||
ssgVtxTableShadow *shadow;
|
||||
sgVec3 *vtx;
|
||||
|
||||
if (grCarInfo[car->index].shadowAnchor->getNumKids() != 0) {
|
||||
if (grCarInfo[car->index].shadowAnchor->getNumKids() != 0)
|
||||
{
|
||||
grCarInfo[car->index].shadowAnchor->removeKid(grCarInfo[car->index].shadowCurr);
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
if (visible)
|
||||
{
|
||||
shadow = (ssgVtxTableShadow *)grCarInfo[car->index].shadowBase->clone(SSG_CLONE_GEOMETRY);
|
||||
/* shadow->setState(shadowState); */
|
||||
shadow->setCullFace(TRUE);
|
||||
|
@ -1139,7 +1466,8 @@ grDrawShadow(tCarElt *car, int visible)
|
|||
|
||||
shadow->transform(grCarInfo[car->index].carPos);
|
||||
|
||||
for (i = 0; i < GR_SHADOW_POINTS; i++) {
|
||||
for (i = 0; i < GR_SHADOW_POINTS; i++)
|
||||
{
|
||||
vtx[i][2] = RtTrackHeightG(car->_trkPos.seg, vtx[i][0], vtx[i][1]) + 0.00;
|
||||
}
|
||||
|
||||
|
@ -1147,7 +1475,7 @@ grDrawShadow(tCarElt *car, int visible)
|
|||
grCarInfo[car->index].shadowAnchor->addKid(shadow);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tdble grGetDistToStart(tCarElt *car)
|
||||
{
|
||||
|
@ -1316,9 +1644,12 @@ grDrawCar(tSituation *s, tCarElt *car, tCarElt *curCar, int dispCarFlag, int dis
|
|||
|
||||
grCarInfo[index].carTransform->setTransform(grCarInfo[index].carPos);
|
||||
|
||||
if ((car == curCar) && (dispCarFlag != 1)) {
|
||||
if ((car == curCar) && (dispCarFlag != 1))
|
||||
{
|
||||
grDrawShadow(car, 0);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
grDrawShadow(car, 1);
|
||||
}
|
||||
|
||||
|
@ -1326,9 +1657,12 @@ grDrawCar(tSituation *s, tCarElt *car, tCarElt *curCar, int dispCarFlag, int dis
|
|||
grDrawSkidmarks(car);
|
||||
grAddSmoke(car, curTime);
|
||||
|
||||
if ((car == curCar) && (dispCarFlag != 1)) {
|
||||
if ((car == curCar) && (dispCarFlag != 1))
|
||||
{
|
||||
grUpdateCarlight(car, curCam, 0);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
grUpdateCarlight(car, curCam, 1);
|
||||
}
|
||||
|
||||
|
@ -1336,7 +1670,8 @@ grDrawCar(tSituation *s, tCarElt *car, tCarElt *curCar, int dispCarFlag, int dis
|
|||
grCarInfo[index].envSelector->selectStep(car->_trkPos.seg->envIndex);
|
||||
|
||||
/* wheels */
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
float *clr;
|
||||
|
||||
sgSetCoord(&wheelpos, car->priv.wheel[i].relPos.x, car->priv.wheel[i].relPos.y, car->priv.wheel[i].relPos.z,
|
||||
|
@ -1344,11 +1679,27 @@ grDrawCar(tSituation *s, tCarElt *car, tCarElt *curCar, int dispCarFlag, int dis
|
|||
grCarInfo[index].wheelPos[i]->setTransform(&wheelpos);
|
||||
sgSetCoord(&wheelpos, 0, 0, 0, 0, 0, RAD2DEG(car->priv.wheel[i].relPos.ay));
|
||||
grCarInfo[index].wheelRot[i]->setTransform(&wheelpos);
|
||||
for (j = 0; j < 3; j++) {
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
if (fabs(car->_wheelSpinVel(i)) < maxVel[j])
|
||||
break;
|
||||
}
|
||||
|
||||
int compoundSelector = (car->priv.wheel[i].compound - 1);
|
||||
int selectchild = compoundSelector * 4;
|
||||
int v = j + selectchild;
|
||||
|
||||
if (grCompounds)
|
||||
{
|
||||
grCarInfo[index].wheelselector[i]->select(1<<v);
|
||||
GfLogDebug("Drawing Compounds = %i\n", v);
|
||||
}
|
||||
else
|
||||
grCarInfo[index].wheelselector[i]->select(1<<j);
|
||||
|
||||
GfLogDebug("Draw tyre = %i - compound = %i\n", j, compoundSelector);
|
||||
|
||||
clr = grCarInfo[index].brkColor[i]->get(0);
|
||||
clr[0] = 0.1 + car->_brakeTemp(i) * 1.5;
|
||||
clr[1] = 0.1 + car->_brakeTemp(i) * 0.3;
|
||||
|
@ -1364,3 +1715,6 @@ grDrawCar(tSituation *s, tCarElt *car, tCarElt *curCar, int dispCarFlag, int dis
|
|||
TRACE_GL("cggrDrawCar: end");
|
||||
}
|
||||
|
||||
void grDrawCarShadow(void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ public:
|
|||
float needleColor[4];
|
||||
};
|
||||
|
||||
|
||||
class tgrCarInfo
|
||||
{
|
||||
public:
|
||||
|
@ -74,8 +73,14 @@ public:
|
|||
ssgSelector *driverSelector;
|
||||
ssgSelector *steerSelector;
|
||||
ssgSelector *rearwingSelector;
|
||||
ssgSelector *rpmlightsSelector;
|
||||
ssgSelector *gearSelector;
|
||||
bool driverSelectorinsg;
|
||||
bool rearwingSelectorinsg;
|
||||
bool rpmlightsSelectorinsg;
|
||||
bool gearSelectorinsg;
|
||||
bool cockpitSelectorinsg;
|
||||
bool separatemodelSelectorinsg;
|
||||
ssgStateSelector *envSelector;
|
||||
ssgTransform *wheelPos[4];
|
||||
ssgTransform *wheelRot[4];
|
||||
|
@ -113,4 +118,6 @@ extern void grDrawCar(tSituation *, tCarElt*, tCarElt *, int, int, double curTim
|
|||
extern void grInitCommonState(void);
|
||||
//extern void grPropagateDamage (ssgEntity* l, sgVec3 poc, sgVec3 force, int cnt);
|
||||
extern void grPropagateDamage (tSituation *);
|
||||
extern void grDrawCarShadow(void);
|
||||
extern bool grShadowStatic;
|
||||
#endif /* _GRCAR_H_ */
|
||||
|
|
Loading…
Reference in a new issue