diff --git a/src/DataHandling/Model3D.cpp b/src/DataHandling/Model3D.cpp index bc9fafd..b46e711 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 29bdf82..e9c5a5b 100644 --- a/src/Vectors.h +++ b/src/Vectors.h @@ -18,7 +18,7 @@ struct CoordinatesVector /// Computes the euclidean norm of the vector. /// \return The magnitude. - double magnitude() const + double magnitude() { // TODO : Save magnitude if the vector has not been modified. double sum_of_squares = 0; @@ -29,12 +29,10 @@ struct CoordinatesVector return sqrt(sum_of_squares); } - // Use SFINAE to allow normalization of floating point. - // The template argument is used to force substitution and thus checking the enable_if. + // Use SFINAE to allow normalization of floating point /// Normalizes the vector using its euclidean norm. /// \return Nothing, the vector is normalized in-place. - template - typename std::enable_if::value,void>::type + typename std::enable_if::value,void>::type normalize() { double norm = magnitude(); @@ -44,19 +42,6 @@ struct CoordinatesVector } } - - template - typename std::enable_if::value,T>::type - dot_product(const CoordinatesVector& operand) const - { - T result = 0; - for (unsigned int i = 0;i typename std::enable_if::value,CoordinatesVector>::type @@ -119,17 +104,6 @@ struct Vec2 : public CoordinatesVector Vec2() = default; - Vec2(T x_axis, T y_axis) - { - x = x_axis; - y = y_axis; - } - - Vec2(const Vec2& original): x(CoordinatesVector::coordinates[0]), y(CoordinatesVector::coordinates[1]) - { - std::copy(std::begin(original.coordinates), std::end(original.coordinates), std::begin(CoordinatesVector::coordinates)); - } - // Cast-copy constructor in order to use the operators of the mother class. Vec2(const CoordinatesVector& origin) { @@ -159,39 +133,15 @@ struct Vec3 : CoordinatesVector Vec3() = default; - Vec3(T x_axis, T y_axis, T z_axis) - { - x = x_axis; - y = y_axis; - z = z_axis; - } - - Vec3(const Vec3& original): x(CoordinatesVector::coordinates[0]), y(CoordinatesVector::coordinates[1]), z(CoordinatesVector::coordinates[2]) - { - std::copy(std::begin(original.coordinates), std::end(original.coordinates), std::begin(CoordinatesVector::coordinates)); - } - // Cast-copy constructor in order to use the operators of the mother class. - Vec3(const CoordinatesVector& original) + Vec3(const CoordinatesVector& origin) { - if (this != &original) + if (this != &origin) { - std::copy(std::begin(original.coordinates), std::end(original.coordinates), std::begin(CoordinatesVector::coordinates)); + std::copy(std::begin(origin.coordinates),std::end(origin.coordinates),std::begin(CoordinatesVector::coordinates)); } } - template - typename std::enable_if::value,Vec3>::type - cross_product(const Vec3& operand) const - { - Vec3 normal_vector{0,0,0}; - normal_vector.x = y*operand.z - z*operand.y; - normal_vector.y = z*operand.x - x*operand.z; - normal_vector.z = x*operand.y - y*operand.x; - - return normal_vector; - } - Vec3& operator=(const Vec3& original) { if (this != &original) diff --git a/src/main.cpp b/src/main.cpp index c36a79c..3195bc4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,11 +21,6 @@ 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);