Browse Source

Allow modifying mesh vertex/index count and type.

vectorfields
Vladimír Vondruš 16 years ago
parent
commit
12783de1ec
  1. 6
      src/IndexedMesh.h
  2. 28
      src/Mesh.h

6
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
*

28
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;

Loading…
Cancel
Save