137 const std::vector<glm::vec3>&
GetPositions()
const {
return mPositions; }
142 const std::vector<glm::vec4>&
GetColors()
const {
return mColor; }
147 const std::vector<glm::vec3>&
GetNormals()
const {
return mNormals; }
152 const std::vector<glm::vec2>&
GetTexCoords()
const {
return mTexCoords; }
157 const std::vector<glm::vec3>&
GetTangents()
const {
return mTangents; }
162 const std::vector<uint32_t>&
GetIndices()
const {
return mIndices; }
171 void LoadModel(std::vector<uint8_t>
const& fileBytes);
201 std::vector<glm::vec2> mPositions2D;
202 std::vector<glm::vec3> mPositions;
203 std::vector<glm::vec4> mColor;
204 std::vector<glm::vec3> mNormals;
205 std::vector<glm::vec2> mTexCoords;
206 std::vector<glm::vec3> mTangents;
207 std::vector<uint32_t> mIndices;
209 size_t mSizeOfVerticesBytes;
210 size_t mSizeOfIndicesBytes;
212 std::unique_ptr<IMeshRenderResources> mGpuHandle;
Interface for GPU mesh resource management.
Defines an abstract interface for rendering backends.
size_t GetCpuIndexBufferSize() const
Get the size (in bytes) of the index buffer in RAM.
void CreateQuad2D()
Creates a 1�1 unit quad centered at the origin.
std::vector< VertexPositionColorTextureNormalTangent > ComposeLitBuffer()
Compose a vertex buffer for lit 3D meshes (with normals, tangents).
void CalculateMeshParameters()
Calculate and cache sizes of RAM buffers for statistics or debugging.
const std::vector< uint32_t > & GetIndices() const
Returns a constant reference to the mesh indices.
void LoadModel(std::string path)
Load a model from file and extract mesh data to RAM.
const std::vector< glm::vec3 > & GetTangents() const
Returns a constant reference to the vertex tangents.
size_t GetGpuIndexBufferSize() const
Get the size (in bytes) of the index buffer on GPU.
std::vector< Vertex2D > ComposeVertex2DBuffer()
Compose a vertex buffer for 2D meshes (e.g., sprites).
const std::vector< glm::vec3 > & GetNormals() const
Returns a constant reference to the vertex normals.
const std::vector< glm::vec3 > & GetPositions() const
Returns a constant reference to the 3D vertex positions.
IMeshRenderResources * GetMeshRenderResources()
Get the interface for mesh GPU resources (Vulkan or other backend).
const std::vector< glm::vec2 > & GetTexCoords() const
Returns a constant reference to the texture coordinates.
void UploadToGPU()
Upload mesh data to the GPU using the current mesh type.
bool IsOnGPU() const
Check if mesh data is currently uploaded to GPU.
std::vector< VertexPositionColorTexture > ComposeUnlitBuffer()
Compose a vertex buffer for unlit 3D meshes (e.g., billboards, particles).
const std::vector< glm::vec4 > & GetColors() const
Returns a constant reference to the vertex colors.
MeshDataGpu(IRenderer *renderer)
Constructs an empty MeshDataGpu object.
size_t GetCpuVertexBufferSize() const
Get the size (in bytes) of the vertex buffer in RAM.
~MeshDataGpu()
Destructor. Releases GPU resources if allocated.
const std::vector< glm::vec2 > & GetPositions2D() const
Returns a constant reference to the 2D vertex positions.
size_t GetGpuVertexBufferSize() const
Get the size (in bytes) of the vertex buffer on GPU.
void ReleaseFromGPU()
Release GPU resources associated with this mesh.
Represents a 3D model composed of multiple meshes and materials.
MeshType
Types of supported mesh layouts for GPU upload and rendering.
@ None
Undefined or not yet set.
@ Surface
Full 3D surface mesh (models with normals/tangents, etc.).
@ Billboard
3D billboard mesh (sprites that face the camera).