20 #include "Attribute.h"
21 #include "AttributeArray.h"
22 #include "AttributeSet.h"
117 void setBuffer(
void* buffer,
int vertexCount);
155 return getAttributeGenericArray(name).getAsType<T>();
170 return getAttributeGenericArray(name).getAsType<T>();
179 std::unique_ptr<GLbyte> mOwnedBuffer;
180 int mVertexCount = 0;
181 int mDrawVertexCount = 0;
182 bool mBufferValid =
false;
183 bool mBufferUploaded =
false;
184 GLuint mBufferId = 0;
185 void* mBuffer =
nullptr;
bool isUploaded() const
Returns whether or not an associated GL buffer object exists and contains uploaded data...
Definition: Mesh.h:81
const Attribute & getAttribute(const char *name) const
Returns the Attribute definition with the given name, or an empty Attribute if it does not exist...
Header declaring and including types common to renderer classes such as Vector2. Also includes GL hea...
void upload()
Uploads the current vertex buffer's data into a GL buffer object.
AttributeArray< T > getAttributeArray(const char *name)
Returns the values of the vertex Attribute with the given name as a mutable AttributeArray.
Definition: Mesh.h:169
void setDrawVertexCount(int drawVertexCount)
Sets the number of vertices to draw when this Mesh is rendered.
void unbind()
Unbinds this vertex buffer.
void bind()
Bind this vertex buffer, uploading it if necessary.
void * getBuffer() const
Returns a raw pointer to the current vertex buffer.
Definition: Mesh.h:107
Mesh composed of vertices, and attributes for each vertex.
Definition: Mesh.h:36
const AttributeSetPtr & getAttributes() const
Returns the list of vertex Attributes as an AttributeSet.
Definition: Mesh.h:86
bool hasAttributeArray(const char *name) const
Returns whether or not vertices in this Mesh have an Attribute of the given name. ...
int getVertexCount() const
Returns the length of the current vertex buffer, in number of vertices.
Definition: Mesh.h:55
The definition of a vertex attribute, such as a position vector, or a texture coordinate.
Definition: Attribute.h:31
int getDrawVertexCount() const
Returns the number of vertices that will be drawn when this Mesh is rendered.
Definition: Mesh.h:131
const AttributeArray< T > getAttributeArray(const char *name) const
Returns the values of the vertex Attribute with the given name as an AttributeArray.
Definition: Mesh.h:154
std::shared_ptr< AttributeSet > AttributeSetPtr
Shared pointer typedef for AttributeSet.
Definition: PointerDeclarations.h:63
void setBuffer(void *buffer, int vertexCount)
Sets the current vertex buffer to be a user managed buffer.
Mesh(int vertexCount, const AttributeSetPtr &attributes)
Construct a mesh with the given vertex attributes and vertex count.
void allocateBuffer(int vertexCount)
Sets the current buffer to be a Mesh managed buffer.
int findAttributeIndex(const char *name) const
Returns the index of the Attribute with the given name.
void dispose()
Frees this Mesh's managed buffer, and GL buffer object, if allocated.
A helper class to access and iterate over an interleaved vertex attribute array.
Definition: AttributeArray.h:31