OpenMW
apps/openmw/mwworld/scene.hpp
Go to the documentation of this file.
00001 #ifndef GAME_MWWORLD_SCENE_H
00002 #define GAME_MWWORLD_SCENE_H
00003 
00004 #include "../mwrender/renderingmanager.hpp"
00005 
00006 #include "ptr.hpp"
00007 #include "globals.hpp"
00008 
00009 namespace Ogre
00010 {
00011     class Vector3;
00012 }
00013 
00014 namespace ESM
00015 {
00016     struct Position;
00017 }
00018 
00019 namespace Files
00020 {
00021     class Collections;
00022 }
00023 
00024 namespace Render
00025 {
00026     class OgreRenderer;
00027 }
00028 
00029 namespace MWRender
00030 {
00031     class SkyManager;
00032     class CellRender;
00033 }
00034 
00035 namespace MWWorld
00036 {
00037     class PhysicsSystem;
00038     class Player;
00039     class CellStore;
00040 
00041     class Scene
00042     {
00043         public:
00044 
00045             typedef std::set<CellStore *> CellStoreCollection;
00046 
00047         private:
00048 
00049             //OEngine::Render::OgreRenderer& mRenderer;
00050             CellStore* mCurrentCell; // the cell the player is in
00051             CellStoreCollection mActiveCells;
00052             bool mCellChanged;
00053             PhysicsSystem *mPhysics;
00054             MWRender::RenderingManager& mRendering;
00055 
00056             void playerCellChange (CellStore *cell, const ESM::Position& position,
00057                 bool adjustPlayerPos = true);
00058 
00059             void insertCell (Ptr::CellStore &cell, bool rescale, Loading::Listener* loadingListener);
00060 
00061             int countRefs (const Ptr::CellStore& cell);
00062 
00063         public:
00064 
00065             Scene (MWRender::RenderingManager& rendering, PhysicsSystem *physics);
00066 
00067             ~Scene();
00068 
00069             void unloadCell (CellStoreCollection::iterator iter);
00070 
00071             void loadCell (CellStore *cell, Loading::Listener* loadingListener);
00072 
00073             void changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos);
00074 
00075             CellStore* getCurrentCell ();
00076 
00077             const CellStoreCollection& getActiveCells () const;
00078 
00079             bool hasCellChanged() const;
00081 
00082             void changeToInteriorCell (const std::string& cellName, const ESM::Position& position);
00084 
00085             void changeToExteriorCell (const ESM::Position& position);
00087 
00088             void changeToVoid();
00090 
00091             void markCellAsUnchanged();
00092 
00093             void update (float duration, bool paused);
00094 
00095             void addObjectToScene (const Ptr& ptr);
00097 
00098             void removeObjectFromScene (const Ptr& ptr);
00100 
00101             bool isCellActive(const CellStore &cell);
00102     };
00103 }
00104 
00105 #endif