Restored lens flare effect when static background (not available yet for the sky dome case)

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

Former-commit-id: b7665e5faf0a3a20484002621a79f47b5d9104ee
Former-commit-id: 188812137355e12dc2784e41788f19bb6e5d499e
This commit is contained in:
pouillot 2011-06-12 18:44:00 +00:00
parent 2128882965
commit cb541dac47
2 changed files with 23 additions and 24 deletions

View file

@ -21,7 +21,9 @@
#include <robottools.h> //RtXXX()
#include <portability.h> // snprintf
#include <glfeatures.h> // snprintf
#include <glfeatures.h>
#include <plib/ssgAux.h>
#include "grscene.h"
#include "grmain.h"
@ -64,8 +66,6 @@ grMultiTexState *grEnvState = NULL;
grMultiTexState *grEnvShadowState = NULL;
grMultiTexState *grEnvShadowStateOnCars = NULL;
ssgBranch *SunAnchor = NULL;
unsigned grSkyDomeDistance = 0;
// Some private global variables.
@ -75,6 +75,8 @@ static int grBackgroundType = 0;
static float grSunDeclination = 0.0f;
static float grMoonDeclination = 0.0f;
static ssgBranch *SunAnchor = NULL;
static ssgRoot *TheBackground = NULL;
static ssgTransform *TheSun = NULL;
@ -156,15 +158,14 @@ grInitBackground(void)
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/*if (!SUN)
if (!TheSun)
{
ssgaLensFlare *sun_obj = NULL ;
sun_obj = new ssgaLensFlare () ;
ssgaLensFlare *sun_obj = new ssgaLensFlare();
TheSun = new ssgTransform;
TheSun-> setTransform( solposn ) ;
TheSun->setTransform(lightPosition);
TheSun->addKid(sun_obj);
SunAnchor->addKid(TheSun);
}*/
}
}
// If realistic sky dome is requested,
@ -669,12 +670,13 @@ grLoadBackground(void)
GfLogError("Unsupported background type %d\n", graphic->bgtype);
break;
}//switch grBackgroundType
} //if (!grSkyDomeDistance || grTrack->skyversion < 1)
// Lens Flares
// Lens Flares when no sky dome (realistic sky dome will use another system when ready).
SunAnchor = new ssgBranch;
TheScene->addKid(SunAnchor);
} //if (!grSkyDomeDistance || grTrack->skyversion < 1)
// Environment Mapping Settings
bool bUseEnvPng = false; // Avoid crash with missing env.rgb files (i.e. Wheel-1)
bool bDoNotUseEnv = false; // Avoid crash with missing env.png
@ -876,29 +878,27 @@ grShutdownBackground(void)
TheSky = 0;
}
if (TheSun) {
delete TheSun;
if (TheSun)
TheSun = 0;
}
if (grEnvState) {
ssgDeRefDelete(grEnvState);
grEnvState = NULL;
grEnvState = 0;
}
if (grEnvShadowState) {
ssgDeRefDelete(grEnvShadowState);
grEnvShadowState = NULL;
grEnvShadowState = 0;
}
if (grEnvShadowStateOnCars) {
ssgDeRefDelete(grEnvShadowStateOnCars);
grEnvShadowStateOnCars = NULL;
grEnvShadowStateOnCars = 0;
}
if(grEnvSelector) {
delete grEnvSelector;
grEnvSelector = NULL;
grEnvSelector = 0;
}
}//grShutdownBackground

View file

@ -37,7 +37,6 @@ extern int grWrldMaxSize;
extern tTrack *grTrack;
extern ssgRoot *TheScene;
extern ssgBranch *SunAnchor;
extern ssgBranch *LandAnchor;
extern ssgBranch *CarsAnchor;
extern ssgBranch *ShadowAnchor;