|
Engine²
Open-source game engine written in C++.
|
#include <Mesh.hpp>
Public Member Functions | |
| Mesh ()=default | |
| ~Mesh () | |
| Mesh (Mesh &&other) noexcept | |
| Mesh & | operator= (Mesh &&other) noexcept |
| Mesh (const Mesh &other) | |
| Mesh & | operator= (const Mesh &other) |
| const std::vector< glm::vec3 > & | GetVertices () const |
| const std::vector< glm::vec3 > & | GetNormals () const |
| const std::vector< glm::vec2 > & | GetTexCoords () const |
| const std::vector< uint32_t > & | GetIndices () const |
| void | SetVertices (const std::vector< glm::vec3 > &newVertices) |
| void | SetVertexAt (size_t index, const glm::vec3 &vertex) |
| void | ReserveVertices (size_t count) |
| template<typename... Args> | |
| void | EmplaceVertices (Args &&...args) |
| void | SetNormals (const std::vector< glm::vec3 > &newNormals) |
| void | SetNormalAt (size_t index, const glm::vec3 &normal) |
| void | ReserveNormals (size_t count) |
| template<typename... Args> | |
| void | EmplaceNormals (Args &&...args) |
| void | SetTexCoords (const std::vector< glm::vec2 > &newTexCoords) |
| void | SetTexCoordAt (size_t index, const glm::vec2 &texCoord) |
| void | ReserveTexCoords (size_t count) |
| template<typename... Args> | |
| void | EmplaceTexCoords (Args &&...args) |
| void | SetIndices (const std::vector< uint32_t > &newIndices) |
| void | SetIndexAt (size_t index, uint32_t indexValue) |
| void | ReserveIndices (size_t count) |
| template<typename... Args> | |
| void | EmplaceIndices (Args &&...args) |
| bool | IsDirty () const |
| Check if the mesh data has been modified since last GPU sync. | |
| void | ClearDirty () const |
| Clear the dirty flag after GPU buffer has been updated. | |
Private Attributes | |
| std::vector< glm::vec3 > | vertices {} |
| std::vector< glm::vec3 > | normals {} |
| std::vector< glm::vec2 > | texCoords {} |
| std::vector< uint32_t > | indices {} |
| bool | _dirty = false |
| Dirty flag for GPU synchronization optimization. | |
Mesh structure.
This structure is used to represent a mesh. It contains the vertices and indices of the mesh.
The mesh supports a dirty flag mechanism for efficient GPU updates. When mesh data is modified through the setter methods (SetVertices, SetVertexAt, etc.), the dirty flag is automatically set to signal that the GPU buffer needs to be updated.
|
explicitdefault |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
Clear the dirty flag after GPU buffer has been updated.
Called by the graphics system after successfully updating the GPU buffer to indicate the mesh is now in sync.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
Check if the mesh data has been modified since last GPU sync.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
mutableprivate |
Dirty flag for GPU synchronization optimization.
Mutable to allow modification tracking on const mesh references. When true, indicates that mesh data has changed and the GPU buffer needs to be updated.
|
private |
|
private |
|
private |
|
private |