Cleanup more transfer buffer things

This commit is contained in:
2025-07-04 07:41:59 -04:00
parent f1fd5f24ad
commit 52f4ae3e44
23 changed files with 218 additions and 115 deletions

View File

@@ -17,6 +17,18 @@ namespace fgl::engine::components
void ModelComponent::drawImGui()
{
ImGui::Text( "Primitives: " );
ImGui::SameLine();
ImGui::Text( "%li", m_model_instance->m_model->m_primitives.size() );
// list each primitive and list the buffer that it is stored in
for ( const auto& primitive : m_model_instance->m_model->m_primitives )
{
ImGui::Text( "Primitive: %s", primitive.m_name.c_str() );
ImGui::SameLine();
ImGui::Text( "Buffer: %s", primitive.m_vertex_buffer.getBuffer()->sizeName().c_str() );
}
// drawComponentTransform( m_transform );
// TODO: If the model is not set then we should be able to set it to one from the file selection

View File

@@ -11,6 +11,7 @@
#include <imgui_internal.h> // Included for DockBuilder since it's not exposed yet
#pragma GCC diagnostic pop
#include "EngineContext.hpp"
#include "FileBrowser.hpp"
#include "engine/assets/model/Model.hpp"
#include "engine/debug/DEBUG_NAMES.hpp"
@@ -95,7 +96,7 @@ namespace fgl::engine::gui
// ImGui::PopStyleVar();
}
static GameObject* selected_object { nullptr };
static std::weak_ptr< GameObject > selected_object {};
void itterateGameObjectNode( FrameInfo& info, OctTreeNode& node )
{
@@ -152,6 +153,20 @@ namespace fgl::engine::gui
ZoneScoped;
ImGui::Begin( OBJECT_TREE_VIEW_NAME );
auto& game_objects { info.m_game_objects };
for ( auto& object : game_objects )
{
ImGui::PushID( object->getId() );
if ( ImGui::Selectable( object->getName().c_str() ) )
{
selected_object = object;
}
ImGui::PopID();
}
// itterateGameObjectNode( info, info.game_objects );
/*
@@ -179,14 +194,16 @@ namespace fgl::engine::gui
ZoneScoped;
ImGui::Begin( ENTITY_INFO_NAME );
if ( !selected_object )
if ( selected_object.expired() )
{
ImGui::End();
return;
}
drawObject( *selected_object );
drawComponentsList( *selected_object );
const auto object { selected_object.lock() };
drawObject( *object );
drawComponentsList( *object );
ImGui::End();
}

View File

@@ -42,19 +42,19 @@ namespace fgl::engine::gui
case filesystem::MODEL:
{
// Load model and drop it into the game objects
GameObject obj { GameObject::createGameObject() };
auto obj { GameObject::createGameObject() };
std::shared_ptr< Model > model { Model::createModel( data->m_path ) };
obj.addFlag( IsEntity | IsVisible );
obj->addFlag( IsEntity | IsVisible );
// info.context.models().loadModel( data->m_path );
auto component { std::make_unique< components::ModelComponent >( model ) };
obj.addComponent( std::move( component ) );
obj->addComponent( std::move( component ) );
info.game_objects.emplace_back( std::move( obj ) );
info.m_game_objects.emplace_back( std::move( obj ) );
break;
}
@@ -65,11 +65,11 @@ namespace fgl::engine::gui
builder.loadScene( data->m_path );
std::vector< GameObject > objs { builder.getGameObjects() };
std::vector< std::shared_ptr< GameObject > > objs { builder.getGameObjects() };
for ( auto& obj : objs )
{
info.game_objects.emplace_back( std::move( obj ) );
info.m_game_objects.emplace_back( std::move( obj ) );
}
}
}

View File

@@ -8,7 +8,6 @@
#include "engine/EngineContext.hpp"
#include "engine/camera/CameraManager.hpp"
#include "engine/debug/timing/FlameGraph.hpp"
#include "engine/gameobjects/components/CameraComponent.hpp"
#include "gui/EditorGuiContext.hpp"
int main()
@@ -80,19 +79,19 @@ int main()
builder.loadScene( sponza_path );
std::vector< GameObject > objs { builder.getGameObjects() };
std::vector< std::shared_ptr< GameObject > > objs { builder.getGameObjects() };
for ( auto& obj : objs )
{
if ( obj.hasComponent< components::ModelComponent >() )
if ( obj->hasComponent< components::ModelComponent >() )
{
auto model_components { obj.getComponents< components::ModelComponent >() };
auto model_components { obj->getComponents< components::ModelComponent >() };
for ( auto& component : model_components )
{}
}
engine_ctx.game_objects.emplace_back( std::move( obj ) );
engine_ctx.m_game_objects.emplace_back( std::move( obj ) );
}
}