fix Mesh
This commit is contained in:
parent
2327f0ddf8
commit
99f1594645
@ -21,8 +21,8 @@ Mesh::Mesh(const MeshData& data)
|
|||||||
|
|
||||||
Mesh::Mesh(const float* vertexBuffer, size_t vertices, const int* indexBuffer, size_t indices, const vattr* attrs) :
|
Mesh::Mesh(const float* vertexBuffer, size_t vertices, const int* indexBuffer, size_t indices, const vattr* attrs) :
|
||||||
ibo(0),
|
ibo(0),
|
||||||
vertices(vertices),
|
vertices(0),
|
||||||
indices(indices)
|
indices(0)
|
||||||
{
|
{
|
||||||
meshesCount++;
|
meshesCount++;
|
||||||
vertexSize = 0;
|
vertexSize = 0;
|
||||||
@ -74,7 +74,7 @@ void Mesh::reload(const float* vertexBuffer, size_t vertices, const int* indexBu
|
|||||||
this->indices = indices;
|
this->indices = indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::draw(unsigned int primitive){
|
void Mesh::draw(unsigned int primitive) const {
|
||||||
drawCalls++;
|
drawCalls++;
|
||||||
glBindVertexArray(vao);
|
glBindVertexArray(vao);
|
||||||
if (ibo != 0) {
|
if (ibo != 0) {
|
||||||
@ -86,6 +86,6 @@ void Mesh::draw(unsigned int primitive){
|
|||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::draw() {
|
void Mesh::draw() const {
|
||||||
draw(GL_TRIANGLES);
|
draw(GL_TRIANGLES);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,10 +28,10 @@ public:
|
|||||||
|
|
||||||
/// @brief Draw mesh with specified primitives type
|
/// @brief Draw mesh with specified primitives type
|
||||||
/// @param primitive primitives type
|
/// @param primitive primitives type
|
||||||
void draw(unsigned int primitive);
|
void draw(unsigned int primitive) const;
|
||||||
|
|
||||||
/// @brief Draw mesh as triangles
|
/// @brief Draw mesh as triangles
|
||||||
void draw();
|
void draw() const;
|
||||||
|
|
||||||
/// @brief Total numbers of alive mesh objects
|
/// @brief Total numbers of alive mesh objects
|
||||||
static int meshesCount;
|
static int meshesCount;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user