Bunch of standard cleanup

This commit is contained in:
2024-11-01 15:34:31 -04:00
parent c8b68493d4
commit 6439b1cbf2
77 changed files with 456 additions and 438 deletions

View File

@@ -41,7 +41,7 @@ namespace fgl::engine::filesystem
current = std::make_unique< DirInfo >( test_path );
}
void destroyFileGUI()
void destroyFileGui()
{
folder_texture.reset();
file_texture.reset();
@@ -224,7 +224,7 @@ namespace fgl::engine::filesystem
ImGui::Text( data.filename.c_str() );
std::string str { toHumanByteSize( data.size ) };
const std::string str { toHumanByteSize( data.size ) };
ImGui::Text( str.c_str() );
ImGui::NextColumn();
ImGui::PopID();
@@ -260,7 +260,7 @@ namespace fgl::engine::filesystem
void FileBrowser::drawUp( const std::unique_ptr< DirInfo >& current_dir )
{
auto up { current_dir->up() };
const std::unique_ptr< DirInfo > up { current_dir->up() };
ImGui::PushID( up->m_path.c_str() );

View File

@@ -20,12 +20,12 @@ namespace fgl::engine::filesystem
static void openFolder( const DirInfo& dir );
static void drawUp( const std::unique_ptr< DirInfo >& up );
static void drawUp( const std::unique_ptr< DirInfo >& current_dir );
static void drawGui( FrameInfo& info );
static void drawFile( const FileInfo& data );
static void drawFolder( const DirInfo& data );
};
void destroyFileGUI();
void destroyFileGui();
} // namespace fgl::engine::filesystem

View File

