2
0

CmTransientMesh.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. #include "CmMeshBase.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Represents a single mesh entry in the MeshHeap. This can be used as a normal mesh
  8. * but due to the nature of the mesh-heap it is not the type of mesh you should use
  9. * for storing static data.
  10. *
  11. * Transient meshes don't keep internal index/vertex buffers but instead use the ones
  12. * provided by their parent mesh heap.
  13. *
  14. * @see MeshHeap
  15. */
  16. class CM_EXPORT TransientMesh : public MeshBase
  17. {
  18. public:
  19. virtual ~TransientMesh();
  20. /**
  21. * @copydoc GpuResource::writeSubresource
  22. */
  23. virtual void writeSubresource(UINT32 subresourceIdx, const GpuResourceData& data, bool discardEntireBuffer);
  24. /**
  25. * @copydoc GpuResource::readSubresource
  26. */
  27. virtual void readSubresource(UINT32 subresourceIdx, GpuResourceData& data);
  28. /**
  29. * @copydoc MeshBase::getVertexData
  30. */
  31. std::shared_ptr<VertexData> _getVertexData() const;
  32. /**
  33. * @copydoc MeshBase::getIndexData
  34. */
  35. std::shared_ptr<IndexData> _getIndexData() const;
  36. /**
  37. * @copydoc MeshBase::getVertexOffset
  38. */
  39. virtual UINT32 _getVertexOffset() const;
  40. /**
  41. * @copydoc MeshBase::getIndexOffset
  42. */
  43. virtual UINT32 _getIndexOffset() const;
  44. /**
  45. * @copydoc MeshBase::notifyUsedOnGPU
  46. */
  47. virtual void _notifyUsedOnGPU();
  48. protected:
  49. friend class MeshHeap;
  50. /**
  51. * @brief Constructs a new transient mesh.
  52. *
  53. * @see MeshHeap::alloc
  54. */
  55. TransientMesh(const MeshHeapPtr& parentHeap, UINT32 id, UINT32 numIndices,
  56. UINT32 numVertices, DrawOperationType drawOp = DOT_TRIANGLE_LIST);
  57. /**
  58. * @brief Marks the mesh as destroyed so we know that we don't need to destroy it ourselves.
  59. */
  60. void markAsDestroyed() { mIsDestroyed = true; }
  61. protected:
  62. bool mIsDestroyed;
  63. MeshHeapPtr mParentHeap;
  64. UINT32 mId;
  65. };
  66. }