diff --git a/src/IndexedMesh.h b/src/IndexedMesh.h index 94def6a36..a9c6647a9 100644 --- a/src/IndexedMesh.h +++ b/src/IndexedMesh.h @@ -44,9 +44,15 @@ class IndexedMesh: public Mesh { /** @brief Index count */ inline GLsizei indexCount() const { return _indexCount; } + /** @brief Set index count */ + inline void setIndexCount(GLsizei count) { _indexCount = count; } + /** @brief Index type */ inline GLenum indexType() const { return _indexType; } + /** @brief Set index type */ + inline void setIndexType(GLsizei type) { _indexType = type; } + /** * @brief Index buffer * diff --git a/src/Mesh.h b/src/Mesh.h index a739da0e6..7c6641364 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -94,12 +94,32 @@ class Mesh { */ virtual ~Mesh(); + /** + * @brief Whether the mesh is finalized + * + * When the mesh is finalized, no new attributes can be bound. + */ + inline bool isFinalized() const { return finalized; } + /** @brief Primitive type */ inline Primitive primitive() const { return _primitive; } + /** @brief Set primitive type */ + inline void setPrimitive(Primitive primitive) { _primitive = primitive; } + /** @brief Vertex count */ inline GLsizei vertexCount() const { return _vertexCount; } + /** + * @brief Set vertex count + * + * This forces recalculation of attribute positions upon next drawing. + */ + inline void setVertexCount(GLsizei vertexCount) { + _vertexCount = vertexCount; + finalized = false; + }; + /** * @brief Add buffer * @param interleaved If storing more than one attribute data in the @@ -166,6 +186,14 @@ class Mesh { */ void finalize(); + /** + * @brief Set the mesh dirty + * + * Sets the attribute locations in buffers as dirty, so they are + * recalculated on next drawing. + */ + inline void setDirty() { finalized = false; } + private: Primitive _primitive; GLsizei _vertexCount;