@@ -95,7 +95,7 @@ namespace fgl::engine::gui
void drawCameraOutputs( FrameInfo& info )
{
auto& camera_list { info.m_camera_list };
const auto& camera_list { info.m_camera_list };
for ( const auto& weak_camera_ptr : camera_list )
{
if ( weak_camera_ptr.expired() ) continue;

View File

@@ -107,19 +107,19 @@ namespace fgl::engine::gui
constexpr float right_bar_size { 0.2f };
constexpr float bottom_bar_size { 0.4f };
ImGuiID lb_node {
const ImGuiID lb_node {
ImGui::DockBuilderSplitNode( primary_id, ImGuiDir_Left, left_bar_size, nullptr, &primary_id )
};
ImGuiID rb_node {
const ImGuiID rb_node {
ImGui::DockBuilderSplitNode( primary_id, ImGuiDir_Right, right_bar_size, nullptr, &primary_id )
};
ImGuiID bb_node {
const ImGuiID bb_node {
ImGui::DockBuilderSplitNode( primary_id, ImGuiDir_Down, bottom_bar_size, nullptr, &primary_id )
};
ImGuiID mv_node { primary_id };
const ImGuiID mv_node { primary_id };
//ImGuiID mv_node { ImGui::DockBuilderSplitNode( primary_id, ImGuiDir_Up, 1.0f - 0.3f, &primary_id, nullptr ) };
ImGui::DockBuilderDockWindow( OBJECT_TREE_VIEW_NAME, lb_node );
@@ -136,7 +136,7 @@ namespace fgl::engine::gui
}
// ImGui DockBuilder is still very much not ready for use.
// But let's try it anyways
// But let's try it anyway
void drawDock()
{
// ImGui::PushStyleVar( ImGuiStyleVar_WindowPadding, ImVec2( 0.0f, 0.0f ) );
@@ -297,7 +297,7 @@ namespace fgl::engine::gui
void cleanupImGui()
{
ZoneScoped;
filesystem::destroyFileGUI();
filesystem::destroyFileGui();
ImGui_ImplVulkan_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();

View File

@@ -9,7 +9,7 @@ namespace fgl::engine::gui
{
void drawObject( GameObject& game_object )
{
static std::string name_input_temp { "" };
static std::string name_input_temp {};
name_input_temp = game_object.getName();
ImGui::InputText( "Name", &name_input_temp );
if ( game_object.getName() != name_input_temp ) game_object.setName( name_input_temp );
@@ -22,23 +22,23 @@ namespace fgl::engine::gui
dragFloat3( "Scale", game_object.getScale() );
}
static GameObjectComponentPtr selected_component { nullptr };
static GameObjectComponentPtr SELECTED_COMPONENT { nullptr };
void drawComponentsList( GameObject& game_object )
{
ImGui::SeparatorText( "Components" );
for ( GameObjectComponentPtr component : game_object.getComponents() )
for ( const GameObjectComponentPtr component : game_object.getComponents() )
{
component->drawNode( selected_component );
component->drawNode( SELECTED_COMPONENT );
}
if ( selected_component )
if ( SELECTED_COMPONENT != nullptr )
{
ImGui::SeparatorText( "Selected Component" );
ImGui::PushID( ImGui::GetID( "ComponentEditor" ) );
selected_component->drawImGui();
ImGui::PushID( "ComponentEditor" );
SELECTED_COMPONENT->drawImGui();
ImGui::PopID();
}
}

View File

@@ -68,10 +68,10 @@ namespace fgl::engine::gui
if ( ImGui::TreeNode( "Device" ) )
{
ImGui::Text( "|- %s Allocated", to_string( gpu_allocated ).c_str() );
ImGui::Text( "|- %s Used ", to_string( gpu_used ).c_str() );
ImGui::Text( "|- %s Unused", to_string( gpu.free() ).c_str() );
ImGui::Text( "|- %s Available in most allocated buffer", to_string( gpu.m_largest_free_block ).c_str() );
ImGui::Text( "|- %s Allocated", toString( gpu_allocated ).c_str() );
ImGui::Text( "|- %s Used ", toString( gpu_used ).c_str() );
ImGui::Text( "|- %s Unused", toString( gpu.free() ).c_str() );
ImGui::Text( "|- %s Available in most allocated buffer", toString( gpu.m_largest_free_block ).c_str() );
ImGui::TreePop();
}
@@ -79,10 +79,10 @@ namespace fgl::engine::gui
if ( ImGui::TreeNode( "Host" ) )
{
ImGui::Text( "|- %s Allocated", to_string( host_allocated ).c_str() );
ImGui::Text( "|- %s Used ", to_string( host_used ).c_str() );
ImGui::Text( "|- %s Unused", to_string( host.free() ).c_str() );
ImGui::Text( "|- %s Available in most allocated buffer", to_string( host.m_largest_free_block ).c_str() );
ImGui::Text( "|- %s Allocated", toString( host_allocated ).c_str() );
ImGui::Text( "|- %s Used ", toString( host_used ).c_str() );
ImGui::Text( "|- %s Unused", toString( host.free() ).c_str() );
ImGui::Text( "|- %s Available in most allocated buffer", toString( host.m_largest_free_block ).c_str() );
ImGui::TreePop();
}
ImGui::Separator();
@@ -94,10 +94,10 @@ namespace fgl::engine::gui
ImGui::Text( "Name: %s", buffer->m_debug_name.c_str() );
ImGui::Text(
"Allocated: %s/%s (%2.1f\%)",
to_string( buffer->used() ).c_str(),
to_string( buffer->size() ).c_str(),
toString( buffer->used() ).c_str(),
toString( buffer->size() ).c_str(),
( static_cast< float >( buffer->used() ) / static_cast< float >( buffer->size() ) * 100.0f ) );
ImGui::Text( "Largest block: %s", to_string( buffer->largestBlock() ).c_str() );
ImGui::Text( "Largest block: %s", toString( buffer->largestBlock() ).c_str() );
ImGui::Separator();
}
}
@@ -109,9 +109,9 @@ namespace fgl::engine::gui
ImGui::Text( "FPS: %0.1f", ImGui::GetIO().Framerate );
const auto& counters { profiling::getCounters() };
ImGui::Text( "Models drawn: %zu", counters.models_draw );
ImGui::Text( "Verts drawn: %zu", counters.verts_drawn );
ImGui::Text( "Draw instances: %zu", counters.instance_count );
ImGui::Text( "Models drawn: %zu", counters.m_models_draw );
ImGui::Text( "Verts drawn: %zu", counters.m_verts_drawn );
ImGui::Text( "Draw instances: %zu", counters.m_instance_count );
if ( ImGui::CollapsingHeader( "Memory" ) )
{

View File

@@ -53,7 +53,7 @@ namespace fgl::engine::gui
obj.addFlag( IS_ENTITY | IS_VISIBLE );
std::unique_ptr< ModelComponent > component {
auto component {
std::make_unique< ModelComponent >( std::move( model ) )
};
@@ -208,16 +208,16 @@ namespace fgl::engine::gui
default:
[[fallthrough]];
case Composite:
camera.getSwapchain().g_buffer_composite_img[ frame_index ]->drawImGui( target_size );
camera.getSwapchain().m_g_buffer_composite_img[ frame_index ]->drawImGui( target_size );
break;
case Albedo:
camera.getSwapchain().g_buffer_color_img[ frame_index ]->drawImGui( target_size );
camera.getSwapchain().m_g_buffer_color_img[ frame_index ]->drawImGui( target_size );
break;
case Normal:
camera.getSwapchain().g_buffer_normal_img[ frame_index ]->drawImGui( target_size );
camera.getSwapchain().m_g_buffer_normal_img[ frame_index ]->drawImGui( target_size );
break;
case Position:
camera.getSwapchain().g_buffer_position_img[ frame_index ]->drawImGui( target_size );
camera.getSwapchain().m_g_buffer_position_img[ frame_index ]->drawImGui( target_size );
break;
}

View File

@@ -2,6 +2,9 @@
// Created by kj16609 on 6/5/24.
//
// ReSharper disable CppDFAInfiniteRecursion
// ReSharper disable CppInconsistentNaming
// ReSharper disable CppZeroConstantCanBeReplacedWithNullptr
#pragma once
#pragma GCC diagnostic push
@@ -22,7 +25,7 @@ namespace ImGui
{
//void ImGui::DockBuilderDockWindow(const char* window_name, ImGuiID node_id)
FGL_FORCE_INLINE inline void DockBuilderDockWindow( const std::string_view str, ImGuiID node_id )
FGL_FORCE_INLINE inline void DockBuilderDockWindow( const std::string_view str, const ImGuiID node_id )
{
::ImGui::DockBuilderDockWindow( str.data(), node_id );
}
@@ -42,14 +45,17 @@ namespace ImGui
// IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // return true when activated.
FGL_FORCE_INLINE inline bool MenuItem(
const std::string_view label, const char* shortcut = NULL, bool selected = false, bool enabled = true )
const std::string_view label,
const char* shortcut = NULL,
const bool selected = false,
const bool enabled = true )
{
return ::ImGui::MenuItem( label.data(), shortcut, selected, enabled );
}
// IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL
FGL_FORCE_INLINE inline bool
MenuItem( const std::string_view label, const char* shortcut, bool* selected, bool enabled = true )
MenuItem( const std::string_view label, const char* shortcut, bool* selected, const bool enabled = true )
{
return ::ImGui::MenuItem( label.data(), shortcut, selected, enabled );
}