CpuMeshResource.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. {
  12. /// @addtogroup resource
  13. /// @{
  14. /// CPU Mesh Resource. It contains the geometry packed in CPU buffers.
  15. class CpuMeshResource : public ResourceObject
  16. {
  17. public:
  18. /// Default constructor
  19. CpuMeshResource(ResourceManager* manager);
  20. ~CpuMeshResource();
  21. /// Load from a mesh file
  22. ANKI_USE_RESULT Error load(const ResourceFilename& filename, Bool async);
  23. ConstWeakArray<Vec3> getPositions() const
  24. {
  25. return m_positions;
  26. }
  27. ConstWeakArray<U32> getIndices() const
  28. {
  29. return m_indices;
  30. }
  31. const PhysicsCollisionShapePtr& getCollisionShape() const
  32. {
  33. return m_physicsShape;
  34. }
  35. private:
  36. DynamicArray<Vec3> m_positions;
  37. DynamicArray<U32> m_indices;
  38. PhysicsCollisionShapePtr m_physicsShape;
  39. };
  40. /// @}
  41. } // namespace anki