Skip to content

Commit

Permalink
[editor] the world viewer will now the display the entity tree withou…
Browse files Browse the repository at this point in the history
…t a top node called "root"
  • Loading branch information
PanosK92 committed Oct 31, 2024
1 parent 8324f78 commit 84442b0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 44 deletions.
39 changes: 12 additions & 27 deletions editor/Widgets/WorldViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,37 +93,22 @@ void WorldViewer::TreeShow()
bool is_in_game_mode = Spartan::Engine::IsFlagSet(Spartan::EngineMode::Playing);
ImGui::BeginDisabled(is_in_game_mode);
{
if (ImGui::TreeNodeEx("Root", ImGuiTreeNodeFlags_DefaultOpen | ImGuiTreeNodeFlags_SpanFullWidth))
// iterate over root entities directly, omitting the root node
vector<shared_ptr<Spartan::Entity>> root_entities = Spartan::World::GetRootEntities();
for (const shared_ptr<Spartan::Entity>& entity : root_entities)
{
// dropping on the scene node should unparent the entity
if (auto payload = ImGuiSp::receive_drag_drop_payload(ImGuiSp::DragPayloadType::Entity))
if (entity->IsActive())
{
const uint64_t entity_id = get<uint64_t>(payload->data);
if (const shared_ptr<Spartan::Entity>& dropped_entity = Spartan::World::GetEntityById(entity_id))
{
shared_ptr<Spartan::Entity> null = nullptr;
dropped_entity->SetParent(null);
}
}

vector<shared_ptr<Spartan::Entity>> root_entities = Spartan::World::GetRootEntities();
for (const shared_ptr<Spartan::Entity>& entity : root_entities)
{
if (entity->IsActive())
{
TreeAddEntity(entity);
}
}

// if we have been expanding to show an entity and no more expansions are taking place, we reached it
// so, we stop expanding and we bring it into view
if (m_expand_to_selection && !m_expanded_to_selection)
{
ImGui::ScrollToBringRectIntoView(m_window, m_selected_entity_rect);
m_expand_to_selection = false;
TreeAddEntity(entity);
}
}

ImGui::TreePop();
// if we have been expanding to show an entity and no more expansions are taking place, we reached it
// so, we stop expanding and we bring it into view
if (m_expand_to_selection && !m_expanded_to_selection)
{
ImGui::ScrollToBringRectIntoView(m_window, m_selected_entity_rect);
m_expand_to_selection = false;
}
}
ImGui::EndDisabled();
Expand Down
31 changes: 14 additions & 17 deletions runtime/Rendering/Renderer_Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,28 +403,25 @@ namespace Spartan
}
}

// render resolution
// render at render resolution (only opaques)
{
// opaque
{
bool is_transparent = false;
Pass_Visibility(cmd_list_graphics);
Pass_Depth_Prepass(cmd_list_graphics);
Pass_GBuffer(cmd_list_graphics, is_transparent);
Pass_Ssr(cmd_list_graphics);
Pass_Ssao(cmd_list_graphics);
Pass_Sss(cmd_list_graphics);
Pass_Light(cmd_list_graphics, is_transparent); // compute diffuse and specular buffers
Pass_Light_GlobalIllumination(cmd_list_graphics); // compute global illumination
Pass_Light_Composition(cmd_list_graphics, is_transparent); // compose all light (diffuse, specular, etc.)
Pass_Light_ImageBased(cmd_list_graphics, is_transparent); // apply IBL (skysphere, ssr, global illumination etc.)
}
bool is_transparent = false;
Pass_Visibility(cmd_list_graphics);
Pass_Depth_Prepass(cmd_list_graphics);
Pass_GBuffer(cmd_list_graphics, is_transparent);
Pass_Ssr(cmd_list_graphics);
Pass_Ssao(cmd_list_graphics);
Pass_Sss(cmd_list_graphics);
Pass_Light(cmd_list_graphics, is_transparent); // compute diffuse and specular buffers
Pass_Light_GlobalIllumination(cmd_list_graphics); // compute global illumination
Pass_Light_Composition(cmd_list_graphics, is_transparent); // compose all light (diffuse, specular, etc.)
Pass_Light_ImageBased(cmd_list_graphics, is_transparent); // apply IBL (skysphere, ssr, global illumination etc.)
}

// render to output resolution
// upscale to output resolution
Pass_Upscale(cmd_list_graphics);

// output resolution
// render at output resolution
{
// transparent
if (mesh_index_transparent != -1)
Expand Down

0 comments on commit 84442b0

Please sign in to comment.