Some cleanup

This commit is contained in:
2024-11-03 14:28:39 -05:00
parent 46464fa6d2
commit 800f33427f
5 changed files with 11 additions and 18 deletions

View File

@@ -12,7 +12,7 @@ namespace fgl::engine::memory
//! Aligns a memory region to a given alignment
template < typename T1, typename T2 >
requires std::is_integral_v< T1 > && std::is_integral_v< T2 >
constexpr inline T1 align( const T1 operand, const T2 alignment )
constexpr T1 align( const T1 operand, const T2 alignment )
{
if ( alignment == 0 || alignment == 1 ) return operand;
@@ -30,7 +30,7 @@ namespace fgl::engine::memory
//! Aligns the operand to multiple alignments
template < typename T1, typename T2, typename... T2s >
constexpr inline T1 align( const T1 operand, const T2 alignment, const T2s... alignments )
constexpr T1 align( const T1 operand, const T2 alignment, const T2s... alignments )
{
return align( align( operand, alignment ), alignments... );
}

View File

@@ -21,8 +21,8 @@ namespace fgl::engine
Frustum operator*( const Matrix< MatrixType::ModelToWorld >& matrix, const FrustumBase& frustum )
{
const Frustum result { matrix * frustum.m_near, matrix * frustum.m_far, matrix * frustum.m_top,
matrix * frustum.m_bottom, matrix * frustum.m_right, matrix * frustum.m_left,
const Frustum result { matrix * frustum.m_near, matrix * frustum.m_far, matrix * frustum.m_top,
matrix * frustum.m_bottom, matrix * frustum.m_right, matrix * frustum.m_left,
matrix * frustum.m_position };
return result;
@@ -47,10 +47,6 @@ namespace fgl::engine
bool Frustum::containsPoint( const WorldCoordinate coord ) const
{
static_assert(
CoordinateSpace::World == CoordinateSpace::World,
"pointInside can only be called on World coordinate Frustums" );
//Ensure the point we are not trying to test a NaN point
assert( coord.x != std::numeric_limits< decltype( coord.x ) >::quiet_NaN() );
assert( coord.y != std::numeric_limits< decltype( coord.y ) >::quiet_NaN() );
@@ -61,8 +57,8 @@ namespace fgl::engine
// We can either make this non-biased by using a projection from distance shot down the FORWARD vector
// Or we can use SIMD to check all the planes at once.
return m_near.isForward( coord ) && m_far.isForward( coord ) && m_bottom.isForward( coord ) && m_top.isForward( coord )
&& m_right.isForward( coord ) && m_left.isForward( coord );
return m_near.isForward( coord ) && m_far.isForward( coord ) && m_bottom.isForward( coord )
&& m_top.isForward( coord ) && m_right.isForward( coord ) && m_left.isForward( coord );
}
bool Frustum::containsAnyPoint( const std::vector< WorldCoordinate >& coords ) const

View File

@@ -65,7 +65,7 @@ namespace fgl::engine
{
glm::mat4 localMatrix = matrix;
glm::vec4 perspective;
[[maybe_unused]] glm::vec4 perspective;
glm::vec3 scale;
glm::vec3 skew;

View File

@@ -71,14 +71,11 @@ namespace fgl::engine
return m_top_right_forward == other.m_top_right_forward && m_bottom_left_back == other.m_bottom_left_back;
}
virtual Coordinate< CType > getPosition() const final
{
return midpoint( m_top_right_forward, m_bottom_left_back );
}
Coordinate< CType > getPosition() const { return midpoint( m_top_right_forward, m_bottom_left_back ); }
virtual inline Coordinate< CType > topLeftForward() const final { return m_top_right_forward; }
inline Coordinate< CType > topLeftForward() const { return m_top_right_forward; }
virtual inline Coordinate< CType > bottomLeftBack() const final { return m_bottom_left_back; }
inline Coordinate< CType > bottomLeftBack() const { return m_bottom_left_back; }
virtual Scale scale() const;

View File

@@ -71,7 +71,7 @@ namespace fgl::engine
auto& command_buffer { setupSystem( info ) };
TracyVkZone( info.tracy_ctx, *command_buffer, "Draw debug lines" );
if ( m_lines.size() == 0 ) return;
if ( m_lines.empty() ) return;
auto& line_vertex_buffer { m_line_vertex_buffer[ info.frame_idx ] };