aboutsummaryrefslogtreecommitdiff
path: root/src/States/WorldBuilderState.cpp
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2025-08-21 19:08:34 +0200
committerhachem <im@hachem.wtf>2025-08-21 19:08:34 +0200
commit6f72049359651155be62846e7d080d7a5e871096 (patch)
tree2d07767c82264c0a126708176c9939806c9a7171 /src/States/WorldBuilderState.cpp
parent1bd39d11ff76e61bc3cc8b58286092a84997cc20 (diff)
[fix]: proper scene loading
Diffstat (limited to 'src/States/WorldBuilderState.cpp')
-rw-r--r--src/States/WorldBuilderState.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/States/WorldBuilderState.cpp b/src/States/WorldBuilderState.cpp
index 63ef25c..70ef3d4 100644
--- a/src/States/WorldBuilderState.cpp
+++ b/src/States/WorldBuilderState.cpp
@@ -484,6 +484,18 @@ namespace Donut
ImGui::Spacing();
+ if (ImGui::Button("Start Simulation", ImVec2(ImGui::GetWindowWidth() - 20, 30)))
+ {
+ // Load objects from WorldBuilder scene into Engine
+ auto& engine = Application::Get().GetEngine();
+ engine.LoadObjectsFromScene(m_Scene.objs);
+
+ // Switch to simulation state
+ Application::Get().GetStateManager().SwitchToState("Simulation");
+ }
+
+ ImGui::Spacing();
+
if (ImGui::Button("Back to Config", ImVec2(ImGui::GetWindowWidth() - 20, 30)))
Application::Get().GetStateManager().SwitchToState("Config");
@@ -550,7 +562,6 @@ namespace Donut
Object sphere(m_NewObjectPosition, m_NewObjectRadius, material);
m_Scene.objs.push_back(sphere);
- // Automatically select the newly created object
m_SelectedObjectIndex = static_cast<int>(m_Scene.objs.size() - 1);
m_NewObjectPosition = glm::vec3(0.0f, 0.0f, 0.0f);