From e3103457bc5b690fd0701522b7d27c8cb3bb7935 Mon Sep 17 00:00:00 2001 From: kj16609 Date: Fri, 6 Jun 2025 21:49:20 -0400 Subject: [PATCH] Error fixes --- dependencies/tracy | 2 +- src/engine/assets/transfer/TransferData.hpp | 1 + src/engine/primitives/Transform.hpp | 1 + .../rendering/pipelines/shaders/Compiler.cpp | 5 +- src/tests/src/gtest_printers.hpp | 5 +- .../src/intersections/orientedBoundingBox.cpp | 45 -------- src/tests/src/math/quat.cpp | 108 ------------------ src/tests/src/math/transform.cpp | 24 ---- src/tests/src/operators/vector.hpp | 32 ------ 9 files changed, 9 insertions(+), 214 deletions(-) delete mode 100644 src/tests/src/intersections/orientedBoundingBox.cpp delete mode 100644 src/tests/src/math/quat.cpp delete mode 100644 src/tests/src/math/transform.cpp delete mode 100644 src/tests/src/operators/vector.hpp diff --git a/dependencies/tracy b/dependencies/tracy index 897aec5..5d542dc 160000 --- a/dependencies/tracy +++ b/dependencies/tracy @@ -1 +1 @@ -Subproject commit 897aec5b062664d2485f4f9a213715d2e527e0ca +Subproject commit 5d542dc09f3d9378d005092a4ad446bd405f819a diff --git a/src/engine/assets/transfer/TransferData.hpp b/src/engine/assets/transfer/TransferData.hpp index 36a08f0..92b6b1a 100644 --- a/src/engine/assets/transfer/TransferData.hpp +++ b/src/engine/assets/transfer/TransferData.hpp @@ -9,6 +9,7 @@ #include #include "engine/memory/buffers/BufferHandle.hpp" +#include namespace vk { diff --git a/src/engine/primitives/Transform.hpp b/src/engine/primitives/Transform.hpp index 43c38eb..09ff007 100644 --- a/src/engine/primitives/Transform.hpp +++ b/src/engine/primitives/Transform.hpp @@ -10,6 +10,7 @@ #include "engine/primitives/points/Coordinate.hpp" #include "rotation/QuatRotation.hpp" #include "rotation/UniversalRotation.hpp" +#include namespace fgl::engine { diff --git a/src/engine/rendering/pipelines/shaders/Compiler.cpp b/src/engine/rendering/pipelines/shaders/Compiler.cpp index 1c3e2ec..464ea8c 100644 --- a/src/engine/rendering/pipelines/shaders/Compiler.cpp +++ b/src/engine/rendering/pipelines/shaders/Compiler.cpp @@ -6,6 +6,7 @@ #include #include +#include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnon-virtual-dtor" @@ -107,11 +108,11 @@ namespace fgl::engine { .name = CompilerOptionName::Optimization, .value = { .kind = CompilerOptionValueKind::Int, .intValue0 = static_cast< int32_t >( SLANG_OPTIMIZATION_LEVEL_NONE ) } }, - // .intValue0 = static_cast< int32_t >( SLANG_OPTIMIZATION_LEVEL_HIGH ) } }, + // .intValue0 = static_cast< int32_t >( SLANG_OPTIMIZATION_LEVEL_HIGH ) } }, { .name = CompilerOptionName::DebugInformation, .value = { .kind = CompilerOptionValueKind::Int, .intValue0 = static_cast< int32_t >( SLANG_DEBUG_INFO_LEVEL_MAXIMAL ) } }, - // .intValue0 = static_cast< int32_t >( SLANG_DEBUG_INFO_LEVEL_MINIMAL ) } }, + // .intValue0 = static_cast< int32_t >( SLANG_DEBUG_INFO_LEVEL_MINIMAL ) } }, { .name = CompilerOptionName::EmitSpirvDirectly, .value = { .kind = CompilerOptionValueKind::Int, .intValue0 = static_cast< int32_t >( true ) } }, } }; diff --git a/src/tests/src/gtest_printers.hpp b/src/tests/src/gtest_printers.hpp index a1e8342..a3eeba8 100644 --- a/src/tests/src/gtest_printers.hpp +++ b/src/tests/src/gtest_printers.hpp @@ -9,10 +9,11 @@ #include #include -#include "../../engine/primitives/rotation/QuatRotation.hpp" #include "engine/primitives/Scale.hpp" #include "engine/primitives/matricies/Matrix.hpp" #include "engine/primitives/points/Coordinate.hpp" +#include "engine/primitives/rotation/EulerRotation.hpp" +#include "engine/primitives/rotation/QuatRotation.hpp" #include "engine/primitives/vectors/Vector.hpp" namespace Catch @@ -63,7 +64,7 @@ namespace Catch template <> struct StringMaker< fgl::engine::EulerRotation > { - static std::string convert( const fgl::engine::QuatRotation& rot ) + static std::string convert( const fgl::engine::EulerRotation& rot ) { return StringMaker< glm::vec3 >::convert( glm::vec3( rot.x, rot.y, rot.z ) ); } diff --git a/src/tests/src/intersections/orientedBoundingBox.cpp b/src/tests/src/intersections/orientedBoundingBox.cpp deleted file mode 100644 index 7bf5226..0000000 --- a/src/tests/src/intersections/orientedBoundingBox.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -// Created by kj16609 on 2/15/25. -// - -#include "primitives/boxes/OrientedBoundingBox.hpp" - -#include - -#include "tests/src/gtest_printers.hpp" - -#include - -TEST_CASE( "Oriented Bounding Box", "[intersection][obb][coordinate]" ) -{ - using namespace fgl::engine; - - SECTION( "Coordinate" ) - { - constexpr Coordinate< CoordinateSpace::World > start_pos { 1.0, 1.0, 1.0 }; - OrientedBoundingBox< CoordinateSpace::World > box { start_pos, glm::vec3( 1.0f ) }; - - box.getTransform().rotation.addX( 2.0 ); - box.getTransform().rotation.addY( 2.0 ); - box.getTransform().rotation.addZ( 2.0 ); - - WHEN( "Coordinate is outside the bounds of the box" ) - { - Coordinate< CoordinateSpace::World > coord { 5.0, 5.0, 5.0 }; - - THEN( "The intersection should fail" ) - { - REQUIRE( !intersections::contains( box, coord ) ); - } - } - - WHEN("Coordinate is inside of the bounds of the box") - { - Coordinate< CoordinateSpace::World > coord { 1.0, 1.0, 1.0 }; - THEN( "The intersection should pass" ) - { - REQUIRE( intersections::contains( box, coord ) ); - } - } - } -} diff --git a/src/tests/src/math/quat.cpp b/src/tests/src/math/quat.cpp deleted file mode 100644 index 1ea4f9f..0000000 --- a/src/tests/src/math/quat.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// -// Created by kj16609 on 1/30/25. -// - -#include - -#include "tests/src/gtest_printers.hpp" - -using namespace Catch::literals; - -TEST_CASE( "Quaternions", "[math][rotation]" ) -{ - SECTION( "Default" ) - { - fgl::engine::QuatRotation rot {}; - - SECTION( "Raw" ) - { - const glm::quat raw_quat { rot.internal_quat() }; - REQUIRE( raw_quat.x == 0.0f ); - REQUIRE( raw_quat.y == 0.0f ); - REQUIRE( raw_quat.z == 0.0f ); - REQUIRE( raw_quat.w == 1.0f ); - } - } - - SECTION( "Predefined" ) - { - SECTION( "-1.126, 1.012, -0.548" ) - { - fgl::engine::QuatRotation rot { -1.256f, 1.012f, -0.548 }; - - REQUIRE_THAT( rot.internal_quat().w, Catch::Matchers::WithinAbs( 0.604f, 0.1f ) ); - REQUIRE_THAT( rot.internal_quat().x, Catch::Matchers::WithinAbs( -0.601f, 0.1f ) ); - REQUIRE_THAT( rot.internal_quat().y, Catch::Matchers::WithinAbs( -0.239f, 0.1f ) ); - REQUIRE_THAT( rot.internal_quat().z, Catch::Matchers::WithinAbs( -0.466f, 0.1f ) ); - } - } - - SECTION( "Test xRange" ) - { - for ( std::size_t i = 0; i < 360; ++i ) - { - DYNAMIC_SECTION( "X Angle" << i ) - { - constexpr float offset { std::numbers::pi_v< float > / 360.0f }; - fgl::engine::QuatRotation rot1 { static_cast< float >( i ) * offset, 0.0f, 0.0f }; - - fgl::engine::QuatRotation rot2 { 0.0f, 0.0f, 0.0f }; - for ( std::size_t x = 0; x < i; ++x ) rot2.addX( offset ); - - // compare both quaternions - using namespace Catch::Matchers; - - REQUIRE_THAT( rot1.internal_quat().x, WithinAbs( rot2.internal_quat().x, 0.01f ) ); - REQUIRE_THAT( rot1.internal_quat().y, WithinAbs( rot2.internal_quat().y, 0.01f ) ); - REQUIRE_THAT( rot1.internal_quat().z, WithinAbs( rot2.internal_quat().z, 0.01f ) ); - REQUIRE_THAT( rot1.internal_quat().w, WithinAbs( rot2.internal_quat().w, 0.01f ) ); - } - } - - SECTION( "Test yRange" ) - { - for ( std::size_t i = 0; i < 360; ++i ) - { - DYNAMIC_SECTION( "Y Angle: " << i ) - { - constexpr float offset { std::numbers::pi_v< float > / 360.0f }; - fgl::engine::QuatRotation rot1 { 0.0f, static_cast< float >( i ) * offset, 0.0f }; - - fgl::engine::QuatRotation rot2 { 0.0f, 0.0f, 0.0f }; - for ( std::size_t x = 0; x < i; ++x ) rot2.addY( offset ); - - // compare both quaternions - using namespace Catch::Matchers; - - REQUIRE_THAT( rot1.internal_quat().x, WithinAbs( rot2.internal_quat().x, 0.01f ) ); - REQUIRE_THAT( rot1.internal_quat().y, WithinAbs( rot2.internal_quat().y, 0.01f ) ); - REQUIRE_THAT( rot1.internal_quat().z, WithinAbs( rot2.internal_quat().z, 0.01f ) ); - REQUIRE_THAT( rot1.internal_quat().w, WithinAbs( rot2.internal_quat().w, 0.01f ) ); - } - } - } - - SECTION( "Test zRange" ) - { - for ( std::size_t i = 0; i < 360; ++i ) - { - DYNAMIC_SECTION( "Z Angle" << i ) - { - constexpr float offset { std::numbers::pi_v< float > / 360.0f }; - fgl::engine::QuatRotation rot1 { 0.0f, 0.0f, static_cast< float >( i ) * offset }; - - fgl::engine::QuatRotation rot2 { 0.0f, 0.0f, 0.0f }; - for ( std::size_t x = 0; x < i; ++x ) rot2.addZ( offset ); - - // compare both quaternions - using namespace Catch::Matchers; - - REQUIRE_THAT( rot1.internal_quat().x, WithinAbs( rot2.internal_quat().x, 0.01f ) ); - REQUIRE_THAT( rot1.internal_quat().y, WithinAbs( rot2.internal_quat().y, 0.01f ) ); - REQUIRE_THAT( rot1.internal_quat().z, WithinAbs( rot2.internal_quat().z, 0.01f ) ); - REQUIRE_THAT( rot1.internal_quat().w, WithinAbs( rot2.internal_quat().w, 0.01f ) ); - } - } - } - } -} diff --git a/src/tests/src/math/transform.cpp b/src/tests/src/math/transform.cpp deleted file mode 100644 index 8548208..0000000 --- a/src/tests/src/math/transform.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// Created by kj16609 on 2/18/25. -// - -#include "primitives/Transform.hpp" - -#include - -TEST_CASE( "Transform", "[transform]" ) -{ - using namespace fgl::engine::v2; - - SECTION( "Default" ) - { - TransformComponent transform {}; - - - - - - - - } -} diff --git a/src/tests/src/operators/vector.hpp b/src/tests/src/operators/vector.hpp deleted file mode 100644 index 93970dc..0000000 --- a/src/tests/src/operators/vector.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Created by kj16609 on 8/4/24. -// - -#pragma once - -namespace fgl::engine -{ - - inline bool operator==( const NormalVector& left, const NormalVector& right ) - { - const glm::vec3 high_range { left.vec() + glm::vec3( std::numeric_limits< float >::epsilon() ) }; - const glm::vec3 low_range { left.vec() - glm::vec3( std::numeric_limits< float >::epsilon() ) }; - - const auto within_high { glm::lessThanEqual( right.vec(), high_range ) }; - const auto within_low { glm::greaterThanEqual( right.vec(), low_range ) }; - - return glm::all( within_high ) && glm::all( within_low ); - } - - inline bool operator==( const Vector& left, const Vector& right ) - { - const glm::vec3 high_range { left.vec() + glm::vec3( std::numeric_limits< float >::epsilon() ) }; - const glm::vec3 low_range { left.vec() - glm::vec3( std::numeric_limits< float >::epsilon() ) }; - - const auto within_high { glm::lessThanEqual( right.vec(), high_range ) }; - const auto within_low { glm::greaterThanEqual( right.vec(), low_range ) }; - - return glm::all( within_high ) && glm::all( within_low ); - } - -} // namespace fgl::engine