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

View file

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