CmSceneManager.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmModule.h"
  4. #include "CmGameObject.h"
  5. namespace CamelotFramework
  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. protected:
  21. friend class SceneObject;
  22. HSceneObject mRootNode;
  23. /**
  24. * @brief Register a new node in the scene manager, on the top-most level of the hierarchy.
  25. *
  26. * @note After you add a node in the scene manager, it takes ownership of its memory and is responsible for releasing it.
  27. * 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.
  28. *
  29. * @param [in] node Node you wish to add. It's your responsibility not to add duplicate or null nodes. This method won't check.
  30. */
  31. void registerNewGO(const HSceneObject& node);
  32. virtual void notifyComponentAdded(const HComponent& component);
  33. virtual void notifyComponentRemoved(const HComponent& component);
  34. };
  35. CM_EXPORT SceneManager& gSceneManager();
  36. }