载入中...
搜索中...
未找到
AppearanceMesh.cpp
浏览该文件的文档.
1#include "avatar/Appearance.h"
2#include "graphics/Mesh.h"
3
4namespace eve::avatar {
6 const auto evaluated = evaluate();
7 const auto& channels = *evaluated.find("channels")->getIf<Value::Object>();
8 for (const auto& [name, value] : channels) {
9 (void)value;
10 if (name.starts_with(prefix) && !mesh.hasMorph(name.substr(prefix.size())))
12 Diagnostic::error(DiagnosticCode::NotFound, "Appearance morph target is absent from mesh", name));
13 }
14 for (const auto& [name, value] : channels)
15 if (name.starts_with(prefix))
16 mesh.setMorphWeight(name.substr(prefix.size()), static_cast<float>(value.asDouble()));
17 return Result<void>::success();
18}
19} // namespace eve::avatar
std::map< std::string, std::vector< Key >, std::less<> > channels
std::string name
Definition ECS.cpp:154
OceanMeshSettings mesh
Object::Ptr value
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
std::map< std::string, Value > Object
Definition Value.h:34
Result< void > applyMorphWeights(graphics::Mesh &mesh, std::string_view prefix) const
Validate all driven morph names before writing weights to a borrowed mesh. Only outputs beginning wit...
Value evaluate() const
Evaluate additive channels and multi-input corrective drivers, and derive wardrobe visibility....
GPU mesh handle (+ optional CPU morph targets).
Definition Mesh.h:26