From f2654cf7d46b0e55d288cc48bdd6af872fb021f4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 2 May 2021 14:44:31 +0100 Subject: Fix warnings produced by new clang-tidy --- gfx/manualCameraController.cpp | 6 +++--- gfx/models/mesh.cpp | 16 ++++++++++------ gfx/models/mesh.h | 3 +-- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'gfx') diff --git a/gfx/manualCameraController.cpp b/gfx/manualCameraController.cpp index 21eefc8..268920a 100644 --- a/gfx/manualCameraController.cpp +++ b/gfx/manualCameraController.cpp @@ -43,8 +43,8 @@ ManualCameraController::handleInput(SDL_Event & e) case SDL_MOUSEMOTION: if (mrb) { if (ctrl) { - direction -= 0.01F * e.motion.xrel; - pitch = std::clamp(pitch - 0.01F * e.motion.yrel, 0.1F, half_pi); + direction -= 0.01F * (float)e.motion.xrel; + pitch = std::clamp(pitch - 0.01F * (float)e.motion.yrel, 0.1F, half_pi); } else { focus += rotate_flat(-direction) * glm::vec2 {e.motion.xrel, e.motion.yrel}; @@ -52,7 +52,7 @@ ManualCameraController::handleInput(SDL_Event & e) } return true; case SDL_MOUSEWHEEL: - dist = std::clamp(dist - e.wheel.y * 4.F, 5.F, 200.F); + dist = std::clamp(dist - (float)e.wheel.y * 4.F, 5.F, 200.F); break; } return false; diff --git a/gfx/models/mesh.cpp b/gfx/models/mesh.cpp index 0834394..52ce6bb 100644 --- a/gfx/models/mesh.cpp +++ b/gfx/models/mesh.cpp @@ -1,8 +1,11 @@ #include "mesh.h" #include "vertex.hpp" +#include + +#define offset_ptr(T, m) (((char *)1) + offsetof(T, m) - 1) Mesh::Mesh(const std::span vertices, const std::span indices, GLenum m) : - m_vertexArrayObject {}, m_vertexArrayBuffers {}, m_numIndices {indices.size()}, mode {m} + m_vertexArrayObject {}, m_vertexArrayBuffers {}, m_numIndices {(GLsizei)indices.size()}, mode {m} { glGenVertexArrays(1, &m_vertexArrayObject); glBindVertexArray(m_vertexArrayObject); @@ -10,19 +13,20 @@ Mesh::Mesh(const std::span vertices, const std::span #include -#include #include #include #include @@ -27,7 +26,7 @@ private: GLuint m_vertexArrayObject; std::array m_vertexArrayBuffers; - size_t m_numIndices; + GLsizei m_numIndices; GLenum mode; }; using MeshPtr = std::shared_ptr; -- cgit v1.2.3