From 8e2e681b2ce1aff5d61e4cd77db6f33dca8f305d Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 12 Mar 2026 08:48:14 +0100 Subject: [PATCH] el benchmark es fa ara amb una figura i no amb el mode de fisica --- source/engine.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/engine.cpp b/source/engine.cpp index 7fa8c4e..b6e2135 100644 --- a/source/engine.cpp +++ b/source/engine.cpp @@ -1667,17 +1667,22 @@ void Engine::runPerformanceBenchmark() { const int BENCH_DURATION_MS = 600; const int WARMUP_FRAMES = 5; + SimulationMode original_mode = current_mode_; + auto restore = [&]() { SDL_SetRenderVSync(renderer_, vsync_enabled_ ? 1 : 0); SDL_ShowWindow(window_); - scene_manager_->changeScenario(0, current_mode_); + current_mode_ = original_mode; + active_shape_.reset(); + scene_manager_->changeScenario(0, original_mode); last_frame_time_ = 0; }; // Test escenario custom (independiente de max_auto_scenario_) custom_auto_available_ = false; if (custom_scenario_enabled_) { - scene_manager_->changeScenario(CUSTOM_SCENARIO_IDX, current_mode_); + scene_manager_->changeScenario(CUSTOM_SCENARIO_IDX, SimulationMode::SHAPE); + activateShapeInternal(ShapeType::SPHERE); last_frame_time_ = 0; for (int w = 0; w < WARMUP_FRAMES; ++w) { calculateDeltaTime(); @@ -1700,7 +1705,8 @@ void Engine::runPerformanceBenchmark() { // Probar de más pesado a más ligero for (int idx = DEMO_AUTO_MAX_SCENARIO; idx >= DEMO_AUTO_MIN_SCENARIO; --idx) { - scene_manager_->changeScenario(idx, current_mode_); + scene_manager_->changeScenario(idx, SimulationMode::SHAPE); + activateShapeInternal(ShapeType::SPHERE); // Warmup: estabilizar física y pipeline GPU last_frame_time_ = 0;