CpuMeshResource.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <AnKi/Resource/ResourceObject.h>
  7. #include <AnKi/Math.h>
  8. #include <AnKi/Util/WeakArray.h>
  9. #include <AnKi/Physics/PhysicsCollisionShape.h>
  10. namespace anki {
  11. /// @addtogroup resource
  12. /// @{
  13. /// CPU Mesh Resource. It contains the geometry packed in CPU buffers.
  14. class CpuMeshResource : public ResourceObject
  15. {
  16. public:
  17. /// Default constructor
  18. CpuMeshResource(ResourceManager* manager);
  19. ~CpuMeshResource();
  20. /// Load from a mesh file
  21. ANKI_USE_RESULT Error load(const ResourceFilename& filename, Bool async);
  22. ConstWeakArray<Vec3> getPositions() const
  23. {
  24. return m_positions;
  25. }
  26. ConstWeakArray<U32> getIndices() const
  27. {
  28. return m_indices;
  29. }
  30. const PhysicsCollisionShapePtr& getCollisionShape() const
  31. {
  32. return m_physicsShape;
  33. }
  34. private:
  35. DynamicArray<Vec3> m_positions;
  36. DynamicArray<U32> m_indices;
  37. PhysicsCollisionShapePtr m_physicsShape;
  38. };
  39. /// @}
  40. } // namespace anki