mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 02:26:38 +00:00 
			
		
		
		
	Merged
This commit is contained in:
		
						commit
						4597295e20
					
				
					 11 changed files with 215 additions and 114 deletions
				
			
		|  | @ -10,19 +10,22 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) | ||||||
| 
 | 
 | ||||||
| set(GAME  | set(GAME  | ||||||
|     apps/openmw/main.cpp  |     apps/openmw/main.cpp  | ||||||
|     apps/openmw/engine.cpp) |     apps/openmw/engine.cpp | ||||||
|  |     apps/openmw/world.cpp) | ||||||
| set(GAME_HEADER  | set(GAME_HEADER  | ||||||
|     apps/openmw/mwinput/inputmanager.hpp  |     apps/openmw/mwinput/inputmanager.hpp  | ||||||
|     apps/openmw/engine.hpp) |     apps/openmw/engine.hpp | ||||||
|  |     apps/openmw/world.hpp) | ||||||
| source_group(game FILES ${GAME} ${GAME_HEADER}) | source_group(game FILES ${GAME} ${GAME_HEADER}) | ||||||
| 
 | 
 | ||||||
| set(GAMEREND  | set(GAMEREND  | ||||||
|     apps/openmw/mwrender/mwscene.cpp  |     apps/openmw/mwrender/mwscene.cpp  | ||||||
|     apps/openmw/mwrender/cell.cpp |     apps/openmw/mwrender/cellimp.cpp | ||||||
|     apps/openmw/mwrender/interior.cpp |     apps/openmw/mwrender/interior.cpp | ||||||
|     apps/openmw/mwrender/sky.cpp) |     apps/openmw/mwrender/sky.cpp) | ||||||
| set(GAMEREND_HEADER  | set(GAMEREND_HEADER  | ||||||
|     apps/openmw/mwrender/cell.hpp  |     apps/openmw/mwrender/cell.hpp  | ||||||
|  |     apps/openmw/mwrender/cellimp.hpp  | ||||||
|     apps/openmw/mwrender/mwscene.hpp |     apps/openmw/mwrender/mwscene.hpp | ||||||
|     apps/openmw/mwrender/interior.hpp  |     apps/openmw/mwrender/interior.hpp  | ||||||
|     apps/openmw/mwrender/playerpos.hpp |     apps/openmw/mwrender/playerpos.hpp | ||||||
|  |  | ||||||
|  | @ -4,19 +4,14 @@ | ||||||
| 
 | 
 | ||||||
| #include <iostream> | #include <iostream> | ||||||
| 
 | 
 | ||||||
| #include "components/esm_store/cell_store.hpp" |  | ||||||
| #include "components/bsa/bsa_archive.hpp" |  | ||||||
| #include "components/engine/ogre/renderer.hpp" |  | ||||||
| #include "components/misc/fileops.hpp" | #include "components/misc/fileops.hpp" | ||||||
|  | #include "components/bsa/bsa_archive.hpp" | ||||||
| 
 | 
 | ||||||
| #include "apps/openmw/mwrender/interior.hpp" |  | ||||||
| #include "mwinput/inputmanager.hpp" | #include "mwinput/inputmanager.hpp" | ||||||
| #include "apps/openmw/mwrender/playerpos.hpp" | 
 | ||||||
| #include "apps/openmw/mwrender/sky.hpp" | #include "world.hpp" | ||||||
| 
 | 
 | ||||||
| OMW::Engine::Engine()  | OMW::Engine::Engine()  | ||||||
|     : mEnableSky   (false) |  | ||||||
|     , mpSkyManager (NULL) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -76,17 +71,11 @@ void OMW::Engine::addMaster (const std::string& master) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Enables sky rendering
 |  | ||||||
| //
 |  | ||||||
| void OMW::Engine::enableSky (bool bEnable) |  | ||||||
| { |  | ||||||
|     mEnableSky = bEnable; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Initialise and enter main loop.
 | // Initialise and enter main loop.
 | ||||||
| 
 | 
 | ||||||
| void OMW::Engine::go() | void OMW::Engine::go() | ||||||
| { | { | ||||||
|  |     assert (!mWorld); | ||||||
|     assert (!mDataDir.empty()); |     assert (!mDataDir.empty()); | ||||||
|     assert (!mCellName.empty()); |     assert (!mCellName.empty()); | ||||||
|     assert (!mMaster.empty()); |     assert (!mMaster.empty()); | ||||||
|  | @ -104,55 +93,29 @@ void OMW::Engine::go() | ||||||
|     addResourcesDirectory (mDataDir / "Meshes"); |     addResourcesDirectory (mDataDir / "Meshes"); | ||||||
|     addResourcesDirectory (mDataDir / "Textures"); |     addResourcesDirectory (mDataDir / "Textures"); | ||||||
| 
 | 
 | ||||||
|     loadBSA(); |  | ||||||
| 
 |  | ||||||
|     boost::filesystem::path masterPath (mDataDir); |  | ||||||
|     masterPath /= mMaster; |  | ||||||
| 
 |  | ||||||
|     std::cout << "Loading ESM " << masterPath.string() << "\n"; |  | ||||||
|     ESM::ESMReader esm; |  | ||||||
|     ESMS::ESMStore store; |  | ||||||
|     ESMS::CellStore cell; |  | ||||||
| 
 |  | ||||||
|     // This parses the ESM file and loads a sample cell
 |  | ||||||
|     esm.open(masterPath.file_string()); |  | ||||||
|     store.load(esm); |  | ||||||
| 
 |  | ||||||
|     cell.loadInt(mCellName, store, esm); |  | ||||||
| 
 |  | ||||||
|     // Create the window
 |     // Create the window
 | ||||||
|     mOgre.createWindow("OpenMW"); |     mOgre.createWindow("OpenMW"); | ||||||
| 
 | 
 | ||||||
|     std::cout << "\nSetting up cell rendering\n"; |     loadBSA(); | ||||||
| 
 | 
 | ||||||
|     // Sets up camera, scene manager, and viewport.
 |     // Create the world
 | ||||||
|     MWRender::MWScene scene(mOgre); |     mWorld = new World (mOgre, mDataDir, mMaster, mCellName); | ||||||
| 
 |  | ||||||
|     // Used to control the player camera and position
 |  | ||||||
|     MWRender::PlayerPos player(scene.getCamera()); |  | ||||||
| 
 |  | ||||||
|     // This connects the cell data with the rendering scene.
 |  | ||||||
|     MWRender::InteriorCellRender rend(cell, scene); |  | ||||||
| 
 |  | ||||||
|     // Load the cell and insert it into the renderer
 |  | ||||||
|     rend.show(); |  | ||||||
| 
 |  | ||||||
|     // Optionally enable the sky
 |  | ||||||
|     if (mEnableSky) |  | ||||||
|         mpSkyManager = MWRender::SkyManager::create(mOgre.getWindow(), scene.getCamera()); |  | ||||||
|      |      | ||||||
|     std::cout << "Setting up input system\n"; |     std::cout << "Setting up input system\n"; | ||||||
| 
 | 
 | ||||||
|     // Sets up the input system
 |     // Sets up the input system
 | ||||||
|     MWInput::MWInputManager input(mOgre, player); |     MWInput::MWInputManager input(mOgre, mWorld->getPlayerPos()); | ||||||
| 
 | 
 | ||||||
|     std::cout << "\nStart! Press Q/ESC or close window to exit.\n"; |     std::cout << "\nStart! Press Q/ESC or close window to exit.\n"; | ||||||
| 
 | 
 | ||||||
|     // Start the main rendering loop
 |     // Start the main rendering loop
 | ||||||
|     mOgre.start(); |     mOgre.start(); | ||||||
| 
 | 
 | ||||||
|     delete mpSkyManager; |  | ||||||
| 
 |  | ||||||
|     std::cout << "\nThat's all for now!\n"; |     std::cout << "\nThat's all for now!\n"; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | OMW::Engine::~Engine() | ||||||
|  | { | ||||||
|  |     delete mWorld; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -5,15 +5,12 @@ | ||||||
| 
 | 
 | ||||||
| #include <boost/filesystem.hpp> | #include <boost/filesystem.hpp> | ||||||
| 
 | 
 | ||||||
| #include "apps/openmw/mwrender/mwscene.hpp" | #include "components/engine/ogre/renderer.hpp" | ||||||
| 
 |  | ||||||
| namespace MWRender |  | ||||||
| { |  | ||||||
|     class SkyManager; |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| namespace OMW | namespace OMW | ||||||
| { | { | ||||||
|  |     class World; | ||||||
|  | 
 | ||||||
|     /// \brief Main engine class, that brings together all the components of OpenMW
 |     /// \brief Main engine class, that brings together all the components of OpenMW
 | ||||||
| 
 | 
 | ||||||
|     class Engine |     class Engine | ||||||
|  | @ -22,9 +19,7 @@ namespace OMW | ||||||
|             Render::OgreRenderer mOgre; |             Render::OgreRenderer mOgre; | ||||||
|             std::string mCellName; |             std::string mCellName; | ||||||
|             std::string mMaster; |             std::string mMaster; | ||||||
|              |             World *mWorld; | ||||||
|             bool                  mEnableSky; |  | ||||||
|             MWRender::SkyManager* mpSkyManager; |  | ||||||
|              |              | ||||||
|             // not implemented
 |             // not implemented
 | ||||||
|             Engine (const Engine&); |             Engine (const Engine&); | ||||||
|  | @ -41,6 +36,8 @@ namespace OMW | ||||||
| 
 | 
 | ||||||
|             Engine(); |             Engine(); | ||||||
| 
 | 
 | ||||||
|  |             ~Engine(); | ||||||
|  | 
 | ||||||
|             /// Set data dir
 |             /// Set data dir
 | ||||||
|             void setDataDir (const boost::filesystem::path& dataDir); |             void setDataDir (const boost::filesystem::path& dataDir); | ||||||
| 
 | 
 | ||||||
|  | @ -52,9 +49,6 @@ namespace OMW | ||||||
|             /// - Currently OpenMW only supports one master at the same time.
 |             /// - Currently OpenMW only supports one master at the same time.
 | ||||||
|             void addMaster (const std::string& master); |             void addMaster (const std::string& master); | ||||||
| 
 | 
 | ||||||
|             /// Enables rendering of the sky (off by default).
 |  | ||||||
|             void enableSky (bool bEnable); |  | ||||||
| 
 |  | ||||||
|             /// Initialise and enter main loop.
 |             /// Initialise and enter main loop.
 | ||||||
|             void go(); |             void go(); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -29,7 +29,6 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine) | ||||||
|             "set initial cell (only interior cells supported at the moment") |             "set initial cell (only interior cells supported at the moment") | ||||||
|         ("master", bpo::value<std::string>()->default_value ("Morrowind"), |         ("master", bpo::value<std::string>()->default_value ("Morrowind"), | ||||||
|             "master file") |             "master file") | ||||||
|         ("enablesky", "enable rendering of the sky") |  | ||||||
|         ; |         ; | ||||||
|    |    | ||||||
|     bpo::variables_map variables; |     bpo::variables_map variables; | ||||||
|  | @ -48,8 +47,6 @@ bool parseOptions (int argc, char**argv, OMW::Engine& engine) | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     engine.enableSky(!!variables.count("enablesky")); |  | ||||||
| 
 |  | ||||||
|     engine.setDataDir (variables["data"].as<std::string>()); |     engine.setDataDir (variables["data"].as<std::string>()); | ||||||
|     engine.setCell (variables["start"].as<std::string>()); |     engine.setCell (variables["start"].as<std::string>()); | ||||||
|     engine.addMaster (variables["master"].as<std::string>()); |     engine.addMaster (variables["master"].as<std::string>()); | ||||||
|  |  | ||||||
|  | @ -1,43 +1,22 @@ | ||||||
| #ifndef _GAME_RENDER_CELL_H | #ifndef GAME_RENDER_CELL_H | ||||||
| #define _GAME_RENDER_CELL_H | #define GAME_RENDER_CELL_H | ||||||
| 
 |  | ||||||
| #include <string> |  | ||||||
| 
 |  | ||||||
| namespace ESM |  | ||||||
| { |  | ||||||
|   class CellRef; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| namespace ESMS |  | ||||||
| { |  | ||||||
|   class CellStore; |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| namespace MWRender  | namespace MWRender  | ||||||
| { | { | ||||||
|   /// Base class for cell render, that implements inserting references into a cell in a
 |  | ||||||
|   /// cell type- and render-engine-independent way.
 |  | ||||||
| 
 |  | ||||||
|     class CellRender |     class CellRender | ||||||
|     { |     { | ||||||
|         public:  |         public:  | ||||||
|     CellRender() {} |  | ||||||
|     virtual ~CellRender() {} |  | ||||||
|      |      | ||||||
|     /// start inserting a new reference.
 |             virtual ~CellRender() {}; | ||||||
|     virtual void insertBegin (const ESM::CellRef &ref) = 0; |  | ||||||
|      |      | ||||||
|     /// insert a mesh related to the most recent insertBegin call.
 |             /// Make the cell visible. Load the cell if necessary.
 | ||||||
|     virtual void insertMesh(const std::string &mesh) = 0; |             virtual void show() = 0; | ||||||
|              |              | ||||||
|     /// insert a light related to the most recent insertBegin call.
 |             /// Remove the cell from rendering, but don't remove it from
 | ||||||
|     virtual void insertLight(float r, float g, float b, float radius) = 0; |             /// memory.
 | ||||||
|      |             virtual void hide() = 0;  | ||||||
|     /// finish inserting a new reference and return a handle to it.
 |  | ||||||
|     virtual std::string insertEnd() = 0; |  | ||||||
|        |  | ||||||
|     void insertCell(const ESMS::CellStore &cell); |  | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| #include "cell.hpp" | #include "cellimp.hpp" | ||||||
| 
 | 
 | ||||||
| #include <cassert> | #include <cassert> | ||||||
| 
 | 
 | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| using namespace MWRender; | using namespace MWRender; | ||||||
| 
 | 
 | ||||||
| template<typename T> | template<typename T> | ||||||
| void insertObj(CellRender& cellRender, const T& liveRef) | void insertObj(CellRenderImp& cellRender, const T& liveRef) | ||||||
| { | { | ||||||
|   assert (liveRef.base != NULL); |   assert (liveRef.base != NULL); | ||||||
|   const std::string &model = liveRef.base->model; |   const std::string &model = liveRef.base->model; | ||||||
|  | @ -20,7 +20,7 @@ void insertObj(CellRender& cellRender, const T& liveRef) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| template<> | template<> | ||||||
| void insertObj(CellRender& cellRender, const ESMS::LiveCellRef<ESM::Light>& liveRef) | void insertObj(CellRenderImp& cellRender, const ESMS::LiveCellRef<ESM::Light>& liveRef) | ||||||
| { | { | ||||||
|   assert (liveRef.base != NULL); |   assert (liveRef.base != NULL); | ||||||
|   const std::string &model = liveRef.base->model; |   const std::string &model = liveRef.base->model; | ||||||
|  | @ -43,7 +43,7 @@ void insertObj(CellRender& cellRender, const ESMS::LiveCellRef<ESM::Light>& live | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| template<typename T> | template<typename T> | ||||||
| void insertCellRefList (CellRender& cellRender, const T& cellRefList) | void insertCellRefList (CellRenderImp& cellRender, const T& cellRefList) | ||||||
| { | { | ||||||
|   for(typename T::List::const_iterator it = cellRefList.list.begin(); |   for(typename T::List::const_iterator it = cellRefList.list.begin(); | ||||||
|     it != cellRefList.list.end(); it++) |     it != cellRefList.list.end(); it++) | ||||||
|  | @ -52,7 +52,7 @@ void insertCellRefList (CellRender& cellRender, const T& cellRefList) | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void CellRender::insertCell(const ESMS::CellStore &cell) | void CellRenderImp::insertCell(const ESMS::CellStore &cell) | ||||||
| { | { | ||||||
|   // Loop through all references in the cell
 |   // Loop through all references in the cell
 | ||||||
|   insertCellRefList (*this, cell.activators); |   insertCellRefList (*this, cell.activators); | ||||||
							
								
								
									
										44
									
								
								apps/openmw/mwrender/cellimp.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								apps/openmw/mwrender/cellimp.hpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,44 @@ | ||||||
|  | #ifndef _GAME_RENDER_CELLIMP_H | ||||||
|  | #define _GAME_RENDER_CELLIMP_H | ||||||
|  | 
 | ||||||
|  | #include <string> | ||||||
|  | 
 | ||||||
|  | namespace ESM | ||||||
|  | { | ||||||
|  |   class CellRef; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | namespace ESMS | ||||||
|  | { | ||||||
|  |   class CellStore; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | namespace MWRender | ||||||
|  | { | ||||||
|  |   /// Base class for cell render, that implements inserting references into a cell in a
 | ||||||
|  |   /// cell type- and render-engine-independent way.
 | ||||||
|  | 
 | ||||||
|  |   class CellRenderImp | ||||||
|  |   { | ||||||
|  |   public: | ||||||
|  |     CellRenderImp() {} | ||||||
|  |     virtual ~CellRenderImp() {} | ||||||
|  | 
 | ||||||
|  |     /// start inserting a new reference.
 | ||||||
|  |     virtual void insertBegin (const ESM::CellRef &ref) = 0; | ||||||
|  | 
 | ||||||
|  |     /// insert a mesh related to the most recent insertBegin call.
 | ||||||
|  |     virtual void insertMesh(const std::string &mesh) = 0; | ||||||
|  |      | ||||||
|  |     /// insert a light related to the most recent insertBegin call.
 | ||||||
|  |     virtual void insertLight(float r, float g, float b, float radius) = 0; | ||||||
|  |      | ||||||
|  |     /// finish inserting a new reference and return a handle to it.
 | ||||||
|  |     virtual std::string insertEnd() = 0; | ||||||
|  |        | ||||||
|  |     void insertCell(const ESMS::CellStore &cell); | ||||||
|  | 
 | ||||||
|  |   }; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | @ -2,6 +2,7 @@ | ||||||
| #define _GAME_RENDER_INTERIOR_H | #define _GAME_RENDER_INTERIOR_H | ||||||
| 
 | 
 | ||||||
| #include "cell.hpp" | #include "cell.hpp" | ||||||
|  | #include "cellimp.hpp" | ||||||
| #include "components/esm_store/cell_store.hpp" | #include "components/esm_store/cell_store.hpp" | ||||||
| 
 | 
 | ||||||
| #include "OgreColourValue.h" | #include "OgreColourValue.h" | ||||||
|  | @ -23,7 +24,7 @@ namespace MWRender | ||||||
|      TODO FIXME: Doesn't do full cleanup yet. |      TODO FIXME: Doesn't do full cleanup yet. | ||||||
|    */ |    */ | ||||||
| 
 | 
 | ||||||
|   class InteriorCellRender : private CellRender |   class InteriorCellRender : public CellRender, private CellRenderImp | ||||||
|   { |   { | ||||||
| 
 | 
 | ||||||
|     static bool lightConst; |     static bool lightConst; | ||||||
|  | @ -83,14 +84,14 @@ namespace MWRender | ||||||
|     virtual ~InteriorCellRender() { destroy(); } |     virtual ~InteriorCellRender() { destroy(); } | ||||||
| 
 | 
 | ||||||
|     /// Make the cell visible. Load the cell if necessary.
 |     /// Make the cell visible. Load the cell if necessary.
 | ||||||
|     void show(); |     virtual void show(); | ||||||
| 
 | 
 | ||||||
|     /// Remove the cell from rendering, but don't remove it from
 |     /// Remove the cell from rendering, but don't remove it from
 | ||||||
|     /// memory.
 |     /// memory.
 | ||||||
|     void hide(); |     void hide(); | ||||||
| 
 | 
 | ||||||
|     /// Destroy all rendering objects connected with this cell.
 |     /// Destroy all rendering objects connected with this cell.
 | ||||||
|     void destroy(); |     void destroy(); // comment by Zini: shouldn't this go into the destructor?
 | ||||||
| 
 | 
 | ||||||
|     /// Switch through lighting modes.
 |     /// Switch through lighting modes.
 | ||||||
|     void toggleLight(); |     void toggleLight(); | ||||||
|  |  | ||||||
							
								
								
									
										61
									
								
								apps/openmw/world.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								apps/openmw/world.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,61 @@ | ||||||
|  | 
 | ||||||
|  | #include "world.hpp" | ||||||
|  | 
 | ||||||
|  | #include "components/bsa/bsa_archive.hpp" | ||||||
|  | #include "components/engine/ogre/renderer.hpp" | ||||||
|  | 
 | ||||||
|  | #include "apps/openmw/mwrender/sky.hpp" | ||||||
|  | #include "apps/openmw/mwrender/interior.hpp" | ||||||
|  | 
 | ||||||
|  | namespace OMW | ||||||
|  | { | ||||||
|  |     World::World (Render::OgreRenderer& renderer, const boost::filesystem::path& dataDir, | ||||||
|  |         const std::string& master, const std::string& startCell) | ||||||
|  |     : mSkyManager (0), mScene (renderer), mPlayerPos (mScene.getCamera()) | ||||||
|  |     {    | ||||||
|  |         boost::filesystem::path masterPath (dataDir); | ||||||
|  |         masterPath /= master; | ||||||
|  |          | ||||||
|  |         std::cout << "Loading ESM " << masterPath.string() << "\n"; | ||||||
|  | 
 | ||||||
|  |         // This parses the ESM file and loads a sample cell
 | ||||||
|  |         mEsm.open (masterPath.file_string()); | ||||||
|  |         mStore.load (mEsm); | ||||||
|  |          | ||||||
|  |         mInteriors[startCell].loadInt (startCell, mStore, mEsm); | ||||||
|  |          | ||||||
|  |         std::cout << "\nSetting up cell rendering\n"; | ||||||
|  | 
 | ||||||
|  |         // This connects the cell data with the rendering scene.
 | ||||||
|  |         mActiveCells.insert (std::make_pair (&mInteriors[startCell], | ||||||
|  |             new MWRender::InteriorCellRender (mInteriors[startCell], mScene))); | ||||||
|  |          | ||||||
|  |         // Load the cell and insert it into the renderer
 | ||||||
|  |         for (CellRenderCollection::iterator iter (mActiveCells.begin()); | ||||||
|  |             iter!=mActiveCells.end(); ++iter) | ||||||
|  |             iter->second->show(); | ||||||
|  | 
 | ||||||
|  |         // Optionally enable the sky
 | ||||||
|  | //        if (mEnableSky)
 | ||||||
|  | //            mpSkyManager = MWRender::SkyManager::create(renderer.getWindow(), mScene.getCamera());
 | ||||||
|  |          | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     World::~World() | ||||||
|  |     { | ||||||
|  |         for (CellRenderCollection::iterator iter (mActiveCells.begin()); | ||||||
|  |             iter!=mActiveCells.end(); ++iter) | ||||||
|  |             delete iter->second; | ||||||
|  |              | ||||||
|  |         for (CellRenderCollection::iterator iter (mBufferedCells.begin()); | ||||||
|  |             iter!=mBufferedCells.end(); ++iter) | ||||||
|  |             delete iter->second; | ||||||
|  |                          | ||||||
|  |         delete mSkyManager; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     MWRender::PlayerPos& World::getPlayerPos() | ||||||
|  |     { | ||||||
|  |         return mPlayerPos; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										59
									
								
								apps/openmw/world.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								apps/openmw/world.hpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,59 @@ | ||||||
|  | #ifndef WORLD_H | ||||||
|  | #define WORLD_H | ||||||
|  | 
 | ||||||
|  | #include <vector> | ||||||
|  | #include <map> | ||||||
|  | 
 | ||||||
|  | #include <boost/filesystem.hpp> | ||||||
|  | 
 | ||||||
|  | #include "components/esm_store/cell_store.hpp" | ||||||
|  | 
 | ||||||
|  | #include "apps/openmw/mwrender/playerpos.hpp" | ||||||
|  | #include "apps/openmw/mwrender/mwscene.hpp" | ||||||
|  | 
 | ||||||
|  | namespace Render | ||||||
|  | { | ||||||
|  |     class OgreRenderer; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | namespace MWRender | ||||||
|  | { | ||||||
|  |     class SkyManager; | ||||||
|  |     class CellRender; | ||||||
|  | } | ||||||
|  |   | ||||||
|  | namespace OMW | ||||||
|  | { | ||||||
|  |     /// \brief The game world and its visual representation
 | ||||||
|  |      | ||||||
|  |     class World | ||||||
|  |     { | ||||||
|  |             typedef std::map<ESMS::CellStore *, MWRender::CellRender *> CellRenderCollection; | ||||||
|  |      | ||||||
|  |             MWRender::SkyManager* mSkyManager; | ||||||
|  |             MWRender::MWScene mScene; | ||||||
|  |             MWRender::PlayerPos mPlayerPos; | ||||||
|  |             CellRenderCollection mActiveCells; | ||||||
|  |             CellRenderCollection mBufferedCells; // loaded, but not active (buffering not implementd yet)
 | ||||||
|  |             ESM::ESMReader mEsm; | ||||||
|  |             ESMS::ESMStore mStore; | ||||||
|  |             std::map<std::string, ESMS::CellStore> mInteriors; | ||||||
|  |      | ||||||
|  |             // not implemented
 | ||||||
|  |             World (const World&); | ||||||
|  |             World& operator= (const World&); | ||||||
|  |      | ||||||
|  |         public: | ||||||
|  |          | ||||||
|  |             World (Render::OgreRenderer& renderer, const boost::filesystem::path& master, | ||||||
|  |                 const std::string& dataDir, const std::string& startCell); | ||||||
|  |                  | ||||||
|  |             ~World(); | ||||||
|  |              | ||||||
|  |             MWRender::PlayerPos& getPlayerPos(); | ||||||
|  |      | ||||||
|  |      | ||||||
|  |     }; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
| namespace Compiler | namespace Compiler | ||||||
| { | { | ||||||
|     class Scanner; |     class Scanner; | ||||||
|     class TokenLoc; |     struct TokenLoc; | ||||||
|     class ErrorHandler; |     class ErrorHandler; | ||||||
|     class Context; |     class Context; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue