Load engines from TOML and improve scenario audio and carb tuning

Migrate 32 engine definitions into validated startup-loaded TOML files and separate configuration and snapshots from scenario assembly. Add camera-based stereo propagation from shared pipe geometry, preserve exhaust character, tune carburetor mixtures and idle, use ignition cuts for carb engines, and support returning to the scenario menu.

Validation: full Windows build and all 14 CTest checks passed.
This commit is contained in:
max
2026-10-24 03:24:35 +02:00
parent 5607dcf2b5
commit bf8621ad39
82 changed files with 24084 additions and 648 deletions

View File

@@ -5,6 +5,7 @@ option(FLUIDSIM_BUILD_DESKTOP "Build the SFML windowed simulator with keyboard c
set(FLUIDSIM_FONT_FILE "" CACHE FILEPATH "Optional font file copied beside the desktop executable")
add_library(fluidsim_core
src/engine_config.cpp
src/carburetor.cpp
src/ecu.cpp
src/engine.cpp
@@ -17,11 +18,15 @@ add_library(fluidsim_core
src/outdoor_audio.cpp
src/outdoor_exhaust_reverb.cpp
src/scenario.cpp
src/scenario_snapshot.cpp
src/scenario_geometry.cpp
src/solver.cpp
src/vehicle.cpp
src/simulation_ring_buffer.cpp
)
target_include_directories(fluidsim_core PUBLIC include)
target_include_directories(fluidsim_core SYSTEM PRIVATE third_party/tomlplusplus)
target_compile_definitions(fluidsim_core PRIVATE FLUIDSIM_ENGINE_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/engines")
target_compile_features(fluidsim_core PUBLIC cxx_std_20)
option(FLUIDSIM_ENABLE_SIMD "Allow compiler SIMD in fluid kernels without fast-math" ON)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
@@ -109,6 +114,9 @@ endif()
include(CTest)
if(BUILD_TESTING)
add_executable(fluidsim_engine_config_tests tests/engine_config_tests.cpp)
target_link_libraries(fluidsim_engine_config_tests PRIVATE fluidsim_core)
add_test(NAME fluidsim_engine_config_tests COMMAND fluidsim_engine_config_tests)
add_executable(fluidsim_scenario_examples tests/scenario_examples.cpp)
target_link_libraries(fluidsim_scenario_examples PRIVATE fluidsim_core)
add_test(NAME fluidsim_scenario_examples COMMAND fluidsim_scenario_examples)
@@ -167,4 +175,24 @@ if(BUILD_TESTING)
add_test(NAME fluidsim_b205_regression COMMAND fluidsim_b205_regression)
endif()
add_executable(fluidsim_carb_calibration tools/carb_calibration.cpp)
target_link_libraries(fluidsim_carb_calibration PRIVATE fluidsim_core)
if(BUILD_TESTING)
add_test(NAME fluidsim_carb_calibration COMMAND fluidsim_carb_calibration --check)
endif()
include(cmake/MinGWRuntime.cmake)
# Keep definitions beside every built executable, including tests and CLI tools.
add_custom_target(fluidsim_engine_assets ALL
COMMAND ${CMAKE_COMMAND}
"-DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/engines"
"-DDESTINATION=${CMAKE_CURRENT_BINARY_DIR}/engines"
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyEngineConfigs.cmake")
get_property(fluidsim_targets DIRECTORY PROPERTY BUILDSYSTEM_TARGETS)
foreach(target IN LISTS fluidsim_targets)
get_target_property(target_type ${target} TYPE)
if(target_type STREQUAL "EXECUTABLE")
add_dependencies(${target} fluidsim_engine_assets)
endif()
endforeach()