From 389936268a6904476554d8e54ac837c9358b56a9 Mon Sep 17 00:00:00 2001 From: Vectozavr <60608292+vectozavr@users.noreply.github.com> Date: Sat, 6 Nov 2021 03:24:34 +0700 Subject: [PATCH] small optimizations with Triangle.cpp (normal vector calculated once in constructor) --- engine/Screen.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/Screen.cpp b/engine/Screen.cpp index d073217..9edd494 100644 --- a/engine/Screen.cpp +++ b/engine/Screen.cpp @@ -177,8 +177,7 @@ GLfloat *Screen::glMeshToGLfloatArray(std::shared_ptr mesh) { int stride = 21 * i; Triangle triangle = triangles[i]; - Vec3D norm = triangles[i].norm(); - float dot = norm.dot(Vec3D(2, 1, 0).normalized()); + float dot = static_cast(triangle.norm().dot(Vec3D(0, 0.5, 1))); for (int k = 0; k < 3; k++) { sf::Color color = triangle.color();