Revision: 2685
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2685&view=rev
Author:   rorthomas
Date:     2012-05-26 03:36:26 +0000 (Sat, 26 May 2012)
Log Message:
-----------
added global environment

Modified Paths:
--------------
    trunk/source/main/RoRPrerequisites.h
    trunk/source/main/framework/AdvancedOgreFramework.cpp
    trunk/source/main/framework/GameState.cpp
    trunk/source/main/gameplay/RoRFrameListener.cpp

Added Paths:
-----------
    trunk/source/main/gameplay/GEnv.h

Modified: trunk/source/main/RoRPrerequisites.h
===================================================================
--- trunk/source/main/RoRPrerequisites.h        2012-05-26 03:18:19 UTC (rev 
2684)
+++ trunk/source/main/RoRPrerequisites.h        2012-05-26 03:36:26 UTC (rev 
2685)
@@ -39,6 +39,8 @@
 #include <OgreQuaternion.h>
 #include <OgreUTFString.h>
 
+#include "GEnv.h"
+
 // some config for angelscript, doesnt matter if we compile with angelscript 
or not as its just a definition
 #ifdef USE_ANGELSCRIPT
 #ifndef AS_USE_NAMESPACE
@@ -232,4 +234,6 @@
        HIDE_MIRROR       = BITMASK(3),
 };
 
+extern GEnv *gEnv;
+
 #endif // __RoRPrerequisites_H_

Modified: trunk/source/main/framework/AdvancedOgreFramework.cpp
===================================================================
--- trunk/source/main/framework/AdvancedOgreFramework.cpp       2012-05-26 
03:18:19 UTC (rev 2684)
+++ trunk/source/main/framework/AdvancedOgreFramework.cpp       2012-05-26 
03:36:26 UTC (rev 2685)
@@ -14,6 +14,8 @@
 using namespace Ogre;
 
 
+GEnv *gEnv = new GEnv();
+
 //|||||||||||||||||||||||||||||||||||||||||||||||
 
 OgreFramework::OgreFramework() : hwnd(Ogre::String()), 
mainhwnd(Ogre::String()), name(), embedded(false)
@@ -195,6 +197,11 @@
 
     m_pRenderWnd->setActive(true);
 
+
+       gEnv->ogreRoot     = m_pRoot;
+       gEnv->ogreViewPort = m_pViewport;
+       gEnv->ogreRenderWindow = m_pRenderWnd;
+
     return true;
 }
 

Modified: trunk/source/main/framework/GameState.cpp
===================================================================
--- trunk/source/main/framework/GameState.cpp   2012-05-26 03:18:19 UTC (rev 
2684)
+++ trunk/source/main/framework/GameState.cpp   2012-05-26 03:36:26 UTC (rev 
2685)
@@ -16,6 +16,7 @@
     LOG("Entering GameState...");
 
        m_pSceneMgr = 
OgreFramework::getSingletonPtr()->m_pRoot->createSceneManager(ST_EXTERIOR_CLOSE);
+       gEnv->ogreSceneManager = m_pSceneMgr;
 
        //CREATE CAMERA
        LOG("Creating camera");
@@ -31,6 +32,8 @@
        m_pCamera->setAutoAspectRatio(true);
        OgreFramework::getSingletonPtr()->m_pViewport->setCamera(m_pCamera);
 
+       gEnv->ogreCamera = m_pCamera;
+
        // TO BE DONE:
        //m_pSceneMgr->setCameraRelativeRendering(true);
 
@@ -47,6 +50,8 @@
        
        OgreFramework::getSingleton().m_pRoot->addFrameListener(mFrameListener);
 
+       gEnv->framelistener = mFrameListener;
+       
 }
 
 bool GameState::pause()

Added: trunk/source/main/gameplay/GEnv.h
===================================================================
--- trunk/source/main/gameplay/GEnv.h                           (rev 0)
+++ trunk/source/main/gameplay/GEnv.h   2012-05-26 03:36:26 UTC (rev 2685)
@@ -0,0 +1,40 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2012 Pierre-Michel Ricordel
+Copyright 2007-2012 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+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 GEnv_H__
+#define GEnv_H__
+
+class RoRFrameListener;
+class TerrainManager;
+
+class GEnv
+{
+public:
+       Ogre::Root *ogreRoot;
+       Ogre::Viewport *ogreViewPort;
+       Ogre::RenderWindow *ogreRenderWindow;
+       Ogre::Camera *ogreCamera;
+       Ogre::SceneManager *ogreSceneManager;
+
+       RoRFrameListener *framelistener;
+       TerrainManager *terrainManager;
+
+};
+
+#endif // GEnv_H__

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-26 03:18:19 UTC 
(rev 2684)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2012-05-26 03:36:26 UTC 
(rev 2685)
@@ -2987,6 +2987,7 @@
        }
 
        terrainManager = new TerrainManager(mSceneMgr, mWindow, mCamera, 
person);
+       gEnv->terrainManager = terrainManager;
        terrainManager->loadTerrain(terrainfile);
 
        if (person) person->setVisible(true);

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to