Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 167 vs 168 for /trunk/Source Code/Managers/Headers/SceneManager.h

Diff revisions: vs.
  @@ -28,7 +28,7 @@
28 28 #include <boost/functional/factory.hpp>
29 29
30 30 enum RenderStage;
31 - DEFINE_SINGLETON(SceneManager)
31 + DEFINE_SINGLETON_EXT1(SceneManager, FrameListener)
32 32
33 33 public:
34 34 ///Lookup the factory methods table and return the pointer to a newly constructed scene bound to that name
  @@ -36,21 +36,23 @@
36 36
37 37 inline Scene* getActiveScene() { return _activeScene; }
38 38 inline void setActiveScene(Scene* const scene) { SAFE_UPDATE(_activeScene, scene); }
39 +
40 + bool init();
39 41
40 42 /*Base Scene Operations*/
41 43 void render(const RenderStage& stage);
42 44 inline void idle() { _activeScene->idle(); }
43 45 inline bool unloadCurrentScene() { return _activeScene->unload(); }
44 - bool load(const std::string& name, const vec2<U16>& resolution, Camera* const camera);
46 + bool load(const std::string& name, const vec2<U16>& resolution, CameraManager* const cameraMgr);
45 47 ///Check if the scene was loaded properly
46 - inline bool checkLoadFlag() {return _activeScene->checkLoadFlag();}
48 + inline bool checkLoadFlag() const {return _activeScene->checkLoadFlag();}
47 49 ///Create AI entities, teams, NPC's etc
48 50 inline bool initializeAI(bool continueOnErrors) { return _activeScene->initializeAI(continueOnErrors); }
49 51 ///Destroy all AI entities, teams, NPC's createa in "initializeAI"
50 52 ///AIEntities are deleted automatically by the AIManager if they are not freed in "deinitializeAI"
51 53 inline bool deinitializeAI(bool continueOnErrors) { return _activeScene->deinitializeAI(continueOnErrors); }
52 54 /// Update animations, network data, sounds, triggers etc.
53 - inline void updateCamera(Camera* const camera) { _activeScene->renderState()->updateCamera(camera); }
55 + inline void updateCameras() { _activeScene->updateCameras();}
54 56 inline void updateSceneState(const U32 sceneTime) { _activeScene->updateSceneState(sceneTime); }
55 57 inline void preRender() { _activeScene->preRender(); }
56 58 inline void postRender() { _activeScene->postRender(); }
  @@ -67,12 +69,18 @@
67 69 return true;
68 70 }
69 71
70 - private:
71 - typedef Unordered_map<std::string, Scene*> SceneMap;
72 + protected:
73 + ///This is inherited from FrameListener and is used to setup cameras before rendering the frame
74 + bool framePreRenderStarted(const FrameEvent& evt);
72 75
76 + private:
73 77 SceneManager();
74 78 ~SceneManager();
75 79
80 + private:
81 + typedef Unordered_map<std::string, Scene*> SceneMap;
82 + boost::function0<void> _renderFunction;
83 + bool _init;
76 84 ///Pointer to the currently active scene
77 85 Scene* _activeScene;
78 86 ///Scene pool
  @@ -87,4 +95,8 @@
87 95 return SceneManager::getInstance().getActiveScene();
88 96 }
89 97
98 + ///Return a pointer to the curently active scene's scenegraph
99 + inline SceneGraph* GET_ACTIVE_SCENEGRAPH() {
100 + return GET_ACTIVE_SCENE()->getSceneGraph();
101 + }
90 102 #endif