small optimizations with Triangle.cpp (normal vector calculated once in constructor)

master
Vectozavr 2021-11-06 03:24:34 +07:00
parent 435db3ad0e
commit 389936268a
1 changed files with 1 additions and 2 deletions

View File

@ -177,8 +177,7 @@ GLfloat *Screen::glMeshToGLfloatArray(std::shared_ptr<Mesh> mesh) {
int stride = 21 * i; int stride = 21 * i;
Triangle triangle = triangles[i]; Triangle triangle = triangles[i];
Vec3D norm = triangles[i].norm(); float dot = static_cast<float>(triangle.norm().dot(Vec3D(0, 0.5, 1)));
float dot = norm.dot(Vec3D(2, 1, 0).normalized());
for (int k = 0; k < 3; k++) { for (int k = 0; k < 3; k++) {
sf::Color color = triangle.color(); sf::Color color = triangle.color();