feat(pipeline): add WOL preset variants for cave/dungeon/night

Three new single-keyframe WOL presets complement the
existing 4-keyframe day/night cycle from --gen-light:

  • --gen-light-cave    — dim cool ambient (0.05, 0.05, 0.07)
                          + heavy short-range fog (15..80)
                          for cave / mine interiors
  • --gen-light-dungeon — warm torchlit ambient (0.18, 0.14,
                          0.10) + medium fog (25..200) for
                          dungeon / crypt interiors
  • --gen-light-night   — cold blue ambient (0.06, 0.07, 0.12)
                          + moonlit directional + far fog
                          (80..500) for always-night zones

Each preset emits a single-keyframe WOL since enclosed /
fixed-time scenes don't vary with time-of-day. All three
share an emitLightPreset helper so adding more presets
(e.g. --gen-light-tundra, --gen-light-volcanic) is one
line of registration + a maker function.

All four WOL outputs validate clean under --validate-wol
(1 or 4 keyframe(s) valid).
This commit is contained in:
Kelsi 2026-05-09 14:01:26 -07:00
parent 2b96863db9
commit 8f16a27253
5 changed files with 113 additions and 11 deletions

View file

@ -59,6 +59,17 @@ public:
// file users can edit.
static WoweeLight makeDefaultDayNight(const std::string& zoneName);
// Preset variants for non-outdoor zones — these emit a
// single-keyframe WOL since the lighting doesn't vary by
// time-of-day for an enclosed scene.
//
// makeCave dim blue ambient + heavy fog
// makeDungeon moody indoor torchlit + medium fog
// makeNight dark blue ambient + far fog (night-only zone)
static WoweeLight makeCave(const std::string& zoneName);
static WoweeLight makeDungeon(const std::string& zoneName);
static WoweeLight makeNight(const std::string& zoneName);
// Lookup the interpolated lighting state at any time-of-day
// (clamped to 0..1439 minutes). Linearly blends between the
// two adjacent keyframes; wraps around midnight if the query

View file

