More test fiddling

This commit is contained in:
2024-02-16 20:09:15 -05:00
parent 408d767dcd
commit 0a5ae5505b
7 changed files with 21 additions and 26 deletions

View File

@@ -28,7 +28,7 @@ namespace fgl::engine::constants
constexpr float DEFAULT_FLOAT { std::numeric_limits< float >::max() };
constexpr float NEAR_PLANE { 0.1f };
constexpr float FAR_PLANE { 5.0f };
constexpr float FAR_PLANE { 100.0f };
constexpr glm::vec3 CENTER { 0.0f, 0.0f, 0.0f };
} // namespace fgl::engine::constants

View File

@@ -22,9 +22,6 @@ namespace fgl::engine::debug
ZoneScoped;
const ImVec2 window_size { windowSize() };
world_point.z = -world_point.z;
world_point.x = -world_point.x;
return Coordinate< CoordinateSpace::Screen >( glm::project(
static_cast< glm::vec3 >( world_point ),
glm::mat4( 1.0f ),

View File

@@ -125,10 +125,6 @@ namespace fgl::engine
const auto yp { xp_yp_zp.y };
const auto zp { xp_yp_zp.z };
assert( xp > xn );
assert( yp > yn );
assert( zp > zn );
//Top
const glm::vec3 xn_yp_zp { xn, yp, zp }; // (- + +)
const glm::vec3 xn_yp_zn { xn, yp, zn }; // (- + -)

View File

@@ -10,6 +10,7 @@ using namespace fgl::engine;
TEST_CASE( "BoundingBox", "[boundingbox]" )
{
SECTION( "Combine test" )
{
std::vector< Coordinate< CoordinateSpace::Model > > model_points {};
@@ -50,6 +51,7 @@ TEST_CASE( "BoundingBox", "[boundingbox]" )
}
}
#ifdef FGL_ENABLE_BENCHMARKS
BENCHMARK( "Combine bounding box" )
{
auto generatePoints = []()
@@ -89,4 +91,5 @@ TEST_CASE( "BoundingBox", "[boundingbox]" )
return model_box;
};
#endif
}

View File

@@ -40,9 +40,16 @@ TEST_CASE( "Frustum", "[frustum][rotation][translation]" )
//Verify that during a translation the direction isn't changed
REQUIRE( translated_backwards.near.direction() == base_frustum.near.direction() );
const glm::vec3 target_near { ( constants::WORLD_FORWARD * constants::NEAR_PLANE )
- constants::WORLD_FORWARD };
const glm::vec3 target_far { ( constants::WORLD_FORWARD * constants::FAR_PLANE )
- constants::WORLD_FORWARD };
REQUIRE( translated_backwards.near.getPosition() == glm::vec3 { target_near } );
REQUIRE( translated_backwards.near.direction() == constants::WORLD_FORWARD );
REQUIRE( translated_backwards.near.distance() == constants::NEAR_PLANE - 1.0f );
REQUIRE( translated_backwards.far.getPosition() == target_far );
REQUIRE( translated_backwards.far.direction() == constants::WORLD_BACKWARD );
REQUIRE( translated_backwards.far.distance() == -( constants::FAR_PLANE - 1.0f ) );
// The distance for the far plane should be negative. Due to the fact

View File

@@ -9,12 +9,6 @@
using namespace fgl::engine;
std::ostream& operator<<( std::ostream& os, const glm::vec3 vec )
{
os << "X: " << vec.x << " Y: " << vec.y << " Z: " << vec.z;
return os;
}
TEST_CASE( "Transform", "[transform][rotation][translation]" )
{
TransformComponent component;

View File

@@ -4,19 +4,17 @@
#pragma once
namespace glm
{
inline void PrintTo( const glm::vec3& vec, ::std::ostream* os )
{
*os << "(" << vec.x << "," << vec.y << "," << vec.z << ")";
}
#include <catch2/catch_tostring.hpp>
} // namespace glm
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/string_cast.hpp>
namespace fgl::engine
namespace Catch
{
inline void PrintTo( const Vector& vec, ::std::ostream* os )
template <>
struct StringMaker< const glm::vec3 >
{
glm::PrintTo( static_cast< glm::vec3 >( vec ), os );
}
} // namespace fgl::engine
static std::string convert( glm::vec3 const & val ) { return glm::to_string( val ); }
};
} // namespace Catch