feat(lighting): offset del centre de la llum per emissor
This commit is contained in:
1 parent
dacc4a9909
commit
3a42c7958a
9 files changed
+114
-25
No files matched your search
@@ -66,6 +66,18 @@ namespace Map {
|
||||
};
|
||||
}
|
||||
|
||||
// Parser comú d'una 2-tupla d'enters (offset de llum). Retorna
|
||||
// nullopt si el node no és una seqüència de 2 elements. Sense
|
||||
// clamp: els offsets negatius són legítims (Y creix cap avall,
|
||||
// així que `y: -3` puja la llum 3 px).
|
||||
auto parseIntPair(const fkyaml::node& node) -> std::optional<std::array<int, 2>> {
|
||||
if (!node.is_sequence() || node.size() != 2) { return std::nullopt; }
|
||||
return std::array<int, 2>{
|
||||
node[0].get_value<int>(),
|
||||
node[1].get_value<int>(),
|
||||
};
|
||||
}
|
||||
|
||||
// Llegeix el bloc opcional `lighting:` del YAML d'una sala i
|
||||
// actualitza `light_level`, `lighting_mode` i el mapping
|
||||
// `g_room_emitters`. Idempotent: cada `Map::loadFrom` reseteja
|
||||
@@ -102,6 +114,7 @@ namespace Map {
|
||||
if (val.contains("radius")) { ov.radius = val["radius"].get_value<int>(); }
|
||||
if (val.contains("flicker")) { ov.flicker = val["flicker"].get_value<bool>(); }
|
||||
if (val.contains("color")) { ov.color = parseColorTriplet(val["color"]); }
|
||||
if (val.contains("offset")) { ov.offset = parseIntPair(val["offset"]); }
|
||||
}
|
||||
g_room_emitters[KEY] = ov;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user