Grid.h 960 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef ANKI_SCENE_GRID_H
  2. #define ANKI_SCENE_GRID_H
  3. #include "anki/Collision.h"
  4. #include "anki/scene/Common.h"
  5. namespace anki {
  6. class SceneNode;
  7. class Frustumable;
  8. /// Space partitioning container
  9. class Grid
  10. {
  11. public:
  12. /// Default constructor
  13. Grid(const SceneAllocator<U8>& alloc, F32 cubeSize, const Aabb& aabb);
  14. /// @name Accessors
  15. /// @{
  16. const Aabb& getAabb() const
  17. {
  18. return aabb;
  19. }
  20. SceneVector<SceneNode*>::iterator getSceneNodesBegin()
  21. {
  22. return sceneNodes.begin();
  23. }
  24. SceneVector<SceneNode*>::iterator getSceneNodesEnd()
  25. {
  26. return sceneNodes.end();
  27. }
  28. /// @}
  29. /// Place a scene node in the grid
  30. Bool placeSceneNode(SceneNode* sn);
  31. /// XXX
  32. void getVisible(const Frustumable& cam,
  33. SceneVector<SceneNode*>& nodes);
  34. private:
  35. Aabb aabb;
  36. Array<U32, 3> cubesCount; ///< Cubes count in the 3 dimentions
  37. F32 cubeSize;
  38. SceneVector<SceneNode*> sceneNodes;
  39. void removeSceneNode(SceneNode* sn);
  40. };
  41. } // end namespace anki
  42. #endif