@ -152,6 +152,52 @@ WoweeLight::Keyframe WoweeLightLoader::sampleAtTime(
return out;
}
WoweeLight WoweeLightLoader::makeCave(const std::string& zoneName) {
WoweeLight out;
out.name = zoneName;
// Single dim keyframe (caves don't change with time-of-day).
out.keyframes.push_back({
720, // noon (arbitrary)
glm::vec3(0.05f, 0.05f, 0.07f), // very dim cool ambient
glm::vec3(0.10f, 0.10f, 0.14f), // faint indirect bounce
glm::vec3(0.0f, -1.0f, 0.0f),
glm::vec3(0.04f, 0.05f, 0.07f), // near-black fog
15.0f, 80.0f // heavy short-range fog
});
return out;
}
WoweeLight WoweeLightLoader::makeDungeon(const std::string& zoneName) {
WoweeLight out;
out.name = zoneName;
// Single moody warm-torchlit keyframe.
out.keyframes.push_back({
720,
glm::vec3(0.18f, 0.14f, 0.10f), // warm dim ambient
glm::vec3(0.55f, 0.40f, 0.25f), // amber torchlight tint
glm::vec3(0.0f, -1.0f, 0.0f),
glm::vec3(0.10f, 0.08f, 0.06f), // dark warm fog
25.0f, 200.0f // medium fog range
});
return out;
}
WoweeLight WoweeLightLoader::makeNight(const std::string& zoneName) {
WoweeLight out;
out.name = zoneName;
// Single dark-night keyframe (e.g., always-night zones like
// some druid graves or shadow-realm scenes).
out.keyframes.push_back({
0,
glm::vec3(0.06f, 0.07f, 0.12f), // cold dim blue ambient
glm::vec3(0.18f, 0.20f, 0.32f), // moonlight-tinted directional
glm::vec3(0.30f, -0.94f, 0.0f), // moon at low angle
glm::vec3(0.05f, 0.06f, 0.10f), // near-black blue fog
80.0f, 500.0f // far fog (open night air)
});
return out;
}
WoweeLight WoweeLightLoader::makeDefaultDayNight(
const std::string& zoneName) {
WoweeLight out;

View file

@ -16,6 +16,7 @@ const char* const kArgRequired[] = {
"--info-mesh-storage-budget", "--info-mesh-stats",
"--info-wob", "--info-wob-stats", "--info-woc", "--info-wot",
"--info-wol", "--info-wol-at", "--validate-wol", "--gen-light",
"--gen-light-cave", "--gen-light-dungeon", "--gen-light-night",
"--info-creatures", "--info-objects", "--info-quests",
"--info-extract", "--info-extract-tree", "--info-extract-budget",
"--list-missing-sidecars",

View file

@ -783,6 +783,12 @@ void printUsage(const char* argv0) {
std::printf(" Walk every keyframe; check time bounds + sort order + fogEnd > fogStart + finite color components\n");
std::printf(" --gen-light <wol-base> [zoneName]\n");
std::printf(" Emit a starter .wol with the canonical 4-keyframe day/night cycle (midnight + dawn + noon + dusk)\n");
std::printf(" --gen-light-cave <wol-base> [zoneName]\n");
std::printf(" Emit a single-keyframe .wol with dim cool ambient + heavy short-range fog (cave / mine interior)\n");
std::printf(" --gen-light-dungeon <wol-base> [zoneName]\n");
std::printf(" Emit a single-keyframe .wol with warm torchlit ambient + medium fog (dungeon / crypt interior)\n");
std::printf(" --gen-light-night <wol-base> [zoneName]\n");
std::printf(" Emit a single-keyframe .wol with moonlit directional + far fog (always-night zone / shadow realm)\n");
std::printf(" --info-wot <wot-base> [--json]\n");
std::printf(" Print WOT/WHM terrain metadata (tile, chunks, height range) and exit\n");
std::printf(" --info-extract <dir> [--json]\n");

View file

@ -525,12 +525,12 @@ int handleInfoWolAt(int& i, int argc, char** argv) {
return 0;
}
int handleGenLight(int& i, int argc, char** argv) {
// Emit a starter .wol file with the default 4-keyframe day/
// night cycle (midnight, dawn, noon, dusk). User can edit
// the keyframes by re-saving via a future authoring tool;
// for now this is the canonical "make me a usable atmosphere
// file in one command" entrypoint.
// Emit a .wol from a named preset. Used by all four
// --gen-light* convenience commands.
int emitLightPreset(const std::string& cmdName,
int& i, int argc, char** argv,
wowee::pipeline::WoweeLight (*maker)(const std::string&),
const char* presetDescription) {
std::string base = argv[++i];
std::string zoneName = "Default";
if (i + 1 < argc && argv[i + 1][0] != '-') {
@ -539,19 +539,48 @@ int handleGenLight(int& i, int argc, char** argv) {
if (base.size() >= 4 && base.substr(base.size() - 4) == ".wol") {
base = base.substr(0, base.size() - 4);
}
auto wol = wowee::pipeline::WoweeLightLoader::makeDefaultDayNight(zoneName);
auto wol = maker(zoneName);
if (!wowee::pipeline::WoweeLightLoader::save(wol, base)) {
std::fprintf(stderr, "gen-light: failed to save %s.wol\n",
base.c_str());
std::fprintf(stderr, "%s: failed to save %s.wol\n",
cmdName.c_str(), base.c_str());
return 1;
}
std::printf("Wrote %s.wol\n", base.c_str());
std::printf(" zone : %s\n", zoneName.c_str());
std::printf(" keyframes : %zu (midnight + dawn + noon + dusk)\n",
wol.keyframes.size());
std::printf(" preset : %s (%zu keyframe%s)\n",
presetDescription, wol.keyframes.size(),
wol.keyframes.size() == 1 ? "" : "s");
return 0;
}
int handleGenLight(int& i, int argc, char** argv) {
return emitLightPreset(
"gen-light", i, argc, argv,
wowee::pipeline::WoweeLightLoader::makeDefaultDayNight,
"midnight + dawn + noon + dusk");
}
int handleGenLightCave(int& i, int argc, char** argv) {
return emitLightPreset(
"gen-light-cave", i, argc, argv,
wowee::pipeline::WoweeLightLoader::makeCave,
"dim cool ambient + heavy short-range fog");
}
int handleGenLightDungeon(int& i, int argc, char** argv) {
return emitLightPreset(
"gen-light-dungeon", i, argc, argv,
wowee::pipeline::WoweeLightLoader::makeDungeon,
"warm torchlit ambient + medium fog");
}
int handleGenLightNight(int& i, int argc, char** argv) {
return emitLightPreset(
"gen-light-night", i, argc, argv,
wowee::pipeline::WoweeLightLoader::makeNight,
"moonlit directional + far fog");
}
} // namespace
bool handleWorldInfo(int& i, int argc, char** argv, int& outRc) {
@ -579,6 +608,15 @@ bool handleWorldInfo(int& i, int argc, char** argv, int& outRc) {
if (std::strcmp(argv[i], "--gen-light") == 0 && i + 1 < argc) {
outRc = handleGenLight(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-light-cave") == 0 && i + 1 < argc) {
outRc = handleGenLightCave(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-light-dungeon") == 0 && i + 1 < argc) {
outRc = handleGenLightDungeon(i, argc, argv); return true;
}
if (std::strcmp(argv[i], "--gen-light-night") == 0 && i + 1 < argc) {
outRc = handleGenLightNight(i, argc, argv); return true;
}
return false;
}