|
|
|
@ -385,9 +385,7 @@ class MAGNUM_EXPORT Mesh { |
|
|
|
* @see setPrimitive(), setVertexCount(), @fn_gl{GenVertexArrays} (if |
|
|
|
* @see setPrimitive(), setVertexCount(), @fn_gl{GenVertexArrays} (if |
|
|
|
* @extension{APPLE,vertex_array_object} is available) |
|
|
|
* @extension{APPLE,vertex_array_object} is available) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inline explicit Mesh(Primitive primitive = Primitive::Triangles): _primitive(primitive), _vertexCount(0) { |
|
|
|
explicit Mesh(Primitive primitive = Primitive::Triangles); |
|
|
|
(this->*createImplementation)(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @brief Move constructor */ |
|
|
|
/** @brief Move constructor */ |
|
|
|
Mesh(Mesh&& other); |
|
|
|
Mesh(Mesh&& other); |
|
|
|
@ -435,6 +433,36 @@ class MAGNUM_EXPORT Mesh { |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @brief Index count */ |
|
|
|
|
|
|
|
inline GLsizei indexCount() const { return _indexCount; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @brief Set index count |
|
|
|
|
|
|
|
* @return Pointer to self (for method chaining) |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Default is zero. |
|
|
|
|
|
|
|
* @see setIndexBuffer(), setIndexType(), MeshTools::compressIndices() |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
inline Mesh* setIndexCount(GLsizei count) { |
|
|
|
|
|
|
|
_indexCount = count; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @brief Index type */ |
|
|
|
|
|
|
|
inline IndexType indexType() const { return _indexType; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @brief Set index type |
|
|
|
|
|
|
|
* @return Pointer to self (for method chaining) |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* Default is @ref IndexType "IndexType::UnsignedInt". |
|
|
|
|
|
|
|
* @see setIndexBuffer(), setIndexCount(), MeshTools::compressIndices() |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
inline Mesh* setIndexType(IndexType type) { |
|
|
|
|
|
|
|
_indexType = type; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Add buffer with non-interleaved vertex attributes for use with given shader |
|
|
|
* @brief Add buffer with non-interleaved vertex attributes for use with given shader |
|
|
|
* @return Pointer to self (for method chaining) |
|
|
|
* @return Pointer to self (for method chaining) |
|
|
|
@ -716,7 +744,7 @@ class MAGNUM_EXPORT Mesh { |
|
|
|
typedef void(Mesh::*CreateImplementation)(); |
|
|
|
typedef void(Mesh::*CreateImplementation)(); |
|
|
|
void MAGNUM_LOCAL createImplementationDefault(); |
|
|
|
void MAGNUM_LOCAL createImplementationDefault(); |
|
|
|
void MAGNUM_LOCAL createImplementationVAO(); |
|
|
|
void MAGNUM_LOCAL createImplementationVAO(); |
|
|
|
static CreateImplementation createImplementation; |
|
|
|
static MAGNUM_LOCAL CreateImplementation createImplementation; |
|
|
|
|
|
|
|
|
|
|
|
typedef void(Mesh::*DestroyImplementation)(); |
|
|
|
typedef void(Mesh::*DestroyImplementation)(); |
|
|
|
void MAGNUM_LOCAL destroyImplementationDefault(); |
|
|
|
void MAGNUM_LOCAL destroyImplementationDefault(); |
|
|
|
@ -762,6 +790,9 @@ class MAGNUM_EXPORT Mesh { |
|
|
|
GLuint vao; |
|
|
|
GLuint vao; |
|
|
|
Primitive _primitive; |
|
|
|
Primitive _primitive; |
|
|
|
GLsizei _vertexCount; |
|
|
|
GLsizei _vertexCount; |
|
|
|
|
|
|
|
Buffer* _indexBuffer; |
|
|
|
|
|
|
|
GLsizei _indexCount; |
|
|
|
|
|
|
|
IndexType _indexType; |
|
|
|
|
|
|
|
|
|
|
|
std::vector<Attribute> attributes; |
|
|
|
std::vector<Attribute> attributes; |
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
|