载入中...
搜索中...
未找到
VegetationFieldCodec.cpp
浏览该文件的文档.
15 if (!v.find(std::string(name))) throw std::invalid_argument("missing field " + std::string(name));
17const Value& at(const Value& v, std::string_view name) { return v.getIf<Value::Object>()->at(std::string(name)); }
26 if (!v.isInt64() || v.asInt() < low || v.asInt() > high) throw std::invalid_argument("integer out of range");
30 if (!v.isArray() || v.getIf<Value::Array>()->size() != count) throw std::invalid_argument("invalid vector length");
48 Diagnostic::error(DiagnosticCode::UnknownVersion, "only vegetation field version 1 is supported"));
63 fields(entry, {"channel", "blend", "shape", "center", "extents", "yaw", "opacity", "edgeFade", "layers",
88 if (!pixels.isArray() || pixels.getIf<Value::Array>()->size() != size_t(e.mask.width) * e.mask.height)
92 for (const auto& pixel : (*pixels.getIf<Value::Array>())) e.mask.pixels.push_back(vector(pixel, 4));
98 Diagnostic::error(DiagnosticCode::InvalidArgument, error.what(), {}, {}, "graphics.vegetation"));
100 return Result<void>::failure(Diagnostic::error(DiagnosticCode::Failed, "vegetation restore allocation failed"));
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Result< void > replace(const VegetationGlobals &globals, std::span< const VegetationElement > elements)
Validate and atomically replace the entire field; failure preserves prior state.
Definition VegetationField.cpp:63
Result< void > restore(const Value &document)
Decode eve.graphics.vegetation-field version 1; rejects unknown fields/versions. Single-writer,...
Definition VegetationFieldCodec.cpp:39
Result< Value > snapshot() const
Owning versioned snapshot; thread-safe while no mutation occurs. No callbacks.
Definition VegetationFieldCodec.cpp:104
char * encode(std::string format, const char *src, size_t srclen, size_t &dstlen, size_t linelen)
Encodes raw bytes (e.g. hex / base64) into a text buffer.
Definition DataModule.cpp:204
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:26
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
VegetationChannel
Independent vegetation field channels; values use linear color and world units.
Definition VegetationField.h:16
VegetationShape
Analytic influence shape in an element's local coordinates.
Definition VegetationField.h:20
@ InvalidArgument
@ UnknownVersion
@ Failed
Definition Container.h:602
Owning element definition; no scene, texture or entity pointers survive admission....
Definition VegetationField.h:33
Owning global defaults. Extras = emission, wetness, overlay, alpha. Motion = signed world X/Z directi...
Definition VegetationField.h:52