- Update graphic code for real fog (not use cloud now)
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4732 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 89954c37ab5b6c9556eb7be8a830ef03f21fa14e Former-commit-id: 517927e943617891acc5b5b61d7200a2acce16f0
This commit is contained in:
parent
d2541d9aa4
commit
547a172b15
2 changed files with 25 additions and 9 deletions
|
@ -77,6 +77,7 @@ typedef struct {
|
|||
char carName[MAX_NAME_LEN]; /**< Car object name */
|
||||
char category[MAX_NAME_LEN]; /**< Car's category */
|
||||
int raceNumber; /**< Car's race number */
|
||||
int price; /**<Car's Price */
|
||||
int startRank; /**< Car's starting position */
|
||||
int driverType; /**< Driver type */
|
||||
int networkplayer; /**< Network player */
|
||||
|
@ -118,6 +119,7 @@ typedef struct {
|
|||
#define _networkPlayer info.networkplayer /**< short cut to tInitCar#networkplayer*/
|
||||
#define _skillLevel info.skillLevel /**< short cut to tInitCar#skillLevel */
|
||||
#define _raceNumber info.raceNumber /**< short cut to tInitCar#raceNumber */
|
||||
#define _Price info.price
|
||||
#define _startRank info.startRank /**< short cut to tInitCar#startRank */
|
||||
#define _dimension info.dimension /**< short cut to tInitCar#dimension */
|
||||
#define _dimension_x info.dimension.x /**< short cut to tInitCar#dimension.x */
|
||||
|
@ -510,7 +512,8 @@ typedef struct CarElt
|
|||
#define SECT_LIGHT "Light"
|
||||
|
||||
/* Parameter names */
|
||||
#define PRM_CATEGORY "category"
|
||||
#define PRM_CATEGORY "category"
|
||||
#define PRM_PRICE "price"
|
||||
#define PRM_LEN "body length"
|
||||
#define PRM_WIDTH "body width"
|
||||
#define PRM_OVERALLLEN "overall length"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/***************************************************************************
|
||||
/***************************************************************************
|
||||
|
||||
file : grbackground.cpp
|
||||
created : Thu Nov 25 21:09:40 CEST 2010
|
||||
|
@ -37,6 +37,9 @@
|
|||
// Some exported constants.
|
||||
const tdble grSkyDomeNeutralFOVDistance = 20000.0f; // Not the smallest, a medium one.
|
||||
|
||||
static const double m_log01 = -log( 0.01 );
|
||||
static const double sqrt_m_log01 = sqrt( m_log01 );
|
||||
|
||||
// Some private constants.
|
||||
static const int NbBackgroundFaces = 36; //Background faces
|
||||
static const float BackgroundDistance = 1.0f;
|
||||
|
@ -340,25 +343,33 @@ grInitBackground()
|
|||
switch (grTrack->local.rain)
|
||||
{
|
||||
case TR_RAIN_NONE:
|
||||
visibility = 0.0f;
|
||||
//visibility = 0.0f;
|
||||
visibility = 2500.0;
|
||||
break;
|
||||
case TR_RAIN_LITTLE:
|
||||
visibility = 400.0f;
|
||||
//visibility = 400.0f;
|
||||
visibility = 800.0f;
|
||||
break;
|
||||
case TR_RAIN_MEDIUM:
|
||||
visibility = 500.0f;
|
||||
//visibility = 500.0f;
|
||||
visibility = 600.0f;
|
||||
break;
|
||||
case TR_RAIN_HEAVY:
|
||||
visibility = 550.0f;
|
||||
//visibility = 550.0f;
|
||||
visibility = 400.0f;
|
||||
break;
|
||||
default:
|
||||
GfLogWarning("Unsupported rain strength value %d (assuming none)",
|
||||
grTrack->local.rain);
|
||||
visibility = 0.0f;
|
||||
visibility = 10000.0f;
|
||||
break;
|
||||
}//switch Rain
|
||||
|
||||
TheSky->modifyVisibility( visibility, 0);
|
||||
//TheSky->modifyVisibility( visibility, 0);
|
||||
TheSky->setVisibility( visibility ); // Visibility in meters
|
||||
|
||||
const GLfloat fog_exp_density = m_log01 / visibility;
|
||||
const GLfloat fog_exp2_density = sqrt_m_log01 / visibility;
|
||||
|
||||
//Setup overall light level according to rain if any
|
||||
const float sol_angle = (float)TheCelestBodies[eCBSun]->getAngle();
|
||||
|
@ -883,7 +894,9 @@ grPreDrawSky(tSituation* s, float fogStart, float fogEnd)
|
|||
|
||||
if (grSkyDomeDistance && grTrack->skyversion > 0)
|
||||
{
|
||||
const GLfloat fog_exp2_density = (float)sqrt_m_log01 / TheSky->getVisibility();
|
||||
//const GLfloat fog_exp2_density = (float)sqrt_m_log01 / TheSky->getVisibility();
|
||||
const GLfloat fog_exp_density = m_log01 / TheSky->getVisibility();
|
||||
const GLfloat fog_exp2_density = sqrt_m_log01 / TheSky->getVisibility();
|
||||
glEnable(GL_FOG);
|
||||
//glFogf(GL_FOG_START, fogStart);
|
||||
//glFogf(GL_FOG_END, fogEnd);
|
||||
|
|
Loading…
Reference in a new issue