diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3333652b9f5e2f245a29dcaf37c199c5d783bdb..29ec3811f2461d65309ce23b12a4d61eb0c12135 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -403,6 +403,24 @@ conan:linux:gcc6.3.1: - build expire_in: 1 week +conan:linux:gcc7.3.1: + stage: conan + except: + - schedules + tags: + - gcc7.3.1 + - opengl + script: + - mkdir build + - cd build + - export CC=gcc + - export CXX=g++ + - conan install .. --build=missing -s compiler="gcc" -s compiler.version="7.3" -s compiler.libcxx="libstdc++11" -s build_type=Release + artifacts: + paths: + - build + expire_in: 1 week + cmake:linux:gcc5.3.1: stage: cmake except: @@ -439,6 +457,24 @@ cmake:linux:gcc6.3.1: - build expire_in: 1 week +cmake:linux:gcc7.3.1: + stage: cmake + except: + - schedules + tags: + - gcc7.3.1 + - opengl + dependencies: + - conan:linux:gcc7.3.1 + script: + - cd build + - cmake .. -DIS_BUILD_SERVER:BOOL=TRUE -DCMAKE_BUILD_TYPE=Release + artifacts: + untracked: true + paths: + - build + expire_in: 1 week + build:linux:gcc5.3.1: stage: build except: @@ -479,6 +515,27 @@ build:linux:gcc6.3.1: expire_in: 1 week allow_failure: true +build:linux:gcc7.3.1: + stage: build + except: + - schedules + tags: + - gcc7.3.1 + - opengl + dependencies: + - cmake:linux:gcc7.3.1 + script: + - gcc --version + - cd build + - make Cpplint-Test-Suite + - make Cppcheck-Test-Suite + - make -j8 + artifacts: + paths: + - build + expire_in: 1 week + allow_failure: true + test:linux:gcc5.3.1: stage: test except: @@ -505,6 +562,19 @@ test:linux:gcc6.3.1: - cd build - make Unit-Test-Suite +test:linux:gcc7.3.1: + stage: test + except: + - schedules + tags: + - gcc7.3.1 + - opengl + dependencies: + - build:linux:gcc7.3.1 + script: + - cd build + - make Unit-Test-Suite + # nightly builds clear:linux_nightly:gcc5.3.1: @@ -532,6 +602,19 @@ clear:linux_nightly:gcc6.3.1: - cd /home/gitlab-runner/dev - rm -rf ./conan_nightly_6_3_1 - mkdir conan_nightly_6_3_1 + +clear:linux_nightly:gcc7.3.1: + stage: clear + only: + - schedules + tags: + - gcc7.3.1 + - nightly + script: + - echo $CONAN_USER_HOME + - cd /home/gitlab-runner/dev + - rm -rf ./conan_nightly_7_3_1 + - mkdir conan_nightly_7_3_1 conan:linux_nightly:gcc5.3.1: stage: conan @@ -573,6 +656,26 @@ conan:linux_nightly:gcc6.3.1: - build expire_in: 1 week +conan:linux_nightly:gcc7.3.1: + stage: conan + only: + - schedules + tags: + - gcc7.3.1 + - nightly + script: + - conan remote add rwth-vr--bintray https://api.bintray.com/conan/rwth-vr/conan + - conan remote add bincrafters_public https://api.bintray.com/conan/bincrafters/public-conan + - mkdir build + - cd build + - export CC=gcc + - export CXX=g++ + - conan install .. --build=missing -s compiler="gcc" -s compiler.version="7.3" -s compiler.libcxx="libstdc++11" -s build_type=Release + artifacts: + paths: + - build + expire_in: 1 week + cmake:linux_nightly:gcc5.3.1: stage: cmake only: @@ -609,6 +712,24 @@ cmake:linux_nightly:gcc6.3.1: - build expire_in: 1 week +cmake:linux_nightly:gcc7.3.1: + stage: cmake + only: + - schedules + tags: + - gcc7.3.1 + - nightly + dependencies: + - conan:linux_nightly:gcc7.3.1 + script: + - cd build + - cmake .. -DIS_BUILD_SERVER:BOOL=TRUE -DCMAKE_BUILD_TYPE=Release + artifacts: + untracked: true + paths: + - build + expire_in: 1 week + build:linux_nightly:gcc5.3.1: stage: build only: @@ -648,6 +769,26 @@ build:linux_nightly:gcc6.3.1: - build expire_in: 1 week allow_failure: true + +build:linux_nightly:gcc7.3.1: + stage: build + only: + - schedules + tags: + - gcc7.3.1 + - nightly + dependencies: + - cmake:linux_nightly:gcc7.3.1 + script: + - cd build + - make Cpplint-Test-Suite + - make Cppcheck-Test-Suite + - make -j8 + artifacts: + paths: + - build + expire_in: 1 week + allow_failure: true test:linux_nightly:gcc5.3.1: stage: test @@ -673,4 +814,17 @@ test:linux_nightly:gcc6.3.1: - build:linux_nightly:gcc6.3.1 script: - cd build - - make Unit-Test-Suite \ No newline at end of file + - make Unit-Test-Suite + +test:linux_nightly:gcc7.3.1: + stage: test + only: + - schedules + tags: + - gcc7.3.1 + - nightly + dependencies: + - build:linux_nightly:gcc7.3.1 + script: + - cd build + - make Unit-Test-Suite diff --git a/conanfile.py b/conanfile.py index e3ddbdcf0c2d9aa8512bfb8bca3f5e1032152f39..59a1b0577c94876c30fe7cfd4408ae6aef9d48e4 100644 --- a/conanfile.py +++ b/conanfile.py @@ -37,7 +37,7 @@ class ProjectPhoenix(ConanFile): ("cpplint/e8ffd7c@RWTH-VR/thirdparty"), ("freeimage/3.17.0_2@RWTH-VR/thirdparty"), ("gl/1.1.6@RWTH-VR/thirdparty"), - ("glm/0.9.8.5@g-truc/stable"), + ("glm/0.9.9.0@g-truc/stable"), ("jsonformoderncpp/3.0.1@vthiery/stable"), ("openvr/1.0.12@RWTH-VR/thirdparty"), ("sdl2/2.0.8@bincrafters/stable"), diff --git a/library/phx/display/hmd.hpp b/library/phx/display/hmd.hpp index be7f5f0f6398c3a2d03ad65af177873e5e9c9628..430b874be50cb123ba399f139baefd0910981fa0 100644 --- a/library/phx/display/hmd.hpp +++ b/library/phx/display/hmd.hpp @@ -85,8 +85,6 @@ class PHOENIX_EXPORT HMD : public TrackedDevice { glm::mat4 projection_left_; glm::mat4 eye_to_head_right_; glm::mat4 eye_to_head_left_; - - glm::mat4 last_head_transformation_; }; } // namespace phx diff --git a/library/phx/rendering/components/projection.cpp b/library/phx/rendering/components/projection.cpp index 63b56491e4f5f2328ae7fbfab08b13b384a16101..bd34f4b9a64e5c742a734e21c7de3f38dc9075b6 100644 --- a/library/phx/rendering/components/projection.cpp +++ b/library/phx/rendering/components/projection.cpp @@ -27,13 +27,15 @@ #include "phx/suppress_warnings.hpp" SUPPRESS_WARNINGS_BEGIN +#include "glm/gtc/matrix_transform.hpp" #include "glm/mat4x4.hpp" SUPPRESS_WARNINGS_END -#include "glm/gtc/matrix_transform.hpp" - namespace phx { +Projection::Projection(const glm::mat4& projection /*= glm::mat4(1.0f)*/) + : matrix_(projection) {} + const glm::mat4& Projection::GetMatrix() const { return matrix_; } void Projection::SetPerspective(float fovy, float aspect, float near, diff --git a/library/phx/rendering/components/projection.hpp b/library/phx/rendering/components/projection.hpp index b347dae5a61e47dd5e9066eb687d964a5bb07b27..08e7418be4d80fa8cf622d188d558fc95a5b962d 100644 --- a/library/phx/rendering/components/projection.hpp +++ b/library/phx/rendering/components/projection.hpp @@ -50,7 +50,7 @@ class PHOENIX_EXPORT Projection final : public Component { protected: friend Entity; - Projection() = default; + explicit Projection(const glm::mat4& projection = glm::mat4(1.0f)); Projection(const Projection&) = delete; Projection(Projection&&) = default; diff --git a/library/phx/rendering/components/transform.cpp b/library/phx/rendering/components/transform.cpp index 0200fcb6d5895920acdd34e2a52bbd6f9252577f..fb0bcdf6db0d5f914a6a48e2c132f2b6581b1954 100644 --- a/library/phx/rendering/components/transform.cpp +++ b/library/phx/rendering/components/transform.cpp @@ -26,6 +26,7 @@ #include "phx/suppress_warnings.hpp" SUPPRESS_WARNINGS_BEGIN +#define GLM_ENABLE_EXPERIMENTAL #include "glm/gtc/matrix_transform.hpp" #include "glm/gtx/matrix_decompose.hpp" #include "glm/gtx/quaternion.hpp" @@ -162,9 +163,9 @@ Transform& Transform::LookAt(const glm::vec3& target, } Transform& Transform::Reset() { local_translation_ = glm::vec3(); - local_rotation_ = glm::quat(); + local_rotation_ = glm::quat(1.0f, glm::vec3()); local_scale_ = glm::vec3(1.0f); - local_matrix_ = glm::mat4(); + local_matrix_ = glm::mat4(1.0f); return *this; } diff --git a/library/phx/rendering/components/transform.hpp b/library/phx/rendering/components/transform.hpp index c9e4f0c30f96753ad51946118f3e3d0628d0407f..d99ea32abd0e1b88bf4df46fa336a669d5206736 100644 --- a/library/phx/rendering/components/transform.hpp +++ b/library/phx/rendering/components/transform.hpp @@ -35,8 +35,8 @@ SUPPRESS_WARNINGS_BEGIN SUPPRESS_WARNINGS_END #include "phx/core/component.hpp" -#include "phx/utility/aspects/hierarchical.hpp" #include "phx/export.hpp" +#include "phx/utility/aspects/hierarchical.hpp" namespace phx { @@ -99,7 +99,7 @@ class PHOENIX_EXPORT Transform : public Component, protected: friend Entity; Transform(const glm::vec3& translation = glm::vec3(), - const glm::quat& rotation = glm::quat(), + const glm::quat& rotation = glm::quat(1.0f, glm::vec3()), const glm::vec3& scale = glm::vec3(1.0f)); Transform(const glm::vec3& translation, const glm::vec3& rotation_euler, const glm::vec3& scale = glm::vec3(1.0f)); diff --git a/library/phx/rendering/render_passes/geometry_pass.cpp b/library/phx/rendering/render_passes/geometry_pass.cpp index aeaf4a167e430320f97bdc6b11101f152b261998..ba347d63c6a817c3cf9e1e28afc45379c64dd136 100644 --- a/library/phx/rendering/render_passes/geometry_pass.cpp +++ b/library/phx/rendering/render_passes/geometry_pass.cpp @@ -29,9 +29,12 @@ #include <utility> #include <vector> +SUPPRESS_WARNINGS_BEGIN +#define GLM_ENABLE_EXPERIMENTAL #include "glm/glm.hpp" #include "glm/gtc/type_ptr.hpp" #include "glm/gtx/matrix_operation.hpp" +SUPPRESS_WARNINGS_END #include "phx/core/logger.hpp" #include "phx/rendering/components/transform.hpp" diff --git a/library/phx/rendering/render_passes/skybox_pass.cpp b/library/phx/rendering/render_passes/skybox_pass.cpp index 836cd4945b6b1c8c4a0339ef9df8e7b7d5edb393..e0885f3f8a4d9dfd1f3d6589ba05bbbe180bbeee 100644 --- a/library/phx/rendering/render_passes/skybox_pass.cpp +++ b/library/phx/rendering/render_passes/skybox_pass.cpp @@ -33,6 +33,7 @@ #include "phx/suppress_warnings.hpp" SUPPRESS_WARNINGS_BEGIN +#define GLM_ENABLE_EXPERIMENTAL #include "glm/gtx/quaternion.hpp" SUPPRESS_WARNINGS_END diff --git a/library/phx/resources/types/mesh.cpp b/library/phx/resources/types/mesh.cpp index 9c1e178cbf3fc86bf8ce0403a09bd173b0677384..842a130ec27f078752bc56ead8cf446b8ddf1ea9 100644 --- a/library/phx/resources/types/mesh.cpp +++ b/library/phx/resources/types/mesh.cpp @@ -26,8 +26,10 @@ #include <utility> #include <vector> +SUPPRESS_WARNINGS_BEGIN #include "glm/vec2.hpp" #include "glm/vec3.hpp" +SUPPRESS_WARNINGS_END namespace phx { diff --git a/tests/src/integration_test_hmd.cpp b/tests/src/integration_test_hmd.cpp index ee8600182ee2cb73f9084dcdd4d389e9e660ebc0..84ea1d86c07423fe8eca6355fab162e540d6451a 100644 --- a/tests/src/integration_test_hmd.cpp +++ b/tests/src/integration_test_hmd.cpp @@ -169,7 +169,7 @@ SCENARIO("If a HMD is present we render for both eyes including controllers", namespace { glm::mat4 ToMat4(float mat[12]) { - glm::mat4 result; + glm::mat4 result = glm::mat4(1.0f); for (int i = 0; i < 12; ++i) { result[i % 4][i / 4] = mat[i]; } diff --git a/tests/src/test_light.cpp b/tests/src/test_light.cpp index 6506ab2cdfa096a474b6518518795482aaac7a8d..6d219cdcaf4cf3ecb3be6eb3642360b2c7b97e12 100644 --- a/tests/src/test_light.cpp +++ b/tests/src/test_light.cpp @@ -27,7 +27,9 @@ #include "phx/core/entity.hpp" #include "phx/rendering/components/light.hpp" +SUPPRESS_WARNINGS_BEGIN #include "glm/glm.hpp" +SUPPRESS_WARNINGS_END SCENARIO("The light component describes a light source in space.", "[phx][phx::Light]") { diff --git a/tests/src/test-phoenix.cpp b/tests/src/test_phoenix.cpp similarity index 100% rename from tests/src/test-phoenix.cpp rename to tests/src/test_phoenix.cpp diff --git a/tests/src/test-transform.cpp b/tests/src/test_transform.cpp similarity index 88% rename from tests/src/test-transform.cpp rename to tests/src/test_transform.cpp index a35aea6909dd71327875cae8dd57c77a3cf11f0f..53f98a7a244e55569439a6905dc560048f15658a 100644 --- a/tests/src/test-transform.cpp +++ b/tests/src/test_transform.cpp @@ -37,6 +37,7 @@ SUPPRESS_WARNINGS_END #include "phx/core/scene.hpp" #include "phx/rendering/components/transform.hpp" +#include "test_utilities/approx.hpp" #include "test_utilities/glm_mat4.hpp" #include "test_utilities/glm_quat.hpp" #include "test_utilities/glm_vec.hpp" @@ -59,14 +60,19 @@ SCENARIO( } WHEN("We query its local rotation.") { auto rotation = transform->GetLocalRotation(); - THEN("It should be equal to the unit quaternion.") { - REQUIRE(rotation == glm::quat()); + + THEN("It should be equal to the identity quaternion.") { + // REQUIRE(rotation == glm::quat()); + REQUIRE(rotation[0] == 0.0f); + REQUIRE(rotation[1] == 0.0f); + REQUIRE(rotation[2] == 0.0f); + REQUIRE(rotation[3] == 1.0f); } } WHEN("We query its local rotation in Euler angles.") { auto rotation = transform->GetLocalRotationEuler(); THEN("It should be equal to the zero vector.") { - REQUIRE(rotation == glm::vec3()); + REQUIRE(test_utilities::Approx<glm::vec3>(glm::vec3()) == rotation); } } WHEN("We query its local scale.") { @@ -78,7 +84,7 @@ SCENARIO( WHEN("We query its local transform matrix.") { auto matrix = transform->GetLocalMatrix(); THEN("It should be equal to the identity matrix.") { - REQUIRE(matrix == glm::mat4()); + REQUIRE(matrix == glm::mat4(1.0f)); } } @@ -121,7 +127,7 @@ SCENARIO( THEN( "The local transform matrix should be equal to the identity " "matrix.") { - REQUIRE(transform->GetLocalMatrix() == glm::mat4()); + REQUIRE(transform->GetLocalMatrix() == glm::mat4(1.0f)); } } } @@ -132,8 +138,12 @@ SCENARIO( "The rotation vector be equal to [0.43967, 0.36042, 0.82236, " "0.02225].") { auto rotation = transform->GetLocalRotation(); - REQUIRE(test_utilities::Approx<glm::quat>(rotation) == - glm::quat(0.43967f, 0.36042f, 0.82236f, 0.02225f)); + // REQUIRE(test_utilities::Approx<glm::quat>(rotation) == + // glm::quat(0.43967f, 0.36042f, 0.82236f, 0.02225f)); + REQUIRE(rotation[0] == Approx(0.36042f)); + REQUIRE(rotation[1] == Approx(0.82236f)); + REQUIRE(rotation[2] == Approx(0.02225f)); + REQUIRE(rotation[3] == Approx(0.43967f)); } THEN( "The transform matrix should be equal to the corresponding " @@ -147,12 +157,16 @@ SCENARIO( WHEN("We reset it.") { transform->Reset(); THEN("The local rotation should be equal to the identity quaternion.") { - REQUIRE(transform->GetLocalRotation() == glm::quat()); + // REQUIRE(transform->GetLocalRotation() == glm::quat()); + REQUIRE(transform->GetLocalRotation()[0] == 0.0f); + REQUIRE(transform->GetLocalRotation()[1] == 0.0f); + REQUIRE(transform->GetLocalRotation()[2] == 0.0f); + REQUIRE(transform->GetLocalRotation()[3] == 1.0f); } THEN( "The local transform matrix should be equal to the identity " "matrix.") { - REQUIRE(transform->GetLocalMatrix() == glm::mat4()); + REQUIRE(transform->GetLocalMatrix() == glm::mat4(1.0f)); } } } @@ -197,12 +211,13 @@ SCENARIO( WHEN("We reset it.") { transform->Reset(); THEN("The local rotation vector should be equal to the zero vector.") { - REQUIRE(transform->GetLocalRotationEuler() == glm::vec3()); + REQUIRE(test_utilities::Approx<glm::vec3>(glm::vec3()) == + transform->GetLocalRotationEuler()); } THEN( "The local transform matrix should be equal to the identity " "matrix.") { - REQUIRE(transform->GetLocalMatrix() == glm::mat4()); + REQUIRE(transform->GetLocalMatrix() == glm::mat4(1.0f)); } } } @@ -243,7 +258,7 @@ SCENARIO( THEN( "The local transform matrix should be equal to the identity " "matrix.") { - REQUIRE(transform->GetLocalMatrix() == glm::mat4()); + REQUIRE(transform->GetLocalMatrix() == glm::mat4(1.0f)); } } } @@ -252,12 +267,16 @@ SCENARIO( THEN( "The local rotation quaternion should be equal to the identity " "quaternion.") { - REQUIRE(transform->GetLocalRotation() == glm::quat()); + // REQUIRE(transform->GetLocalRotation() == glm::quat()); + REQUIRE(transform->GetLocalRotation()[0] == 0.0f); + REQUIRE(transform->GetLocalRotation()[1] == 0.0f); + REQUIRE(transform->GetLocalRotation()[2] == 0.0f); + REQUIRE(transform->GetLocalRotation()[3] == 1.0f); } THEN( "The local transform matrix should be equal to the identity " "matrix.") { - REQUIRE(transform->GetLocalMatrix() == glm::mat4()); + REQUIRE(transform->GetLocalMatrix() == glm::mat4(1.0f)); } } } @@ -319,9 +338,12 @@ SCENARIO( WHEN("We set A's local rotation to the (20, 30, 40) euler angles.") { A->SetLocalRotationEuler(glm::vec3(20.f, 30.f, 40.f)); THEN("The local rotation of B, C and D is still (0, 0, 0).") { - REQUIRE(B->GetLocalRotationEuler() == glm::vec3()); - REQUIRE(C->GetLocalRotationEuler() == glm::vec3()); - REQUIRE(D->GetLocalRotationEuler() == glm::vec3()); + REQUIRE(test_utilities::Approx<glm::vec3>(glm::vec3()) == + B->GetLocalRotationEuler()); + REQUIRE(test_utilities::Approx<glm::vec3>(glm::vec3()) == + C->GetLocalRotationEuler()); + REQUIRE(test_utilities::Approx<glm::vec3>(glm::vec3()) == + D->GetLocalRotationEuler()); } THEN("The global rotation of B, C and D is (20, 30, 40).") { REQUIRE( @@ -402,9 +424,9 @@ SCENARIO( A->SetGlobalRotationEuler(glm::vec3(12.f, 0.f, 42.f)); A->SetGlobalScale(glm::vec3(1.f, 2.f, 4.f)); THEN("The local matrix of B, C and D is still identity.") { - REQUIRE(B->GetLocalMatrix() == glm::mat4()); - REQUIRE(C->GetLocalMatrix() == glm::mat4()); - REQUIRE(D->GetLocalMatrix() == glm::mat4()); + REQUIRE(B->GetLocalMatrix() == glm::mat4(1.0f)); + REQUIRE(C->GetLocalMatrix() == glm::mat4(1.0f)); + REQUIRE(D->GetLocalMatrix() == glm::mat4(1.0f)); } THEN("The global matrix of B, C and D is the same as A's.") { REQUIRE(B->GetGlobalMatrix() == A->GetGlobalMatrix()); @@ -412,16 +434,17 @@ SCENARIO( REQUIRE(D->GetGlobalMatrix() == A->GetGlobalMatrix()); } WHEN("We set C's global matrix to identity.") { - C->SetGlobalMatrix(glm::mat4()); + C->SetGlobalMatrix(glm::mat4(1.0f)); THEN("It's local matrix is the inverse of A's.") { - REQUIRE(C->GetLocalMatrix() == glm::inverse(A->GetLocalMatrix())); + REQUIRE(test_utilities::Approx<glm::mat4>(C->GetLocalMatrix()) == + glm::inverse(A->GetLocalMatrix())); } THEN("B's global matrix is still the same as A's.") { REQUIRE(B->GetGlobalMatrix() == A->GetGlobalMatrix()); } THEN("D's global matrix is identity.") { REQUIRE(test_utilities::Approx<glm::mat4>(D->GetGlobalMatrix()) == - glm::mat4()); + glm::mat4(1.0f)); } WHEN( @@ -430,15 +453,15 @@ SCENARIO( C->SetParent(nullptr); THEN("C's global and local matrices are identity.") { REQUIRE(test_utilities::Approx<glm::mat4>(C->GetLocalMatrix()) == - glm::mat4()); + glm::mat4(1.0f)); REQUIRE(test_utilities::Approx<glm::mat4>(C->GetGlobalMatrix()) == - glm::mat4()); + glm::mat4(1.0f)); } THEN("D's global and local matrices are identity.") { REQUIRE(test_utilities::Approx<glm::mat4>(D->GetLocalMatrix()) == - glm::mat4()); + glm::mat4(1.0f)); REQUIRE(test_utilities::Approx<glm::mat4>(D->GetGlobalMatrix()) == - glm::mat4()); + glm::mat4(1.0f)); } }