CmSceneManager.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmModule.h"
  4. #include "CmGameObject.h"
  5. namespace CamelotEngine
  6. {
  7. /**
  8. * @brief Manages all objects in the scene and provides various query methods
  9. * for finding objects you need. This is just the base class with basic
  10. * query functionality. You should override it with your own version that
  11. * implements a spatial data structure of your choice for faster queries.
  12. */
  13. class CM_EXPORT SceneManager : public Module<SceneManager>
  14. {
  15. public:
  16. SceneManager();
  17. virtual ~SceneManager();
  18. HSceneObject getRootNode() const { return mRootNode; }
  19. virtual void update();
  20. /**
  21. * @brief Returns all cameras in the scene.
  22. */
  23. const vector<HCamera>::type& getAllCameras() const { return mCachedCameras; }
  24. vector<HRenderable>::type getVisibleRenderables(const HCamera& camera) const;
  25. private:
  26. friend class SceneObject;
  27. HSceneObject mRootNode;
  28. /**
  29. * @brief Register a new node in the scene manager, on the top-most level of the hierarchy.
  30. *
  31. * @note After you add a node in the scene manager, it takes ownership of its memory and is responsible for releasing it.
  32. * Do NOT add nodes that have already been added (i.e. if you just want to change their parent). Normally this method will only be called by SceneObject.
  33. *
  34. * @param [in] node Node you wish to add. It's your responsibility not to add duplicate or null nodes. This method won't check.
  35. */
  36. void registerNewGO(const HSceneObject& node);
  37. void notifyComponentAdded(const HComponent& component);
  38. void notifyComponentRemoved(const HComponent& component);
  39. vector<HCamera>::type mCachedCameras;
  40. };
  41. CM_EXPORT SceneManager& gSceneManager();
  42. }