From cc03214142fa64c509befbe4f694ba25d50e8416 Mon Sep 17 00:00:00 2001 From: hodasemi Date: Fri, 31 May 2019 14:05:45 +0200 Subject: [PATCH] Fix build and sloppy build errors --- .gitignore | 1 + .vscode/tasks.json | 21 ++++++++++ exercise3/build/cmake/CMakeLists.txt | 4 +- exercise3/include/tiny_vec.h | 61 ++++++++++++++-------------- 4 files changed, 55 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 6401f8b..0eee755 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ exercise1/build/ exercise2/build/ +exercise3/build/ .vscode/ipch \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d583758..0f44973 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -36,6 +36,27 @@ "clear": true } }, + { + "label": "Run Exercise 3", + "type": "shell", + "command": "exercise3/build/cmake/./exercise3", + "dependsOn": "Build Exercise 3", + "problemMatcher": [] + }, + { + "label": "Build Exercise 3", + "type": "shell", + "command": "cd exercise3/build/cmake && cmake . && make -j4", + "problemMatcher": [], + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": true + } + }, { "label": "Run Exercise 2", "type": "shell", diff --git a/exercise3/build/cmake/CMakeLists.txt b/exercise3/build/cmake/CMakeLists.txt index a8e516c..a63c19c 100644 --- a/exercise3/build/cmake/CMakeLists.txt +++ b/exercise3/build/cmake/CMakeLists.txt @@ -21,7 +21,7 @@ set(HEADERS ../../include/recursive_cubes.h ../../dependencies/qdbmp/include/qdbmp.h ) - + # Definition der Sourcedateien set(SOURCES ../../src/abstract_scene.cpp @@ -55,4 +55,4 @@ add_executable(exercise3 ) # Bibliotheken linken -target_link_libraries(exercise3 ${OPENGL_LIBRARIES} ${GLUT_LIBRARY}) +target_link_libraries(exercise3 ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} -lpthread) diff --git a/exercise3/include/tiny_vec.h b/exercise3/include/tiny_vec.h index 940a061..b56792f 100644 --- a/exercise3/include/tiny_vec.h +++ b/exercise3/include/tiny_vec.h @@ -1,16 +1,16 @@ // -// This source code is property of the Computer Graphics and Visualization -// chair of the TU Dresden. Do not distribute in modified or unmodified form! +// This source code is property of the Computer Graphics and Visualization +// chair of the TU Dresden. Do not distribute in modified or unmodified form! // Copyright (C) 2016 CGV TU Dresden - All Rights Reserved // /************************************************************************* Template class for vectors. This template class defines small vectors of a defined dimension with an arbitrary data type. Basic operations such as addition of vectors and -multiplication of a vector and a scalar are supported via operator -overloading. Also more advanced functions such as normalization and +multiplication of a vector and a scalar are supported via operator +overloading. Also more advanced functions such as normalization and iterating through the elements are implemented. -At the end of this file the data types "point2d", "point3d" and +At the end of this file the data types "point2d", "point3d" and "point4d" are specified as a tinyvec of doubles with the according dimension. *************************************************************************/ @@ -22,9 +22,10 @@ At the end of this file the data types "point2d", "point3d" and #include #include #include +#include #include -#ifdef _MSC_VER +#ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable : 4996 ) #endif @@ -64,7 +65,7 @@ public: tiny_vec(const T&x,const T&y, const T&z); - tiny_vec(const T&x, const T&y, const T&z,const T& w); + tiny_vec(const T&x, const T&y, const T&z,const T& w); int size() const; @@ -87,7 +88,7 @@ public: tiny_vec& operator=(const tiny_vec & v); void fill(const T& s); - + void zeros(); void ones(); @@ -106,14 +107,14 @@ public: const_reverse_iterator rbegin() const; - const_reverse_iterator rend() const; + const_reverse_iterator rend() const; bool operator==(const tiny_vec& v) const; bool operator!=(const tiny_vec& v) const; tiny_vec operator-() const; - + tiny_vec& operator+=(int s); @@ -123,45 +124,45 @@ public: tiny_vec& operator+=(double s); - + tiny_vec operator+(int s) const; tiny_vec operator+(float s) const; tiny_vec operator+(double s) const; - - - + + + tiny_vec& operator-=(int s); tiny_vec& operator-=(float s); - - tiny_vec& operator-=(double s); - - + tiny_vec& operator-=(double s); + + + tiny_vec operator-(int s) const; tiny_vec operator-(float s) const; tiny_vec operator-(double s) const; - - - + + + tiny_vec& operator*=(int s); tiny_vec& operator*=(float s); tiny_vec& operator*=(double s); - - + + tiny_vec operator*(int s) const; tiny_vec operator*(float s) const; tiny_vec operator*(double s) const; - + tiny_vec& operator/=(int s); @@ -171,11 +172,11 @@ public: tiny_vec& operator/=(double s); - + tiny_vec operator/(int s) const; tiny_vec operator/(float s) const; - + tiny_vec operator/(double s) const; tiny_vec& operator+=(const tiny_vec& v); @@ -243,8 +244,8 @@ tiny_vec::tiny_vec(){} template tiny_vec::tiny_vec(size_t n,const T* marray) -{ - std::copy(marray,marray+N,begin()); +{ + std::copy(marray,marray+N,begin()); } template @@ -363,7 +364,7 @@ void tiny_vec::fill(const T& s) template void tiny_vec::zeros() -{ +{ T zero; zero=0; std::fill(begin(), end(), zero); @@ -794,7 +795,7 @@ size_t tiny_vec::min_index() const } template -T& tiny_vec::max_elem() +T& tiny_vec::max_elem() { return *std::max_element(begin(),end()); }