refactor: move scenes to dedicated CMakeLists.txt + clean arg parsing help

- Extract scenes_cube/scenes_sphere (and convenience 'scenes' interface) to scenes/CMakeLists.txt.
- Main CMakeLists.txt now much cleaner (single add_subdirectory(scenes)).
- Updated help text in cuber.cpp to clearly separate Flags vs Keys (less confusing 'S' section).
- No behavior change; depth/viewport/state/post-processing fixes from earlier remain.

Followed project conventions and AGENTS.md commit rules.
This commit is contained in:
2026-05-06 00:50:09 +02:00
parent c83561c0fa
commit 6c1096fbb8
3 changed files with 26 additions and 24 deletions
+7 -4
View File
@@ -17,18 +17,21 @@
auto main(int argc, char const* argv[]) -> int {
float max_duration_seconds = 0.0f;
std::string_view scene_name = "cube";
std::string scene_name = "cube"; // "cube", "sphere", or "2" (for compatibility with keys)
bool take_screenshot = false;
for (int i = 1; i < argc; ++i) {
std::string_view arg = argv[i];
if (arg == "--help" || arg == "-h") {
fmt::print("Usage: {} [options]\n", argv[0]);
fmt::print("Flags:\n");
fmt::print(" --duration <seconds> Auto-terminate after N seconds (for testing/CI)\n");
fmt::print(" --scene <cube|sphere> Select initial scene (default: cube)\n");
fmt::print(" --screenshot Render one frame, save screenshot, and exit\n");
fmt::print(" S key Take screenshot (saved as screenshot.png)\n");
fmt::print(" 1/2 key Switch between cube/sphere scene\n");
fmt::print("\nKeys (during runtime):\n");
fmt::print(" S Take screenshot (saved as screenshot.png)\n");
fmt::print(" 1/2 Switch between cube/sphere scene\n");
fmt::print(" Q Quit\n");
return 0;
}
if (arg == "--duration" && i + 1 < argc) {
@@ -36,7 +39,7 @@ auto main(int argc, char const* argv[]) -> int {
continue;
}
if (arg == "--scene" && i + 1 < argc) {
scene_name = argv[++i];
scene_name = argv[++i]; // std::string to avoid string_view lifetime gotchas with argv
continue;
}
if (arg == "--screenshot") {