From 081cf829b9c8d8a3a374c5582ad61db0e856e33f Mon Sep 17 00:00:00 2001 From: torcs-ng Date: Thu, 23 Apr 2015 23:16:02 +0000 Subject: [PATCH] - Update osggraph git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5989 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: e2dadf022de2447ea225127d61858a44ae3834f3 Former-commit-id: 11dfe3c60b8c909da77211b04e07a405cc3a92f0 --- .../osggraph/Render/OsgReflectionMapping.cpp | 36 ++++++++++--------- .../graphic/osggraph/Render/OsgRender.cpp | 21 +++++++---- .../graphic/osggraph/Scenery/OsgPit.cpp | 4 +-- .../graphic/osggraph/Scenery/OsgScenery.cpp | 17 +++++---- .../graphic/osggraph/Scenery/OsgScenery.h | 16 ++++----- .../osggraph/Scenery/OsgTrackLight.cpp | 4 +-- .../graphic/osggraph/Viewer/OsgScreens.cpp | 8 +++-- 7 files changed, 60 insertions(+), 46 deletions(-) diff --git a/src/modules/graphic/osggraph/Render/OsgReflectionMapping.cpp b/src/modules/graphic/osggraph/Render/OsgReflectionMapping.cpp index ce46f0b96..2cd475d38 100644 --- a/src/modules/graphic/osggraph/Render/OsgReflectionMapping.cpp +++ b/src/modules/graphic/osggraph/Render/OsgReflectionMapping.cpp @@ -68,7 +68,10 @@ public: CameraPreCallback *pre_cam = new CameraPreCallback; CameraPostCallback *post_cam = new CameraPostCallback; -SDReflectionMapping::SDReflectionMapping(SDCar *c):car(c) +SDReflectionMapping::SDReflectionMapping(SDCar *c): + camerasRoot(NULL), + reflectionMap(NULL), + car(c) { SDRender *render = (SDRender *)getRender(); unsigned reflectionShader = render->getShader(); @@ -88,25 +91,24 @@ SDReflectionMapping::SDReflectionMapping(SDCar *c):car(c) imagePosZ->setInternalTextureFormat(GL_RGB); imageNegZ->setInternalTextureFormat(GL_RGB); - osg::ref_ptr reflectionMap; + osg::ref_ptr reflectionmap = new osg::TextureCubeMap; - reflectionMap = new osg::TextureCubeMap; - this->reflectionMap = reflectionMap; + this->reflectionMap = reflectionmap; - reflectionMap->setImage(osg::TextureCubeMap::POSITIVE_X, imagePosX); - reflectionMap->setImage(osg::TextureCubeMap::NEGATIVE_X, imageNegX); - reflectionMap->setImage(osg::TextureCubeMap::POSITIVE_Y, imagePosY); - reflectionMap->setImage(osg::TextureCubeMap::NEGATIVE_Y, imageNegY); - reflectionMap->setImage(osg::TextureCubeMap::POSITIVE_Z, imagePosZ); - reflectionMap->setImage(osg::TextureCubeMap::NEGATIVE_Z, imageNegZ); + reflectionmap->setImage(osg::TextureCubeMap::POSITIVE_X, imagePosX); + reflectionmap->setImage(osg::TextureCubeMap::NEGATIVE_X, imageNegX); + reflectionmap->setImage(osg::TextureCubeMap::POSITIVE_Y, imagePosY); + reflectionmap->setImage(osg::TextureCubeMap::NEGATIVE_Y, imageNegY); + reflectionmap->setImage(osg::TextureCubeMap::POSITIVE_Z, imagePosZ); + reflectionmap->setImage(osg::TextureCubeMap::NEGATIVE_Z, imageNegZ); - reflectionMap->setTextureSize( 256, 256 ); - reflectionMap->setInternalFormat( GL_RGB); - reflectionMap->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); - reflectionMap->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); - reflectionMap->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_EDGE); - reflectionMap->setFilter(osg::TextureCubeMap::MIN_FILTER,osg::TextureCubeMap::LINEAR); - reflectionMap->setFilter(osg::TextureCubeMap::MAG_FILTER,osg::TextureCubeMap::LINEAR); + reflectionmap->setTextureSize( 256, 256 ); + reflectionmap->setInternalFormat( GL_RGB); + reflectionmap->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE); + reflectionmap->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); + reflectionmap->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_EDGE); + reflectionmap->setFilter(osg::TextureCubeMap::MIN_FILTER,osg::TextureCubeMap::LINEAR); + reflectionmap->setFilter(osg::TextureCubeMap::MAG_FILTER,osg::TextureCubeMap::LINEAR); camerasRoot = new osg::Group; diff --git a/src/modules/graphic/osggraph/Render/OsgRender.cpp b/src/modules/graphic/osggraph/Render/OsgRender.cpp index 34c311233..e71ca83e3 100644 --- a/src/modules/graphic/osggraph/Render/OsgRender.cpp +++ b/src/modules/graphic/osggraph/Render/OsgRender.cpp @@ -72,9 +72,21 @@ static const int NbShadersValues = sizeof(ShadersValues) / sizeof(ShadersValues[ static const int CloudsTextureIndices[TR_CLOUDS_FULL+1] = {1, 3, 5, 7, 8}; static const int NCloudsTextureIndices = sizeof(CloudsTextureIndices) / sizeof(int); -SDRender::SDRender(void) - :AStarsData(NULL), - APlanetsData(NULL) +SDRender::SDRender(void) : + m_RealRoot(NULL), + m_scene(NULL), + m_CarRoot(NULL), + skyGroup(NULL), + stateSet(NULL), + skySS(NULL), + lightSource(NULL), + sunLight(NULL), + shadowRoot(NULL), + AStarsData(NULL), + APlanetsData(NULL), + thesky(NULL), + scenery(NULL), + SDTrack(NULL) { BaseSkyColor = osg::Vec3f( 0.31f, 0.43f, 0.69f ); BaseFogColor = osg::Vec3f( 0.84f, 0.84f, 1.0f ); @@ -105,9 +117,6 @@ SDRender::SDRender(void) sol_angle = 0.0; moon_angle = 0.0; sky_brightness = 0.0; - m_scene = NULL; - thesky = NULL; - SDTrack = NULL; } SDRender::~SDRender(void) diff --git a/src/modules/graphic/osggraph/Scenery/OsgPit.cpp b/src/modules/graphic/osggraph/Scenery/OsgPit.cpp index a01b1a7ad..262e7f3b3 100644 --- a/src/modules/graphic/osggraph/Scenery/OsgPit.cpp +++ b/src/modules/graphic/osggraph/Scenery/OsgPit.cpp @@ -24,7 +24,7 @@ #include "OsgScenery.h" -SDPit::SDPit(void) +/*SDPit::SDPit(void) { } @@ -53,4 +53,4 @@ void SDPit::build(const std::string TrackPath) _osgpit = new osg::Group; _osgpit->addChild(_pit_transform.get()); -} +}*/ diff --git a/src/modules/graphic/osggraph/Scenery/OsgScenery.cpp b/src/modules/graphic/osggraph/Scenery/OsgScenery.cpp index c8392c022..30cedf57e 100644 --- a/src/modules/graphic/osggraph/Scenery/OsgScenery.cpp +++ b/src/modules/graphic/osggraph/Scenery/OsgScenery.cpp @@ -33,7 +33,10 @@ #include //RtXXX() #include -SDScenery::SDScenery(void) +SDScenery::SDScenery(void) : + m_background(NULL), + _scenery(NULL), + SDTrack(NULL) { grWrldX = 0; grWrldY = 0; @@ -49,16 +52,12 @@ SDScenery::SDScenery(void) _bgsky = false; _speedWay = false; _speedWayLong = false; - - _scenery = NULL; - - SDTrack = NULL; } SDScenery::~SDScenery(void) { delete m_background; - delete m_pit; + //delete m_pit; delete SDTrack; _scenery = NULL; @@ -75,7 +74,7 @@ void SDScenery::LoadScene(tTrack *track) GfOut("Initialisation class SDScenery\n"); m_background = new SDBackground; - m_pit = new SDPit; + //m_pit = new SDPit; _scenery = new osg::Group; SDTrack = track; @@ -196,8 +195,8 @@ void SDScenery::LoadScene(tTrack *track) osg::ref_ptr pTrack = osgDB::readNodeFile( osgname ); _scenery->addChild(pTrack.get()); - m_pit->build(strPath); - _scenery->addChild(m_pit->getPit()); + //m_pit->build(strPath); + //_scenery->addChild(m_pit->getPit()); } osgDB::Registry::instance()->clearObjectCache(); diff --git a/src/modules/graphic/osggraph/Scenery/OsgScenery.h b/src/modules/graphic/osggraph/Scenery/OsgScenery.h index 864bfe099..aff6a306c 100644 --- a/src/modules/graphic/osggraph/Scenery/OsgScenery.h +++ b/src/modules/graphic/osggraph/Scenery/OsgScenery.h @@ -28,8 +28,8 @@ #include class SDBackground; -class SDPit; -class SDTrackLights; +//class SDPit; +//class SDTrackLights; class SDScenery; class osgLoader; @@ -55,7 +55,7 @@ public: osg::ref_ptr getBackground() { return _background.get(); } }; -class SDPit +/*class SDPit { osg::ref_ptr _osgpit; bool _number; @@ -87,7 +87,7 @@ public: void build(const std::string strTrack); osg::ref_ptr getTrackLight() { return _osgtracklight.get(); } -}; +};*/ static int grWrldX=0; static int grWrldY=0; @@ -98,8 +98,8 @@ class SDScenery { private: SDBackground *m_background; - SDPit *m_pit; - SDTrackLights *m_tracklights; + //SDPit *m_pit; + //SDTrackLights *m_tracklights; osg::ref_ptr _scenery; @@ -142,8 +142,8 @@ public: osg::ref_ptr getScene() { return _scenery.get(); } osg::ref_ptr getBackground() { return m_background->getBackground(); } - osg::ref_ptr getPit() { return m_pit->getPit(); } - osg::ref_ptr getTracklight() { return m_tracklights->getTrackLight(); } + //osg::ref_ptr getPit() { return m_pit->getPit(); } + //osg::ref_ptr getTracklight() { return m_tracklights->getTrackLight(); } }; #endif //_OSGSCENERY_H_ diff --git a/src/modules/graphic/osggraph/Scenery/OsgTrackLight.cpp b/src/modules/graphic/osggraph/Scenery/OsgTrackLight.cpp index 269e8b88a..1cfe89de3 100644 --- a/src/modules/graphic/osggraph/Scenery/OsgTrackLight.cpp +++ b/src/modules/graphic/osggraph/Scenery/OsgTrackLight.cpp @@ -25,7 +25,7 @@ #include "OsgScenery.h" -SDTrackLights::SDTrackLights(void) +/*SDTrackLights::SDTrackLights(void) { } @@ -38,4 +38,4 @@ SDTrackLights::~SDTrackLights(void) void SDTrackLights::build(const std::string TrackPath) { osg::ref_ptr state; -} +}*/ diff --git a/src/modules/graphic/osggraph/Viewer/OsgScreens.cpp b/src/modules/graphic/osggraph/Viewer/OsgScreens.cpp index db7d6cbfc..ca6a1c3c0 100644 --- a/src/modules/graphic/osggraph/Viewer/OsgScreens.cpp +++ b/src/modules/graphic/osggraph/Viewer/OsgScreens.cpp @@ -31,8 +31,12 @@ #include "OsgMain.h" #include "OsgCar.h" -SDScreens::SDScreens() - :m_CurrentScreenIndex(0) +SDScreens::SDScreens() : + root(NULL), + mirrorScene(NULL), + prerenderRoot(NULL), + + m_CurrentScreenIndex(0) { debugHUD = new SDDebugHUD(); //viewer = static_cast (GfScrGetViewer());