From b39a4169e3fe94f3b7c63ed820f299396add571a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 7 Mar 2026 12:56:33 +0000 Subject: Fix naming violations in Mesh They've existed and been annoying since the day I first created it from online examples. --- game/scenary/foliage.cpp | 4 ++-- game/scenary/illuminator.cpp | 2 +- game/vehicles/railVehicleClass.cpp | 12 ++++++------ game/water.cpp | 2 +- gfx/gl/billboardPainter.cpp | 2 +- gfx/gl/shadowStenciller.cpp | 2 +- gfx/models/mesh.cpp | 12 ++++++------ gfx/models/mesh.h | 30 +++++++++++++++--------------- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp index edfb0e9..bd88a06 100644 --- a/game/scenary/foliage.cpp +++ b/game/scenary/foliage.cpp @@ -113,7 +113,7 @@ Foliage::render(const SceneShader & shader, const Frustum &) const texture->bind(); } instanceVAO.useBuffer(1, instances); - bodyMesh->DrawInstanced(instanceVAO, static_cast(count)); + bodyMesh->drawInstanced(instanceVAO, static_cast(count)); } } } @@ -142,7 +142,7 @@ Foliage::shadows(const ShadowMapper & mapper, const Frustum &) const mapper.dynamicPointInst.use(); } instanceVAO.useBuffer(1, instances); - bodyMesh->DrawInstanced(instanceVAO, static_cast(count)); + bodyMesh->drawInstanced(instanceVAO, static_cast(count)); } } } diff --git a/game/scenary/illuminator.cpp b/game/scenary/illuminator.cpp index 1dd0644..0c5919a 100644 --- a/game/scenary/illuminator.cpp +++ b/game/scenary/illuminator.cpp @@ -75,7 +75,7 @@ Illuminator::render(const SceneShader & shader, const Frustum &) const texture->bind(); } instanceVAO.useBuffer(1, instances); - bodyMesh->DrawInstanced(instanceVAO, static_cast(count)); + bodyMesh->drawInstanced(instanceVAO, static_cast(count)); } } diff --git a/game/vehicles/railVehicleClass.cpp b/game/vehicles/railVehicleClass.cpp index 2bdd7c4..6e8870a 100644 --- a/game/vehicles/railVehicleClass.cpp +++ b/game/vehicles/railVehicleClass.cpp @@ -55,9 +55,9 @@ RailVehicleClass::render(const SceneShader & shader, const Frustum &) const instanceVAO.useBuffer(1, instances); instancesBogiesVAO.front().useBuffer(1, instances); instancesBogiesVAO.back().useBuffer(1, instances); - bodyMesh->DrawInstanced(instanceVAO, count); - bogies.front()->DrawInstanced(instancesBogiesVAO.front(), count); - bogies.back()->DrawInstanced(instancesBogiesVAO.back(), count); + bodyMesh->drawInstanced(instanceVAO, count); + bogies.front()->drawInstanced(instancesBogiesVAO.front(), count); + bogies.back()->drawInstanced(instancesBogiesVAO.back(), count); } } @@ -66,8 +66,8 @@ RailVehicleClass::shadows(const ShadowMapper & mapper, const Frustum &) const { if (const auto count = static_cast(instances.size())) { mapper.dynamicPointInst.use(); - bodyMesh->DrawInstanced(instanceVAO, count); - bogies.front()->DrawInstanced(instancesBogiesVAO.front(), count); - bogies.back()->DrawInstanced(instancesBogiesVAO.back(), count); + bodyMesh->drawInstanced(instanceVAO, count); + bogies.front()->drawInstanced(instancesBogiesVAO.front(), count); + bogies.back()->drawInstanced(instancesBogiesVAO.back(), count); } } diff --git a/game/water.cpp b/game/water.cpp index 0657214..0f72918 100644 --- a/game/water.cpp +++ b/game/water.cpp @@ -106,5 +106,5 @@ Water::render(const SceneShader & shader, const Frustum &) const { shader.water.use(waveCycle); water->bind(); - meshes.apply(&MeshT::Draw); + meshes.apply(&MeshT::draw); } diff --git a/gfx/gl/billboardPainter.cpp b/gfx/gl/billboardPainter.cpp index 38c4d3e..d021efb 100644 --- a/gfx/gl/billboardPainter.cpp +++ b/gfx/gl/billboardPainter.cpp @@ -90,5 +90,5 @@ BillboardPainter::renderBillBoard( const auto & view) { return this->view * view * extentsMat; }}); - mesh.Draw(); + mesh.draw(); } diff --git a/gfx/gl/shadowStenciller.cpp b/gfx/gl/shadowStenciller.cpp index cc25f30..3625524 100644 --- a/gfx/gl/shadowStenciller.cpp +++ b/gfx/gl/shadowStenciller.cpp @@ -75,5 +75,5 @@ ShadowStenciller::renderStencil(const glTexture & stencil, const MeshBase & mesh const auto & viewProjection) { return viewProjection * extentsMat; }}); - mesh.Draw(); + mesh.draw(); } diff --git a/gfx/models/mesh.cpp b/gfx/models/mesh.cpp index 2eae160..88314ae 100644 --- a/gfx/models/mesh.cpp +++ b/gfx/models/mesh.cpp @@ -1,7 +1,7 @@ #include "mesh.h" MeshBase::MeshBase(GLsizei m_numIndices, GLenum mode, const std::vector & positions) : - m_numIndices {m_numIndices}, mode {mode}, dimensions {positions} + numIndices {m_numIndices}, mode {mode}, dimensions {positions} { } @@ -29,21 +29,21 @@ MeshBase::Dimensions::extents(const std::span position } void -MeshBase::Draw() const +MeshBase::draw() const { - glBindVertexArray(m_vertexArrayObject); + glBindVertexArray(vertexArrayObject); - glDrawElements(mode, m_numIndices, GL_UNSIGNED_INT, nullptr); + glDrawElements(mode, numIndices, GL_UNSIGNED_INT, nullptr); glBindVertexArray(0); } void -MeshBase::DrawInstanced(GLuint vao, GLsizei count, GLuint base) const +MeshBase::drawInstanced(GLuint vao, GLsizei count, GLuint base) const { glBindVertexArray(vao); - glDrawElementsInstancedBaseInstance(mode, m_numIndices, GL_UNSIGNED_INT, nullptr, count, base); + glDrawElementsInstancedBaseInstance(mode, numIndices, GL_UNSIGNED_INT, nullptr, count, base); glBindVertexArray(0); } diff --git a/gfx/models/mesh.h b/gfx/models/mesh.h index e78d27e..f578625 100644 --- a/gfx/models/mesh.h +++ b/gfx/models/mesh.h @@ -15,19 +15,19 @@ public: class Dimensions { public: using Extents1D = std::ranges::minmax_result; - explicit Dimensions(const std::span); + explicit Dimensions(std::span); RelativePosition3D minExtent, maxExtent; RelativePosition3D centre; RelativeDistance size; private: - Dimensions(const std::span, const std::array &); - static Extents1D extents(const std::span, glm::length_t D); + Dimensions(std::span, const std::array &); + static Extents1D extents(std::span, glm::length_t); }; - void Draw() const; - void DrawInstanced(GLuint vao, GLsizei count, GLuint base = 0) const; + void draw() const; + void drawInstanced(GLuint vao, GLsizei count, GLuint base = 0) const; [[nodiscard]] const Dimensions & getDimensions() const @@ -36,11 +36,11 @@ public: } protected: - MeshBase(GLsizei m_numIndices, GLenum mode, const std::vector &); + MeshBase(GLsizei numIndices, GLenum mode, const std::vector &); - glVertexArray m_vertexArrayObject; - glBuffers<2> m_vertexArrayBuffers; - GLsizei m_numIndices; + glVertexArray vertexArrayObject; + glBuffers<2> vertexArrayBuffers; + GLsizei numIndices; GLenum mode; Dimensions dimensions; }; @@ -49,19 +49,19 @@ template class MeshT : public MeshBase, public ConstTypeDefs vertices, const std::span indices, GLenum mode = GL_TRIANGLES) : MeshBase {static_cast(indices.size()), mode, - materializeRange(vertices | std::views::transform([](const auto & v) { - return static_cast(v.pos); + materializeRange(vertices | std::views::transform([](const auto & vertex) { + return static_cast(vertex.pos); }))} { - m_vertexArrayBuffers[0].storage(vertices, 0); - m_vertexArrayBuffers[1].storage(indices, 0); - configureVAO(m_vertexArrayObject, 0); + vertexArrayBuffers[0].storage(vertices, 0); + vertexArrayBuffers[1].storage(indices, 0); + configureVAO(vertexArrayObject, 0); } auto configureVAO(glVertexArray & vao, GLuint divisor) const { - return vao.configure().addAttribsFor(divisor, m_vertexArrayBuffers[0]).addIndices(m_vertexArrayBuffers[1]); + return vao.configure().addAttribsFor(divisor, vertexArrayBuffers[0]).addIndices(vertexArrayBuffers[1]); } }; -- cgit v1.3