StaticGeometryNode.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef ANKI_SCENE_STATIC_GEOMETRY_NODE_H
  2. #define ANKI_SCENE_STATIC_GEOMETRY_NODE_H
  3. #include "anki/scene/Common.h"
  4. #include "anki/scene/SceneNode.h"
  5. #include "anki/scene/SpatialComponent.h"
  6. #include "anki/scene/RenderComponent.h"
  7. namespace anki {
  8. /// @addtogroup Scene
  9. /// @{
  10. /// Part of the static geometry. Used only for visibility tests
  11. class StaticGeometrySpatial: public SpatialComponent
  12. {
  13. public:
  14. /// @name Constructors/Destructor
  15. /// @{
  16. /// @note The node is only to steal the allocator
  17. StaticGeometrySpatial(const Obb* obb, SceneNode& node);
  18. /// @}
  19. };
  20. /// Static geometry scene node patch
  21. class StaticGeometryPatchNode: public SceneNode, public SpatialComponent,
  22. public RenderComponent
  23. {
  24. public:
  25. /// @name Constructors/Destructor
  26. /// @{
  27. StaticGeometryPatchNode(
  28. const char* name, SceneGraph* scene, // Scene
  29. const ModelPatchBase* modelPatch); // Self
  30. ~StaticGeometryPatchNode();
  31. /// @}
  32. /// @name RenderComponent virtuals
  33. /// @{
  34. /// Implements RenderComponent::getRenderingData
  35. void getRenderingData(
  36. const PassLodKey& key,
  37. const Vao*& vao, const ShaderProgram*& prog,
  38. const U32* subMeshIndicesArray, U subMeshIndicesCount,
  39. Array<U32, ANKI_MAX_MULTIDRAW_PRIMITIVES>& indicesCountArray,
  40. Array<const void*, ANKI_MAX_MULTIDRAW_PRIMITIVES>& indicesOffsetArray,
  41. U32& drawcallCount) const
  42. {
  43. modelPatch->getRenderingDataSub(key, vao, prog,
  44. subMeshIndicesArray, subMeshIndicesCount,
  45. indicesCountArray, indicesOffsetArray, drawcallCount);
  46. }
  47. /// Implements RenderComponent::getMaterial
  48. const Material& getMaterial()
  49. {
  50. return modelPatch->getMaterial();
  51. }
  52. /// @}
  53. private:
  54. const ModelPatchBase* modelPatch;
  55. };
  56. /// Static geometry scene node
  57. class StaticGeometryNode: public SceneNode
  58. {
  59. public:
  60. StaticGeometryNode(
  61. const char* name, SceneGraph* scene, // Scene
  62. const char* filename); // Self
  63. ~StaticGeometryNode();
  64. private:
  65. ModelResourcePointer model;
  66. SceneVector<StaticGeometryPatchNode*> patches;
  67. };
  68. /// @}
  69. } // end namespace anki
  70. #endif