diff --git a/src/graphics/core/Batch3D.cpp b/src/graphics/core/Batch3D.cpp index 4f32ae3e..d3e369a0 100644 --- a/src/graphics/core/Batch3D.cpp +++ b/src/graphics/core/Batch3D.cpp @@ -245,7 +245,7 @@ void Batch3D::blockCube( cube((1.0f - size) * -0.5f, size, texfaces, tint, shading); } -void Batch3D::point(glm::vec3 coord, glm::vec2 uv, glm::vec4 tint) { +void Batch3D::vertex(glm::vec3 coord, glm::vec2 uv, glm::vec4 tint) { if (index + B3D_VERTEX_SIZE >= capacity) { flush(); } @@ -253,7 +253,10 @@ void Batch3D::point(glm::vec3 coord, glm::vec2 uv, glm::vec4 tint) { } void Batch3D::point(glm::vec3 coord, glm::vec4 tint) { - point(coord, glm::vec2(), tint); + if (index + B3D_VERTEX_SIZE >= capacity) { + flushPoints(); + } + vertex(coord, {}, tint.r, tint.g, tint.b, tint.a); } void Batch3D::flush() { diff --git a/src/graphics/core/Batch3D.hpp b/src/graphics/core/Batch3D.hpp index f53b0a0c..2cfe4bcc 100644 --- a/src/graphics/core/Batch3D.hpp +++ b/src/graphics/core/Batch3D.hpp @@ -52,7 +52,7 @@ public: void xSprite(float w, float h, const UVRegion& uv, const glm::vec4 tint, bool shading=true); void cube(const glm::vec3 coords, const glm::vec3 size, const UVRegion(&texfaces)[6], const glm::vec4 tint, bool shading=true); void blockCube(const glm::vec3 size, const UVRegion(&texfaces)[6], const glm::vec4 tint, bool shading=true); - void point(glm::vec3 pos, glm::vec2 uv, glm::vec4 tint); + void vertex(glm::vec3 pos, glm::vec2 uv, glm::vec4 tint); void point(glm::vec3 pos, glm::vec4 tint); void flush() override; void flushPoints(); diff --git a/src/graphics/render/BlocksPreview.cpp b/src/graphics/render/BlocksPreview.cpp index 619266bd..4c772c86 100644 --- a/src/graphics/render/BlocksPreview.cpp +++ b/src/graphics/render/BlocksPreview.cpp @@ -91,12 +91,12 @@ std::unique_ptr BlocksPreview::draw( for (size_t i = 0; i < def.modelExtraPoints.size() / 4; i++) { const UVRegion& reg = def.modelUVs[def.modelBoxes.size() * 6 + i]; - batch->point((points[i * 4 + 0] - poff) * pmul, glm::vec2(reg.u1, reg.v1), glm::vec4(1.0)); - batch->point((points[i * 4 + 1] - poff) * pmul, glm::vec2(reg.u2, reg.v1), glm::vec4(1.0)); - batch->point((points[i * 4 + 2] - poff) * pmul, glm::vec2(reg.u2, reg.v2), glm::vec4(1.0)); - batch->point((points[i * 4 + 0] - poff) * pmul, glm::vec2(reg.u1, reg.v1), glm::vec4(1.0)); - batch->point((points[i * 4 + 2] - poff) * pmul, glm::vec2(reg.u2, reg.v2), glm::vec4(1.0)); - batch->point((points[i * 4 + 3] - poff) * pmul, glm::vec2(reg.u1, reg.v2), glm::vec4(1.0)); + batch->vertex((points[i * 4 + 0] - poff) * pmul, glm::vec2(reg.u1, reg.v1), glm::vec4(1.0)); + batch->vertex((points[i * 4 + 1] - poff) * pmul, glm::vec2(reg.u2, reg.v1), glm::vec4(1.0)); + batch->vertex((points[i * 4 + 2] - poff) * pmul, glm::vec2(reg.u2, reg.v2), glm::vec4(1.0)); + batch->vertex((points[i * 4 + 0] - poff) * pmul, glm::vec2(reg.u1, reg.v1), glm::vec4(1.0)); + batch->vertex((points[i * 4 + 2] - poff) * pmul, glm::vec2(reg.u2, reg.v2), glm::vec4(1.0)); + batch->vertex((points[i * 4 + 3] - poff) * pmul, glm::vec2(reg.u1, reg.v2), glm::vec4(1.0)); } batch->flush(); }