16class IMeshRenderResources;
100 std::vector<glm::vec2> texCoords,
101 std::vector<glm::vec4> colors,
102 std::vector<std::uint32_t> indices);
142 const std::vector<glm::vec3>&
GetPositions()
const {
return mPositions; }
147 const std::vector<glm::vec4>&
GetColors()
const {
return mColor; }
152 const std::vector<glm::vec3>&
GetNormals()
const {
return mNormals; }
157 const std::vector<glm::vec2>&
GetTexCoords()
const {
return mTexCoords; }
162 const std::vector<glm::vec3>&
GetTangents()
const {
return mTangents; }
167 const std::vector<uint32_t>&
GetIndices()
const {
return mIndices; }
176 void LoadModel(std::vector<uint8_t>
const& fileBytes);
206 std::vector<glm::vec2> mPositions2D;
207 std::vector<glm::vec3> mPositions;
208 std::vector<glm::vec4> mColor;
209 std::vector<glm::vec3> mNormals;
210 std::vector<glm::vec2> mTexCoords;
211 std::vector<glm::vec3> mTangents;
212 std::vector<uint32_t> mIndices;
214 size_t mSizeOfVerticesBytes;
215 size_t mSizeOfIndicesBytes;
217 std::unique_ptr<IMeshRenderResources> mGpuHandle;
Interface for GPU mesh resource management.
Defines an abstract interface for rendering backends.
Manages mesh data in RAM and GPU, including upload and release operations.
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.
void LoadCustomMesh(std::vector< glm::vec2 > positions2D, std::vector< glm::vec2 > texCoords, std::vector< glm::vec4 > colors, std::vector< std::uint32_t > indices)
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.
2D drawable component for rendering textured quad.
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).