From 3eaf0868976d70112dd56974af525acb17ceaadc Mon Sep 17 00:00:00 2001 From: d3BugErr Date: Tue, 10 Apr 2018 13:07:43 +0300 Subject: [PATCH] Spheres model matrix generation fix Fix of integer division resulting in some spheres being rendered at same position. Removed redundant float cast as all operands are being promoted to double anyways. --- src/6.pbr/1.1.lighting/lighting.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/6.pbr/1.1.lighting/lighting.cpp b/src/6.pbr/1.1.lighting/lighting.cpp index c209d36..a804357 100644 --- a/src/6.pbr/1.1.lighting/lighting.cpp +++ b/src/6.pbr/1.1.lighting/lighting.cpp @@ -143,8 +143,8 @@ int main() model = glm::mat4(); model = glm::translate(model, glm::vec3( - (float)(col - (nrColumns / 2)) * spacing, - (float)(row - (nrRows / 2)) * spacing, + (col - (nrColumns / 2.)) * spacing, + (row - (nrRows / 2.)) * spacing, 0.0f )); shader.setMat4("model", model);