Some more cleanup

This commit is contained in:
2024-03-11 21:48:24 -04:00
parent b82d68a7a7
commit 7374f8de8c
6 changed files with 37 additions and 9 deletions

View File

@@ -49,8 +49,6 @@ if (FORCE_DISABLE_IMGUI EQUAL 0)
endif ()
endif ()
target_compile_definitions(FGLEngine PRIVATE GLM_FORCE_INLINE=1)
#GLM settings
# GLM_FORCE_NO_CTOR_INIT
target_compile_definitions(FGLEngine PUBLIC GLM_FORCE_RADIANS GLM_FORCE_DEPTH_ZERO_TO_ONE GLM_FORCE_LEFT_HANDED)

View File

@@ -505,7 +505,7 @@ namespace fgl::engine
model->syncBuffers( command_buffer );
constexpr int val { 16 };
constexpr int val { 4 };
constexpr float x_offset { -( static_cast< float >( val ) * 30.0f ) / 2.0f };
constexpr float y_offset { -( static_cast< float >( val ) * 20.0f ) / 2.0f };
@@ -519,14 +519,15 @@ namespace fgl::engine
sponza.m_transform.translation = WorldCoordinate(
x_offset + ( static_cast< float >( y ) * 30.0f ),
y_offset + ( static_cast< float >( x ) * 20.0f ),
0.0f );
float( rand() % 120 ) - 60.0f );
sponza.m_transform.scale = { 0.007f, 0.007f, 0.007f };
sponza.m_transform.rotation = Rotation( 0.0f, 0.0f, 0.0f );
m_game_objects_root.addGameObject( std::move( sponza ) );
m_game_objects_root.recalculateBoundingBoxes();
std::cout << "(" << x << "," << y << ")" << std::endl;
}
}
m_game_objects_root.recalculateBoundingBoxes();
/*
{

View File

@@ -0,0 +1,26 @@
//
// Created by kj16609 on 3/11/24.
//
#if TRACY_ENABLE
void* operator new( std::size_t count )
{
auto ptr = malloc( count );
TracyAlloc( ptr, count );
return ptr;
}
void operator delete( void* ptr ) noexcept
{
TracyFree( ptr );
free( ptr );
}
void operator delete( void* ptr, [[maybe_unused]] std::size_t size ) noexcept
{
TracyFree( ptr );
free( ptr );
}
#endif

View File

@@ -113,7 +113,9 @@ namespace fgl::engine
std::uint64_t object_counter { 0 };
std::uint64_t primitive_counter { 0 };
for ( auto* node : info.game_objects.getAllLeafsInFrustum( info.camera_frustum ) )
const auto in_view_leafs { info.game_objects.getAllLeafsInFrustum( info.camera_frustum ) };
for ( auto* node : in_view_leafs )
{
ZoneScopedN( "Process leaf" );
for ( const auto& obj : *node )
@@ -159,7 +161,7 @@ namespace fgl::engine
cmd.instanceCount = 1;
std::vector< ModelMatrixInfo > matrix_infos {};
matrix_infos.reserve( 1024 );
matrix_infos.reserve( 128 );
matrix_infos.emplace_back( matrix_info );
draw_pairs.emplace( key, std::make_pair( cmd, std::move( matrix_infos ) ) );
}

View File

@@ -32,7 +32,6 @@ namespace fgl::engine
std::vector< NodeLeaf* > OctTreeNode::getAllLeafsInFrustum( const Frustum< CoordinateSpace::World >& frustum )
{
ZoneScoped;
std::vector< NodeLeaf* > leafs {};
//Check if we are inside of the frustum.
@@ -159,6 +158,8 @@ namespace fgl::engine
new_nodes[ RIGHT ][ BACK ][ BOTTOM ] =
std::make_unique< OctTreeNode >( WorldCoordinate( right_x, backward_y, bottom_z ), half_span, this );
[[assume( game_objects.size() <= MAX_NODES_IN_LEAF )]];
for ( GameObject& obj : game_objects )
{
const auto& obj_coordinate { obj.m_transform.translation };

View File

@@ -13,7 +13,7 @@ namespace fgl::engine
{
constexpr std::size_t MAX_NODES_IN_LEAF { 32 };
constexpr std::size_t STARTING_DEPTH { 4 };
constexpr float ROOT_SPAN { 1000.0f };
constexpr float ROOT_SPAN { std::numeric_limits< float >::max() };
template < CoordinateSpace CType >
struct Frustum;