From 18bad8389a57c10c28bd10f9d9278b17a618bcd9 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Sat, 19 Oct 2019 04:24:08 +0200 Subject: [PATCH] Fixed useless copying of vectors during model.draw(), now references. Fixed copy constructor of Vec3 (Copy-pasting is bad) Now exits on escape --- src/DataHandling/Model3D.cpp | 4 ++-- src/Vectors.h | 2 +- src/main.cpp | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/DataHandling/Model3D.cpp b/src/DataHandling/Model3D.cpp index b46e711..bc9fafd 100644 --- a/src/DataHandling/Model3D.cpp +++ b/src/DataHandling/Model3D.cpp @@ -53,7 +53,7 @@ void Model3D::draw_model() for (uint32_t i = 0;icoordinates[j]]; + Vec2f& vertex_texture = texture_coordinates[face_texture->coordinates[j]]; glTexCoord2f(vertex_texture.x,vertex_texture.y); } glVertex3f(vertex.x,vertex.y,vertex.z); diff --git a/src/Vectors.h b/src/Vectors.h index db563ab..2991d92 100644 --- a/src/Vectors.h +++ b/src/Vectors.h @@ -150,7 +150,7 @@ struct Vec3 : CoordinatesVector { if (this != &original) { - std::copy(std::begin(original.coordinates), std::end(original.coordinates), std::begin(CoordinatesVector::coordinates)); + std::copy(std::begin(original.coordinates), std::end(original.coordinates), std::begin(CoordinatesVector::coordinates)); } } diff --git a/src/main.cpp b/src/main.cpp index 3195bc4..c36a79c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,6 +21,11 @@ void manage_inputs() { glClearColor(0.5,0,0,1); } + else if (KeyStateManager::is_key_pressed(0x1B)) + { + glutDestroyWindow(glutGetWindow()); + exit(EXIT_SUCCESS); + } else { glClearColor(0,0,0,1);