BsCoreSceneManager.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #pragma once
  5. #include "BsCorePrerequisites.h"
  6. #include "BsModule.h"
  7. #include "BsGameObject.h"
  8. namespace BansheeEngine
  9. {
  10. /**
  11. * @brief Manages all objects in the scene and provides various query methods
  12. * for finding objects. This is just the base class with basic query
  13. * functionality. You should override it with your own version that
  14. * implements a spatial data structure of your choice for faster queries.
  15. */
  16. class BS_CORE_EXPORT CoreSceneManager : public Module<CoreSceneManager>
  17. {
  18. public:
  19. CoreSceneManager();
  20. virtual ~CoreSceneManager();
  21. /**
  22. * @brief Returns the root scene object.
  23. */
  24. HSceneObject getRootNode() const { return mRootNode; }
  25. /**
  26. * @brief Called every frame.
  27. *
  28. * @note Internal method.
  29. */
  30. virtual void _update();
  31. protected:
  32. friend class SceneObject;
  33. /**
  34. * @brief Register a new node in the scene manager, on the top-most level of the hierarchy.
  35. *
  36. * @note After you add a node in the scene manager, it takes ownership of its memory and is responsible for releasing it.
  37. * 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.
  38. *
  39. * @param [in] node Node you wish to add. It's your responsibility not to add duplicate or null nodes. This method won't check.
  40. */
  41. void registerNewSO(const HSceneObject& node);
  42. /**
  43. * @brief SceneObjects call this when they have a component added to them.
  44. */
  45. virtual void notifyComponentAdded(const HComponent& component);
  46. /**
  47. * @brief SceneObjects call this when they have a component removed from them.
  48. */
  49. virtual void notifyComponentRemoved(const HComponent& component);
  50. protected:
  51. HSceneObject mRootNode;
  52. };
  53. /**
  54. * @brief Provides easy access to the scene manager.
  55. */
  56. BS_CORE_EXPORT CoreSceneManager& gSceneManager();
  57. }