Revision: 2710 http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2710&view=rev Author: ulteq Date: 2012-05-26 20:12:51 +0000 (Sat, 26 May 2012) Log Message: ----------- fixed /gfx/*
Modified Paths: -------------- trunk/source/main/gfx/DecalManager.cpp trunk/source/main/gfx/DecalManager.h trunk/source/main/gfx/DustManager.cpp trunk/source/main/gfx/DustManager.h trunk/source/main/gfx/DustPool.cpp trunk/source/main/gfx/DustPool.h trunk/source/main/gfx/Heathaze.cpp trunk/source/main/gfx/Heathaze.h trunk/source/main/gfx/ShadowManager.cpp trunk/source/main/gfx/ShadowManager.h trunk/source/main/gfx/Skidmark.cpp trunk/source/main/gfx/SkyManager.cpp trunk/source/main/gfx/SkyManager.h trunk/source/main/gfx/envmap.cpp trunk/source/main/gfx/envmap.h trunk/source/main/gfx/hdrlistener.cpp trunk/source/main/gfx/hdrlistener.h trunk/source/main/terrain/TerrainManager.h Modified: trunk/source/main/gfx/DecalManager.cpp =================================================================== --- trunk/source/main/gfx/DecalManager.cpp 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/DecalManager.cpp 2012-05-26 20:12:51 UTC (rev 2710) @@ -30,10 +30,8 @@ // DecalManager DecalManager::DecalManager() { - terrain_decals_snode = gEnv->ogreSceneManager->getRootSceneNode()->createChildSceneNode(); terrain_decal_count = 0; - } DecalManager::~DecalManager() @@ -314,7 +312,11 @@ } // DecalSpline -DecalSpline::DecalSpline(SceneManager *manager, SceneNode *parent) : gEnv->ogreSceneManager(manager), mo_spline(0), mo_spline_node(0), snparent(parent), spline(0) +DecalSpline::DecalSpline(Ogre::SceneNode* parent) : + mo_spline(0) + , mo_spline_node(0) + , snparent(parent) + , spline(0) { } Modified: trunk/source/main/gfx/DecalManager.h =================================================================== --- trunk/source/main/gfx/DecalManager.h 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/DecalManager.h 2012-05-26 20:12:51 UTC (rev 2710) @@ -20,53 +20,54 @@ //created by Thomas Fischer 22th of January 2011 -#ifndef DECALMANAGER_H__ -#define DECALMANAGER_H__ +#ifndef __DecalManager_H_ +#define __DecalManager_H_ #include "RoRPrerequisites.h" -#include <math.h> -#include <OgrePrerequisites.h> +//#include <math.h> +//#include <OgrePrerequisites.h> - - class DecalSpline { -private: - Ogre::ManualObject *mo_spline; - Ogre::SceneNode *mo_spline_node, *snparent; - Ogre::SimpleSpline *spline; +public: - -public: - DecalSpline(); + DecalSpline(Ogre::SceneNode* parent); ~DecalSpline(); int addPoint(Ogre::Vector3 v); int showDebugLine(bool enabled); + +private: + + Ogre::ManualObject *mo_spline; + Ogre::SceneNode *mo_spline_node, *snparent; + Ogre::SimpleSpline *spline; }; class DecalManager { +public: + + DecalManager(); + ~DecalManager(); + + int parseLine(char *line); + private: + int addTerrainDecal(Ogre::Vector3 position, Ogre::Vector2 size, Ogre::Vector2 numSeg, Ogre::Real rotation, Ogre::String materialname, Ogre::String normalname); int addTerrainSplineDecal(Ogre::SimpleSpline *spline, float width, Ogre::Vector2 numSeg, Ogre::Vector2 uvSeg, Ogre::String materialname, float ground_offset, Ogre::String export_fn, bool debug); int finishTerrainDecal(); + + Ogre::SceneNode *terrain_decals_snode; Ogre::StaticGeometry *terrain_decals_sg; - Ogre::SceneNode *terrain_decals_snode; int terrain_decal_count; // parser things + Ogre::String splinemat, spline_export_fn; bool decalSplineMode; - Ogre::String splinemat, spline_export_fn; float spline_width, splinetex_u, splinetex_v, ground_offset; int spline_segments_x, spline_segments_y; - -public: - DecalManager(); - ~DecalManager(); - - int parseLine(char *line); }; - -#endif // DECALMANAGER_H__ +#endif // __DecalManager_H_ Modified: trunk/source/main/gfx/DustManager.cpp =================================================================== --- trunk/source/main/gfx/DustManager.cpp 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/DustManager.cpp 2012-05-26 20:12:51 UTC (rev 2710) @@ -20,14 +20,10 @@ // created by Thomas Fischer thomas{AT}thomasfischer{DOT}biz, 12th of October 2009 #include "DustManager.h" -#include "Ogre.h" + #include "DustPool.h" #include "Settings.h" -#include "collisions.h" -#include "BeamData.h" -#include "language.h" - using namespace Ogre; DustManager::DustManager() : mEnabled(false) @@ -35,7 +31,6 @@ setSingleton(this); mEnabled = BSETTING("Particles", true); - if (mEnabled) { dustpools["dust"] = new DustPool("tracks/Dust", 20 ); @@ -45,7 +40,6 @@ dustpools["splash"] = new DustPool("tracks/Splash", 20 ); dustpools["ripple"] = new DustPool("tracks/Ripple", 20 ); } - } DustManager::~DustManager() Modified: trunk/source/main/gfx/DustManager.h =================================================================== --- trunk/source/main/gfx/DustManager.h 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/DustManager.h 2012-05-26 20:12:51 UTC (rev 2710) @@ -17,23 +17,18 @@ You should have received a copy of the GNU General Public License along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ - // created by Thomas Fischer thomas{AT}thomasfischer{DOT}biz, 12th of October 2009 +#ifndef __DustManager_H_ +#define __DustManager_H_ -#ifndef GUI_DUSTMANAGER_H__ -#define GUI_DUSTMANAGER_H__ - #include "RoRPrerequisites.h" -#include "Singleton.h" -#include "OgrePrerequisites.h" #include "Singleton.h" - - class DustManager : public RoRSingletonNoCreation < DustManager > { public: + DustManager(); ~DustManager(); @@ -46,9 +41,9 @@ DustPool *getDustPool(Ogre::String name); protected: + bool mEnabled; std::map < Ogre::String , DustPool * > dustpools; - //void addNewDustPool(ground_model_t *g); }; -#endif //GUI_FRICTION_H__ +#endif // __DustManager_H_ Modified: trunk/source/main/gfx/DustPool.cpp =================================================================== --- trunk/source/main/gfx/DustPool.cpp 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/DustPool.cpp 2012-05-26 20:12:51 UTC (rev 2710) @@ -18,15 +18,18 @@ along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ #include "DustPool.h" -#include "IWater.h" + +#include "Water.h" #include "RoRPrerequisites.h" +#include "TerrainManager.h" -DustPool::DustPool(const char* dname, int dsize) +using namespace Ogre; + +DustPool::DustPool(const char* dname, int dsize) : + allocated(0) + , size(dsize) { - size=dsize; - allocated=0; - int i; - for (i=0; i<size; i++) + for (int i=0; i<size; i++) { char dename[256]; sprintf(dename,"Dust %s %i", dname, i); @@ -289,13 +292,16 @@ ParticleEmitter *emit=pss[i]->getEmitter(0); Real vel=velocities[i].length(); emit->setEnabled(true); - positions[i].y=gEnv->water->getHeight()-0.02; + positions[i].y=gEnv->terrainManager->getWater()->getHeight()-0.02; sns[i]->setPosition(positions[i]); emit->setColour(ColourValue(0.9, 0.9, 0.9,vel*0.04)); emit->setTimeToLive(vel*0.04/0.1); } } - for (i=allocated; i<size; i++) pss[i]->getEmitter(0)->setEnabled(false); + for (i=allocated; i<size; i++) + { + pss[i]->getEmitter(0)->setEnabled(false); + } allocated=0; } Modified: trunk/source/main/gfx/DustPool.h =================================================================== --- trunk/source/main/gfx/DustPool.h 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/DustPool.h 2012-05-26 20:12:51 UTC (rev 2710) @@ -17,73 +17,58 @@ You should have received a copy of the GNU General Public License along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __DustPool_H__ -#define __DustPool_H__ +#ifndef __DustPool_H_ +#define __DustPool_H_ #include "RoRPrerequisites.h" -#include <stdio.h> -#include <math.h> -#include "Ogre.h" -//#include "OgreDeflectorPlaneAffector.h" - -using namespace Ogre; - -#define MAX_DUSTS 100 - -#define DUST_NORMAL 0 -#define DUST_RUBBER 1 -#define DUST_DRIP 2 -#define DUST_VAPOUR 3 -#define DUST_SPLASH 4 -#define DUST_RIPPLE 5 -#define DUST_SPARKS 6 -#define DUST_CLUMP 7 - class DustPool { -protected: - ParticleSystem* pss[MAX_DUSTS]; - SceneNode *sns[MAX_DUSTS]; - int size; - int allocated; - Vector3 positions[MAX_DUSTS]; - Vector3 velocities[MAX_DUSTS]; - bool visible[MAX_DUSTS]; - ColourValue colours[MAX_DUSTS]; - int types[MAX_DUSTS]; - float rates[MAX_DUSTS]; - public: + DustPool(const char* dname, int dsize); + ~DustPool(); void setVisible(bool s); //Dust - void malloc(Vector3 pos, Vector3 vel, ColourValue col=ColourValue(0.83, 0.71, 0.64, 1.0)); + void malloc(Ogre::Vector3 pos, Ogre::Vector3 vel, Ogre::ColourValue col = Ogre::ColourValue(0.83, 0.71, 0.64, 1.0)); //clumps - void allocClump(Vector3 pos, Vector3 vel, ColourValue col=ColourValue(0.83, 0.71, 0.64, 1.0)); + void allocClump(Ogre::Vector3 pos, Ogre::Vector3 vel, Ogre::ColourValue col = Ogre::ColourValue(0.83, 0.71, 0.64, 1.0)); //Rubber smoke - void allocSmoke(Vector3 pos, Vector3 vel); + void allocSmoke(Ogre::Vector3 pos, Ogre::Vector3 vel); // - void allocSparks(Vector3 pos, Vector3 vel); + void allocSparks(Ogre::Vector3 pos, Ogre::Vector3 vel); //Water vapour - void allocVapour(Vector3 pos, Vector3 vel, float time); + void allocVapour(Ogre::Vector3 pos, Ogre::Vector3 vel, float time); - void allocDrip(Vector3 pos, Vector3 vel, float time); + void allocDrip(Ogre::Vector3 pos, Ogre::Vector3 vel, float time); - void allocSplash(Vector3 pos, Vector3 vel); + void allocSplash(Ogre::Vector3 pos, Ogre::Vector3 vel); - void allocRipple(Vector3 pos, Vector3 vel); + void allocRipple(Ogre::Vector3 pos, Ogre::Vector3 vel); void update(float gspeed); - ~DustPool(); +protected: + + static const int MAX_DUSTS = 100; + + enum DustTypes { DUST_NORMAL, DUST_RUBBER, DUST_DRIP, DUST_VAPOUR, DUST_SPLASH, DUST_RIPPLE, DUST_SPARKS, DUST_CLUMP }; + + Ogre::ColourValue colours[MAX_DUSTS]; + Ogre::ParticleSystem* pss[MAX_DUSTS]; + Ogre::SceneNode *sns[MAX_DUSTS]; + Ogre::Vector3 positions[MAX_DUSTS]; + Ogre::Vector3 velocities[MAX_DUSTS]; + bool visible[MAX_DUSTS]; + float rates[MAX_DUSTS]; + int allocated; + int size; + int types[MAX_DUSTS]; }; extern int numdust; extern DustPool* dusts[10]; +#endif // __DustPool_H_ -#endif - - Modified: trunk/source/main/gfx/Heathaze.cpp =================================================================== --- trunk/source/main/gfx/Heathaze.cpp 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/Heathaze.cpp 2012-05-26 20:12:51 UTC (rev 2710) @@ -18,11 +18,13 @@ along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ #include "Heathaze.h" + #include "ResourceBuffer.h" using namespace Ogre; -HeatHazeListener::HeatHazeListener() : RenderTargetListener() +HeatHazeListener::HeatHazeListener() : + RenderTargetListener() { } @@ -43,7 +45,7 @@ HeatHaze::HeatHaze() : rttTex(0), listener(0) { - TexturePtr rttTexPtr = TextureManager::getSingleton().createManual("heathaze_rtt", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, cam->getViewport()->getWidth(), cam->getViewport()->getHeight(), 0, PF_R8G8B8, TU_RENDERTARGET, new ResourceBuffer()); + TexturePtr rttTexPtr = TextureManager::getSingleton().createManual("heathaze_rtt", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, gEnv->ogreCamera->getViewport()->getWidth(), gEnv->ogreCamera->getViewport()->getHeight(), 0, PF_R8G8B8, TU_RENDERTARGET, new ResourceBuffer()); rttTex = rttTexPtr->getBuffer()->getRenderTarget(); { /* @@ -57,7 +59,7 @@ //mHazeCam->setAspectRatio(2.0); // setup viewport - Viewport *v = rttTex->addViewport(cam); + Viewport *v = rttTex->addViewport(gEnv->ogreCamera); //v->setClearEveryFrame(true); //v->setBackgroundColour(ColourValue::Black); v->setOverlaysEnabled(false); @@ -67,9 +69,9 @@ MaterialPtr mat = MaterialManager::getSingleton().getByName("tracks/HeatHazeMat"); tex = mat->getTechnique(0)->getPass(0)->getTextureUnitState(1); tex->setTextureName("heathaze_rtt"); - tex->setProjectiveTexturing(true, cam); + tex->setProjectiveTexturing(true, gEnv->ogreCamera); - listener = new HeatHazeListener(gEnv->ogreSceneManager); + listener = new HeatHazeListener(); rttTex->addListener(listener); rttTex->setAutoUpdated(false); } Modified: trunk/source/main/gfx/Heathaze.h =================================================================== --- trunk/source/main/gfx/Heathaze.h 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/Heathaze.h 2012-05-26 20:12:51 UTC (rev 2710) @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef __HeatHaze_H__ -#define __HeatHaze_H__ +#ifndef __HeatHaze_H_ +#define __HeatHaze_H_ #include "RoRPrerequisites.h" #include "Ogre.h" @@ -26,25 +26,26 @@ class HeatHazeListener : public Ogre::RenderTargetListener { public: + HeatHazeListener(); void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt); void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt); - -private: }; class HeatHaze { public: + HeatHaze(); void setEnable(bool en); void prepareShutdown(); void update(); private: + HeatHazeListener *listener; Ogre::TextureUnitState *tex; Ogre::RenderTexture* rttTex; }; -#endif // __HeatHaze_H__ +#endif // __HeatHaze_H_ Modified: trunk/source/main/gfx/ShadowManager.cpp =================================================================== --- trunk/source/main/gfx/ShadowManager.cpp 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/ShadowManager.cpp 2012-05-26 20:12:51 UTC (rev 2710) @@ -21,16 +21,13 @@ #include "Ogre.h" #include "OgreShadowCameraSetup.h" - #include "OgreTerrain.h" #include "OgreTerrainMaterialGeneratorA.h" #include "Settings.h" -//using namespace std; using namespace Ogre; -//--------------------------------------------------------------------- ShadowManager::ShadowManager() : mPSSMSetup() { mDepthShadows = true; @@ -78,8 +75,6 @@ { #if OGRE_VERSION>0x010602 - - // General scene setup // 3 textures per directional light (PSSM) @@ -172,4 +167,4 @@ // this material is not prepared for PSSM usage ! } } -} \ No newline at end of file +} Modified: trunk/source/main/gfx/ShadowManager.h =================================================================== --- trunk/source/main/gfx/ShadowManager.h 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/ShadowManager.h 2012-05-26 20:12:51 UTC (rev 2710) @@ -18,35 +18,30 @@ along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ // created by thomas{AT}thomasfischer{DOT}biz, 5th of July 2010 -#ifndef SHADOWMANAGER_H__ -#define SHADOWMANAGER_H__ +#ifndef __ShadowManager_H_ +#define __ShadowManager_H_ #include "RoRPrerequisites.h" -#include "OgrePrerequisites.h" -#ifdef USE_CAELUM -#include "CaelumPrerequisites.h" -#endif // USE_CAELUM -#include "OgreCommon.h" -#include "Singleton.h" -#include "OgreShadowCameraSetup.h" #include "OgreTerrain.h" class ShadowManager { public: + ShadowManager(); ~ShadowManager(); int changeShadowTechnique(Ogre::ShadowTechnique tech); void loadConfiguration(); - void updatePSSM(Ogre::Terrain* terrain=0); + void updatePSSM(Ogre::Terrain* terrain = 0); protected: + Ogre::ShadowCameraSetupPtr mPSSMSetup; bool mDepthShadows; void setMaterialSplitPoints(Ogre::String materialName, Ogre::Vector4 &splitPoints); }; -#endif //SHADOWMANAGER_H__ +#endif // __ShadowManager_H_ Modified: trunk/source/main/gfx/Skidmark.cpp =================================================================== --- trunk/source/main/gfx/Skidmark.cpp 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/Skidmark.cpp 2012-05-26 20:12:51 UTC (rev 2710) @@ -405,4 +405,3 @@ mDirty = false; } - Modified: trunk/source/main/gfx/SkyManager.cpp =================================================================== --- trunk/source/main/gfx/SkyManager.cpp 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/SkyManager.cpp 2012-05-26 20:12:51 UTC (rev 2710) @@ -17,21 +17,15 @@ You should have received a copy of the GNU General Public License along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ - #ifdef USE_CAELUM #include "SkyManager.h" #include "Settings.h" -#include "Ogre.h" #include <Caelum.h> - - -using namespace std; using namespace Ogre; -using namespace Caelum; //--------------------------------------------------------------------- SkyManager::SkyManager() : mCaelumSystem(0) @@ -43,8 +37,8 @@ /* // TODO: set real time, and let the user select his true location mCaelumSystem->getUniversalClock()->setGregorianDateTime(2008, 4, 9, 6, 33, 0); - mCaelumSystem->setObserverLongitude(Ogre::Degree(0)); - mCaelumSystem->setObserverLatitude(Ogre::Degree(0)); + mCaelumSystem->setObserverLongitude(Degree(0)); + mCaelumSystem->setObserverLatitude(Degree(0)); mCaelumSystem->getUniversalClock()->setTimeScale(100); */ @@ -69,27 +63,27 @@ mCaelumSystem->updateSubcomponents(dt); } -void SkyManager::loadScript(Ogre::String script) +void SkyManager::loadScript(String script) { // load the caelum config try { - CaelumPlugin::getSingleton().loadCaelumSystemFromScript (mCaelumSystem, script); + Caelum::CaelumPlugin::getSingleton().loadCaelumSystemFromScript (mCaelumSystem, script); // overwrite some settings #ifdef CAELUM_VERSION_SEC // important: overwrite fog setings if not using infinite farclip - if(mCamera->getFarClipDistance() > 0) + if(gEnv->ogreCamera->getFarClipDistance() > 0) { // non infinite farclip - Real farclip = mCamera->getFarClipDistance(); - mCaelumSystem->setManageSceneFog(Ogre::FOG_LINEAR); + Real farclip = gEnv->ogreCamera->getFarClipDistance(); + mCaelumSystem->setManageSceneFog(FOG_LINEAR); mCaelumSystem->setManageSceneFogStart(farclip * 0.7f); mCaelumSystem->setManageSceneFogEnd(farclip * 0.9f); } else { // no fog in infinite farclip - mCaelumSystem->setManageSceneFog(Ogre::FOG_NONE); + mCaelumSystem->setManageSceneFog(FOG_NONE); } #else #error please use a recent Caelum version, see http://www.rigsofrods.com/wiki/pages/Compiling_3rd_party_libraries#Caelum @@ -109,29 +103,30 @@ // enforcing update, so shadows are set correctly before creating the terrain forceUpdate(0.1); - } catch(Ogre::Exception& e) + } catch(Exception& e) { LOG("exception upon loading sky script: " + e.getFullDescription()); } } -void SkyManager::setTimeFactor(LongReal factor) +void SkyManager::setTimeFactor(Real factor) { - mCaelumSystem->getUniversalClock()->setTimeScale (factor); + mCaelumSystem->getUniversalClock()->setTimeScale(factor); } -Ogre::Light *SkyManager::getMainLight() +Light *SkyManager::getMainLight() { if(mCaelumSystem && mCaelumSystem->getSun()) return mCaelumSystem->getSun()->getMainLight(); return 0; } -LongReal SkyManager::getTimeFactor() + +Real SkyManager::getTimeFactor() { return mCaelumSystem->getUniversalClock()->getTimeScale(); } -Ogre::String SkyManager::getPrettyTime() +String SkyManager::getPrettyTime() { int ignore; int hour; @@ -140,9 +135,9 @@ Caelum::Astronomy::getGregorianDateTimeFromJulianDay(mCaelumSystem->getJulianDay() , ignore, ignore, ignore, hour, minute, second); - return Ogre::StringConverter::toString( hour, 2, '0' ) - + ":" + Ogre::StringConverter::toString( minute, 2, '0' ) - + ":" + Ogre::StringConverter::toString( (int)second, 2, '0' ); + return StringConverter::toString( hour, 2, '0' ) + + ":" + StringConverter::toString( minute, 2, '0' ) + + ":" + StringConverter::toString( (int)second, 2, '0' ); } #endif //USE_CAELUM Modified: trunk/source/main/gfx/SkyManager.h =================================================================== --- trunk/source/main/gfx/SkyManager.h 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/SkyManager.h 2012-05-26 20:12:51 UTC (rev 2710) @@ -17,30 +17,29 @@ You should have received a copy of the GNU General Public License along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>. */ - #ifdef USE_CAELUM -#ifndef SKYMANAGER_H__ -#define SKYMANAGER_H__ +#ifndef __SkyManager_H_ +#define __SkyManager_H_ #include "RoRPrerequisites.h" -#include "OgrePrerequisites.h" + #include "CaelumPrerequisites.h" -#include "Singleton.h" class SkyManager { public: + SkyManager(); ~SkyManager(); void loadScript(Ogre::String script); /// change the time scale - void setTimeFactor(double f); + void setTimeFactor(Ogre::Real f); Ogre::Light *getMainLight(); /// gets the current time scale - double getTimeFactor(); + Ogre::Real getTimeFactor(); /// prints the current time of the simulation in the format of HH:MM:SS Ogre::String getPrettyTime(); @@ -49,10 +48,11 @@ void notifyCameraChanged(Ogre::Camera *cam); protected: + Caelum::CaelumSystem *mCaelumSystem; Caelum::CaelumSystem *getCaelumSystem() { return mCaelumSystem; }; }; -#endif //SKYMANAGER_H__ +#endif // __SkyManager_H_ -#endif //USE_CAELUM +#endif // USE_CAELUM Modified: trunk/source/main/gfx/envmap.cpp =================================================================== --- trunk/source/main/gfx/envmap.cpp 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/envmap.cpp 2012-05-26 20:12:51 UTC (rev 2710) @@ -23,16 +23,19 @@ #include "Ogre.h" #include "Settings.h" #include "SkyManager.h" +#include "TerrainManager.h" using namespace Ogre; -Envmap::Envmap(bool dynamic, int updateRate /* = 1 */) : - mDebugSceneNode(0) - , mInitiated(false) - , mIsDynamic(dynamic) +Envmap::Envmap() : + mInitiated(false) + , mIsDynamic(false) , mRound(0) - , updateRate(updateRate) + , updateRate(1) { + mIsDynamic = BSETTING("Envmap", false); + updateRate = ISETTING("EnvmapUpdateRate", 1); + TexturePtr texture = TextureManager::getSingleton().createManual("EnvironmentTexture", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_CUBE_MAP, 256, 256, 0, PF_R8G8B8, TU_RENDERTARGET); @@ -40,18 +43,18 @@ for (int face=0; face < NUM_FACES; face++) { mRenderTargets[face] = texture->getBuffer(face)->getRenderTarget(); - mCameras[face] = scm->createCamera("EnvironmentCamera-" + TOSTRING(face)); + mCameras[face] = gEnv->ogreSceneManager->createCamera("EnvironmentCamera-" + TOSTRING(face)); mCameras[face]->setAspectRatio(1.0); mCameras[face]->setProjectionType(PT_PERSPECTIVE); mCameras[face]->setFixedYawAxis(false); mCameras[face]->setFOVy(Degree(90)); mCameras[face]->setNearClipDistance(0.1f); - mCameras[face]->setFarClipDistance(cam->getFarClipDistance()); + mCameras[face]->setFarClipDistance(gEnv->ogreCamera->getFarClipDistance()); Viewport *v = mRenderTargets[face]->addViewport(mCameras[face]); v->setOverlaysEnabled(false); v->setClearEveryFrame(true); - v->setBackgroundColour(cam->getViewport()->getBackgroundColour()); + v->setBackgroundColour(gEnv->ogreCamera->getViewport()->getBackgroundColour()); mRenderTargets[face]->setAutoUpdated(false); switch (face) @@ -186,13 +189,13 @@ mesh->_setBoundingSphereRadius(10); mesh->load(); - Entity *e = scm->createEntity(mesh->getName()); + Entity *e = gEnv->ogreSceneManager->createEntity(mesh->getName()); e->setCastShadows(false); e->setRenderQueueGroup(RENDER_QUEUE_OVERLAY-1); e->setVisible(true); e->setMaterialName("tracks/EnvMapDebug"); - mDebugSceneNode = new SceneNode(scm); + Ogre::SceneNode* mDebugSceneNode = new SceneNode(gEnv->ogreSceneManager); mDebugSceneNode->attachObject(e); mDebugSceneNode->setPosition(Vector3(0, 0, -5)); mDebugSceneNode->setFixedYawAxis(true, Vector3::UNIT_Y); @@ -244,18 +247,18 @@ { // caelum needs to know that we changed the cameras #ifdef USE_CAELUM - if (SkyManager::singletonExists()) + if (gEnv->terrainManager->getSkyManager()) { - SkyManager::getSingleton().notifyCameraChanged(mCameras[mRound]); + gEnv->terrainManager->getSkyManager()->notifyCameraChanged(mCameras[mRound]); } #endif // USE_CAELUM mRenderTargets[mRound]->update(); mRound = (mRound + 1) % NUM_FACES; } #ifdef USE_CAELUM - if (SkyManager::singletonExists()) + if (gEnv->terrainManager->getSkyManager()) { - SkyManager::getSingleton().notifyCameraChanged(mMainCamera); + gEnv->terrainManager->getSkyManager()->notifyCameraChanged(gEnv->ogreCamera); } #endif // USE_CAELUM Modified: trunk/source/main/gfx/envmap.h =================================================================== --- trunk/source/main/gfx/envmap.h 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/envmap.h 2012-05-26 20:12:51 UTC (rev 2710) @@ -39,9 +39,7 @@ static const unsigned int NUM_FACES = 6; Ogre::Camera *mCameras[NUM_FACES]; - Ogre::Camera *mMainCamera; Ogre::RenderTarget *mRenderTargets[NUM_FACES]; - Ogre::SceneNode *mDebugSceneNode; bool mInitiated; bool mIsDynamic; int mRound; Modified: trunk/source/main/gfx/hdrlistener.cpp =================================================================== --- trunk/source/main/gfx/hdrlistener.cpp 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/hdrlistener.cpp 2012-05-26 20:12:51 UTC (rev 2710) @@ -19,6 +19,10 @@ */ #include "hdrlistener.h" +#include "Ogre.h" + +using namespace Ogre; + void HDRListener::notifyViewportSize(int width, int height) { mVpWidth = width; @@ -117,4 +121,3 @@ void HDRListener::notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat) { } - Modified: trunk/source/main/gfx/hdrlistener.h =================================================================== --- trunk/source/main/gfx/hdrlistener.h 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/gfx/hdrlistener.h 2012-05-26 20:12:51 UTC (rev 2710) @@ -21,18 +21,20 @@ #define __HDRListener_H_ #include "RoRPrerequisites.h" -#include "Ogre.h" -//#include "OgreCompositorInstance.h" +#include "OgreCompositorInstance.h" + class HDRListener: public Ogre::CompositorInstance::Listener { public: + void notifyViewportSize(int width, int height); void notifyCompositor(Ogre::CompositorInstance* instance); virtual void notifyMaterialSetup(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat); virtual void notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat); protected: + int mVpWidth; int mVpHeight; int mBloomSize; Modified: trunk/source/main/terrain/TerrainManager.h =================================================================== --- trunk/source/main/terrain/TerrainManager.h 2012-05-26 19:21:41 UTC (rev 2709) +++ trunk/source/main/terrain/TerrainManager.h 2012-05-26 20:12:51 UTC (rev 2710) @@ -32,9 +32,10 @@ void loadTerrain(Ogre::String filename); - inline Collisions *getCollisions() { return collisions; }; - inline Water *getWater() { return water; }; - inline Envmap *getEnvmap() { return envmap; }; + Collisions *getCollisions() { return collisions; }; + Water *getWater() { return water; }; + Envmap *getEnvmap() { return envmap; }; + SkyManager *getSkyManager() { return sky_manager; }; void setGravity(float value); float getGravity() { return gravity; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Rigsofrods-devel mailing list Rigsofrods-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel