| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #pragma once
- #include "CmPrerequisites.h"
- #include "CmResource.h"
- #include "CmMeshData.h"
- #include "CmVertexIndexData.h"
- #include "CmRenderOperation.h"
- namespace CamelotEngine
- {
- struct CM_EXPORT SubMesh
- {
- SubMesh():
- indexOffset(0), indexCount(0)
- { }
- SubMesh(UINT32 indexOffset, UINT32 indexCount):
- indexOffset(indexOffset), indexCount(indexCount)
- { }
- UINT32 indexOffset;
- UINT32 indexCount;
- };
- class CM_EXPORT Mesh : public Resource
- {
- public:
- virtual ~Mesh();
- void initialize();
- virtual void initialize_internal();
- /**
- * @brief Mesh data that is used for initializing the mesh. Needs to be set before calling load.
- */
- void setMeshData(MeshDataPtr meshData);
- void setMeshData_internal(MeshDataPtr meshData);
- /**
- * @brief Gets the mesh data from the GPU. This method is slow so be careful when you call it.
- */
- MeshDataPtr getMeshData();
- void getMeshData_internal(AsyncOp& asyncOp);
- RenderOperation getRenderOperation(UINT32 subMeshIdx = 0) const;
- private:
- Mesh();
- VertexData* mVertexData;
- IndexData* mIndexData;
- vector<SubMesh>::type mSubMeshes;
- void throwIfNotRenderThread() const;
- /************************************************************************/
- /* SERIALIZATION */
- /************************************************************************/
- public:
- friend class MeshRTTI;
- static RTTITypeBase* getRTTIStatic();
- virtual RTTITypeBase* getRTTI() const;
- /************************************************************************/
- /* STATICS */
- /************************************************************************/
- private:
- static MeshPtr createEmpty();
- /**
- * @brief Returns empty mesh data. (Technically it is not empty,
- * as 0 sized buffers will cause problems, so it contains 3 indices
- * and 1 vertex).
- */
- static MeshDataPtr getNullMeshData();
-
- public:
- static MeshPtr create();
- };
- }
|