diff --git a/src/engine/EngineContext.cpp b/src/engine/EngineContext.cpp index 737ee25..23a0a49 100644 --- a/src/engine/EngineContext.cpp +++ b/src/engine/EngineContext.cpp @@ -446,9 +446,7 @@ namespace fgl::engine #if ENABLE_IMGUI { -#if TRACY_ENABLE TracyVkZone( tracy_ctx, command_buffer, "ImGui Rendering" ); -#endif debug::world:: drawPointText( Coordinate< CoordinateSpace::World >( 0.0f, 0.0f, 0.0f ), { 1.0f, 0.0f, 0.0f } ); diff --git a/src/engine/KeyboardMovementController.cpp b/src/engine/KeyboardMovementController.cpp index 741c6fb..9a99ce4 100644 --- a/src/engine/KeyboardMovementController.cpp +++ b/src/engine/KeyboardMovementController.cpp @@ -29,6 +29,7 @@ namespace fgl::engine void KeyboardMovementController::moveInPlaneXZ( GLFWwindow* window, float dt, fgl::engine::GameObject& target ) { + assert( window ); constexpr float rotation_rate { 1.0f }; constexpr float pitch_modifier { 1.0f }; constexpr float yaw_modifier { 1.0f }; diff --git a/src/engine/buffers/UniqueFrameSuballocation.hpp b/src/engine/buffers/UniqueFrameSuballocation.hpp index f681e04..69a04f9 100644 --- a/src/engine/buffers/UniqueFrameSuballocation.hpp +++ b/src/engine/buffers/UniqueFrameSuballocation.hpp @@ -30,7 +30,13 @@ namespace fgl::engine void setMaxFramesInFlight( std::uint16_t max ) { m_suballocations.resize( max ); } - Suballocation& operator[]( std::uint16_t index ) { return *m_suballocations[ index ]; } + Suballocation& operator[]( std::uint16_t index ) + { + assert( m_suballocations.size() >= index ); + assert( m_suballocations[ index ] ); + + return *m_suballocations[ index ]; + } void bindForFrame( vk::CommandBuffer& cmd_buffer, std::uint16_t frame_idx ) { diff --git a/src/engine/systems/CullingSystem.cpp b/src/engine/systems/CullingSystem.cpp index dbbaf08..6dc7bc6 100644 --- a/src/engine/systems/CullingSystem.cpp +++ b/src/engine/systems/CullingSystem.cpp @@ -21,6 +21,7 @@ namespace fgl::engine for ( auto* leaf : info.game_objects.getAllLeafsInFrustum( frustum ) ) { + assert( leaf ); for ( auto& obj : *leaf ) { //Has model? diff --git a/src/engine/tree/octtree/OctTreeNode.cpp b/src/engine/tree/octtree/OctTreeNode.cpp index c1bbb28..6836d5c 100644 --- a/src/engine/tree/octtree/OctTreeNode.cpp +++ b/src/engine/tree/octtree/OctTreeNode.cpp @@ -25,9 +25,16 @@ namespace fgl::engine { case 0: // NodeArray { + assert( std::holds_alternative< NodeArray >( m_node_data ) ); NodeArray& node_array { std::get< NodeArray >( m_node_data ) }; //Search deeper +#ifndef NDEBUG + for ( int x = 0; x < 2; ++x ) + for ( int y = 0; y < 2; ++y ) + for ( int z = 0; z < 2; ++z ) assert( node_array[ x ][ y ][ z ] ); +#endif + { const auto ret { node_array[ LEFT ][ FORWARD ][ TOP ]->getAllLeafsInFrustum( frustum ) }; leafs = std::move( ret ); @@ -67,10 +74,11 @@ namespace fgl::engine } case 1: // NodeLeaf { + assert( std::holds_alternative< NodeLeaf >( m_node_data ) ); leafs.reserve( 4096 ); leafs.emplace_back( &std::get< NodeLeaf >( m_node_data ) ); - // debug::world::drawBoundingBox( m_bounds ); + //debug::world::drawBoundingBox( m_bounds ); return leafs; }