update OsgDome

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

Former-commit-id: 5ffd3d53be36cb26f006ad75a8aa30acba79d7e8
Former-commit-id: 245f2e3d38a3b24d749ce3f6491defdae27861e7
This commit is contained in:
torcs-ng 2013-03-18 19:28:24 +00:00
parent e54d751494
commit 279391a7b7
3 changed files with 34 additions and 32 deletions

View file

@ -204,8 +204,8 @@ bool SDSkyDome::repaint( const Vec3f& sky_color,
osg::Vec3f middle_param, middle_diff; osg::Vec3f middle_param, middle_diff;
// Check for sunrise/sunset condition // Check for sunrise/sunset condition
sun_angle = osg::RadiansToDegrees(sun_angle); //sun_angle = osg::RadiansToDegrees(sun_angle);
if (sun_angle > 80) if (sun_angle > 80.0)
{ {
// 0.0 - 0.4 // 0.0 - 0.4
double sunAngleFactor = 10.0 - fabs(90.0 - sun_angle); double sunAngleFactor = 10.0 - fabs(90.0 - sun_angle);

View file

@ -349,7 +349,7 @@ int initTrack(tTrack *track)
scenery = new SDScenery; scenery = new SDScenery;
render = new SDRender; render = new SDRender;
osg::Group *sceneroot = new osg::Group(); osg::ref_ptr<osg::Group> sceneroot = new osg::Group();
m_sceneroot = new osg::Group(); m_sceneroot = new osg::Group();
sceneroot->addChild(scenery->LoadScene(track)); sceneroot->addChild(scenery->LoadScene(track));
@ -384,11 +384,12 @@ int initCars(tSituation *s)
void shutdownTrack(void) void shutdownTrack(void)
{ {
m_sceneroot->removeChildren(0,m_sceneroot->getNumChildren()); delete scenery;
// Do the real track termination job. m_sceneroot->removeChildren(0,m_sceneroot->getNumChildren());
osgDB::Registry::instance()->clearObjectCache(); // Do the real track termination job.
delete scenery; osgDB::Registry::instance()->clearObjectCache();
//grShutdownScene();
//grShutdownScene();
if (grTrackHandle) if (grTrackHandle)
{ {

View file

@ -38,20 +38,21 @@ class SDScenery;
class SDBackground class SDBackground
{ {
osg::ref_ptr<osg::Group> _background; osg::ref_ptr<osg::Group> _background;
osg::ref_ptr<osg::Group> _scenery;
osg::ref_ptr<osg::MatrixTransform> _background_transform; osg::ref_ptr<osg::MatrixTransform> _background_transform;
bool _type; bool _type;
public: public:
// Constructor // Constructor
SDBackground(void); SDBackground(void);
// Destructor // Destructor
~SDBackground(void); ~SDBackground(void);
osg::Node *build(bool type, int X, int Y, int Z, const std::string strTrack); osg::Node *build(bool type, int X, int Y, int Z, const std::string strTrack);
void reposition(int X, int Y); void reposition(int X, int Y);
}; };
/*class SDSpectators /*class SDSpectators
@ -59,7 +60,7 @@ public:
private: private:
osg::ref_prt<osg::Node> _spectators; osg::ref_prt<osg::Node> _spectators;
int _number; int _number;
public: public:
@ -74,7 +75,7 @@ class SDTrees
private: private:
osg::ref_ptr<osg::Node> _trees; osg::ref_ptr<osg::Node> _trees;
public: public:
void SDTrees(void); void SDTrees(void);
@ -95,27 +96,27 @@ private:
//SDTrees *m_trees; //SDTrees *m_trees;
osg::ref_ptr<osg::Group> _scenery; osg::ref_ptr<osg::Group> _scenery;
osg::ref_ptr<osg::Group> _background; osg::ref_ptr<osg::Group> _background;
int _grWrldX; int _grWrldX;
int _grWrldY; int _grWrldY;
int _grWrldZ; int _grWrldZ;
int _grWrldMaxSize; int _grWrldMaxSize;
int _max_visibility; int _max_visibility;
int _nb_cloudlayer; int _nb_cloudlayer;
int _DynamicSkyDome; int _DynamicSkyDome;
int _SkyDomeDistance; int _SkyDomeDistance;
int _SkyDomeDistThresh; int _SkyDomeDistThresh;
bool _bgtype; bool _bgtype;
bool _bgsky; bool _bgsky;
//_spectators = 0; //_spectators = 0;
//_trees = 0; //_trees = 0;
//_pits = 0; //_pits = 0;
std::string _strTexturePath; std::string _strTexturePath;
void LoadGraphicsOptions(); void LoadGraphicsOptions();
void LoadSkyOptions(); void LoadSkyOptions();
void CustomizePits(void); void CustomizePits(void);
@ -123,26 +124,26 @@ private:
public: public:
/* Constructor */ /* Constructor */
SDScenery(void); SDScenery(void);
/* Destructor */ /* Destructor */
~SDScenery(void); ~SDScenery(void);
osg::Node *LoadScene(tTrack *track); osg::Node *LoadScene(tTrack *track);
void CreatePit(tTrack *track); void CreatePit(tTrack *track);
//void addSpectators(SDSpectators->build(number, tTrack *track)); //void addSpectators(SDSpectators->build(number, tTrack *track));
//void addTrees(SDTrees->build(tTrack *track)); //void addTrees(SDTrees->build(tTrack *track));
void ShutdownScene(void); void ShutdownScene(void);
//void //void
inline static int getWorldX(){return grWrldX;} inline static int getWorldX(){return grWrldX;}
inline static int getWorldY(){return grWrldY;} inline static int getWorldY(){return grWrldY;}
inline static int getWorldZ(){return grWrldZ;} inline static int getWorldZ(){return grWrldZ;}
inline static int getWorldMaxSize(){return grWrldMaxSize;} inline static int getWorldMaxSize(){return grWrldMaxSize;}
//osg::Node* getPreRoot() { return pre_root.get(); } //osg::Node* getPreRoot() { return pre_root.get(); }
//osg::ref_ptr<osg::Group> getSDScenery { return _scenery }; //osg::ref_ptr<osg::Group> getSDScenery { return _scenery };
//osg::Group getSDBackground { return SDBackground->getbackground; } //osg::Group getSDBackground { return SDBackground->getbackground; }