#ifndef Mesh_h__ #define Mesh_h__ #include #include #include #include #include "ForwardDeclarations.h" #include "Vertex.h" #include "Submesh.h" #include "Bounds.h" #include "Object.h" #include using namespace Microsoft::WRL; typedef std::function MeshProcessFunction; class Mesh : public Object { public: Mesh():_vertexCount(0) { } std::vector GetVertices(); void SetVertices(const std::vector& vertices); void SetIndices(const Submesh::index_array_t& indices, MeshTopology topology, uint32_t submeshId); void RecalculateBounds(); ID3D12ResourcePtr GetVertexBuffer(); ID3D12DevicePtr GetDevice(); static MeshPtr Create(); static MeshPtr Create(MeshProcessFunction initFunction); uint32_t GetSubmeshCount() const; void SetSubmeshCount(uint32_t count); const std::vector& GetSubmeshes(); Bounds GetBounds() const; D3D12_VERTEX_BUFFER_VIEW GetVertexBufferView(); private: size_t _vertexCount; Bounds _bounds; Mesh(ID3D12DevicePtr dev); ID3D12ResourcePtr _vertexBuffer; ID3D12DevicePtr _device; std::vector _submeshes; }; #endif // Mesh_h__