diff --git a/src/modules/graphic/osggraph/OsgDome.cpp b/src/modules/graphic/osggraph/OsgDome.cpp index df5f4db70..b9efa41fe 100644 --- a/src/modules/graphic/osggraph/OsgDome.cpp +++ b/src/modules/graphic/osggraph/OsgDome.cpp @@ -204,8 +204,8 @@ bool SDSkyDome::repaint( const Vec3f& sky_color, osg::Vec3f middle_param, middle_diff; // Check for sunrise/sunset condition - sun_angle = osg::RadiansToDegrees(sun_angle); - if (sun_angle > 80) + //sun_angle = osg::RadiansToDegrees(sun_angle); + if (sun_angle > 80.0) { // 0.0 - 0.4 double sunAngleFactor = 10.0 - fabs(90.0 - sun_angle); diff --git a/src/modules/graphic/osggraph/OsgMain.cpp b/src/modules/graphic/osggraph/OsgMain.cpp index 5e9057b22..a4bcc189d 100644 --- a/src/modules/graphic/osggraph/OsgMain.cpp +++ b/src/modules/graphic/osggraph/OsgMain.cpp @@ -349,7 +349,7 @@ int initTrack(tTrack *track) scenery = new SDScenery; render = new SDRender; - osg::Group *sceneroot = new osg::Group(); + osg::ref_ptr sceneroot = new osg::Group(); m_sceneroot = new osg::Group(); sceneroot->addChild(scenery->LoadScene(track)); @@ -384,11 +384,12 @@ int initCars(tSituation *s) void shutdownTrack(void) { - m_sceneroot->removeChildren(0,m_sceneroot->getNumChildren()); - // Do the real track termination job. - osgDB::Registry::instance()->clearObjectCache(); - delete scenery; - //grShutdownScene(); + delete scenery; + m_sceneroot->removeChildren(0,m_sceneroot->getNumChildren()); + // Do the real track termination job. + osgDB::Registry::instance()->clearObjectCache(); + + //grShutdownScene(); if (grTrackHandle) { diff --git a/src/modules/graphic/osggraph/OsgScenery.h b/src/modules/graphic/osggraph/OsgScenery.h index a7035e5e5..f30f5be4f 100644 --- a/src/modules/graphic/osggraph/OsgScenery.h +++ b/src/modules/graphic/osggraph/OsgScenery.h @@ -38,20 +38,21 @@ class SDScenery; class SDBackground { osg::ref_ptr _background; + osg::ref_ptr _scenery; osg::ref_ptr _background_transform; - + bool _type; - + public: - - // Constructor + + // Constructor SDBackground(void); - + // Destructor ~SDBackground(void); - + 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 @@ -59,7 +60,7 @@ public: private: osg::ref_prt _spectators; - + int _number; public: @@ -74,7 +75,7 @@ class SDTrees private: osg::ref_ptr _trees; - + public: void SDTrees(void); @@ -95,27 +96,27 @@ private: //SDTrees *m_trees; osg::ref_ptr _scenery; osg::ref_ptr _background; - + int _grWrldX; int _grWrldY; int _grWrldZ; int _grWrldMaxSize; int _max_visibility; - int _nb_cloudlayer; - int _DynamicSkyDome; - int _SkyDomeDistance; - int _SkyDomeDistThresh; - + int _nb_cloudlayer; + int _DynamicSkyDome; + int _SkyDomeDistance; + int _SkyDomeDistThresh; + bool _bgtype; bool _bgsky; //_spectators = 0; //_trees = 0; //_pits = 0; - std::string _strTexturePath; - + std::string _strTexturePath; + + - void LoadGraphicsOptions(); void LoadSkyOptions(); void CustomizePits(void); @@ -123,26 +124,26 @@ private: public: - + /* Constructor */ SDScenery(void); - + /* Destructor */ ~SDScenery(void); - + osg::Node *LoadScene(tTrack *track); void CreatePit(tTrack *track); //void addSpectators(SDSpectators->build(number, tTrack *track)); //void addTrees(SDTrees->build(tTrack *track)); void ShutdownScene(void); - //void + //void inline static int getWorldX(){return grWrldX;} inline static int getWorldY(){return grWrldY;} inline static int getWorldZ(){return grWrldZ;} inline static int getWorldMaxSize(){return grWrldMaxSize;} - - //osg::Node* getPreRoot() { return pre_root.get(); } + + //osg::Node* getPreRoot() { return pre_root.get(); } //osg::ref_ptr getSDScenery { return _scenery }; //osg::Group getSDBackground { return SDBackground->getbackground; }