载入中...
搜索中...
未找到
GltfAnimation.cpp
浏览该文件的文档.
4
5#include <bit>
6#include <cmath>
7#include <limits>
8#include <numeric>
9#include <set>
10
12namespace {
13// Local parser unwinding only. The public boundary returns a checked Result;
14// callers never observe a partially prepared archive.
15struct Rejection {
17 std::string message;
18};
19void require(bool condition, std::string message, DiagnosticCode code = DiagnosticCode::ParseError) {
20 if (!condition) throw Rejection{code, std::move(message)};
21}
22const Value::Object& object(const Value& value) {
23 const auto* result = value.getIf<Value::Object>();
24 require(result != nullptr, "glTF skeletal field must be an object");
25 return *result;
26}
27const Value::Object& object(const Value* value) {
28 require(value != nullptr, "required glTF skeletal object is missing");
29 return object(*value);
30}
31const Value::Array& array(const Value* value) {
32 const auto* result = value ? value->getIf<Value::Array>() : nullptr;
33 require(result != nullptr, "glTF skeletal field must be an array");
34 return *result;
35}
36std::uint32_t index(const Value* value, std::size_t bound) {
37 require(value && value->isInt64() && value->asInt() >= 0 && std::uint64_t(value->asInt()) < bound,
38 "glTF skeletal index is out of range");
39 return static_cast<std::uint32_t>(value->asInt());
40}
41float number(const Value& value) {
42 require(value.isInt64() || value.isDouble(), "glTF transform component must be numeric");
43 const auto result = static_cast<float>(value.isInt64() ? double(value.asInt()) : value.asDouble());
44 require(std::isfinite(result), "glTF transform component must be finite");
45 return result;
46}
47std::string name(const Value::Object& value, std::string fallback, const AssetImportLimits& limits) {
48 const auto* field = member(value, "name");
49 if (!field) return fallback;
50 require(field->isString() && field->asString().size() <= limits.maximumStringBytes,
51 "glTF name exceeds string budget");
52 return field->asString();
53}
54void putString(std::vector<std::uint8_t>& bytes, const std::string& text) {
55 put32(bytes, static_cast<std::uint32_t>(text.size()));
56 bytes.insert(bytes.end(), text.begin(), text.end());
57}
58Accessor accessor(const Value::Object& root, const std::vector<std::span<const std::uint8_t>>& buffers,
59 const Value* value, const AssetImportLimits& limits) {
60 const auto i = index(value, array(member(root, "accessors")).size());
61 auto parsed = accessorAt(root, buffers, i, limits);
62 if (!parsed) throw Rejection{DiagnosticCode::ParseError, "invalid glTF skeletal accessor " + std::to_string(i)};
63 return std::move(parsed).takeValue();
64}
65float component(const Accessor& a, std::uint32_t row, std::uint32_t column) {
66 auto value = readFloat(a, row, column);
67 if (!value) throw Rejection{DiagnosticCode::ParseError, "invalid glTF skeletal FLOAT component"};
68 return value.value();
69}
70std::uint32_t integerComponent(const Accessor& a, std::uint32_t row, std::uint32_t column) {
71 require(a.componentType == 5121 || a.componentType == 5123, "JOINTS must use unsigned bytes or shorts");
72 auto offset = a.offset + row * a.stride + column * componentSize(a.componentType);
73 return a.componentType == 5121 ? a.buffer[offset]
74 : std::uint32_t(a.buffer[offset]) | (std::uint32_t(a.buffer[offset + 1]) << 8);
75}
77 auto ref = detail::assetRef(id);
78 require(ref.ok(), "invalid generated asset identity");
79 return std::move(ref).takeValue();
80}
81void publish(const GltfImportRequest& request, PreparedAssetImport& output, const AssetRef& ref, std::string type,
82 Value::Object definition, std::vector<std::uint8_t> blob, std::string source) {
83 require(output.manifest.assets.size() < request.limits.maximumAssets, "glTF asset budget exceeded");
84 std::uint64_t total = blob.size();
85 for (const auto& entry : output.entries) {
86 require(entry.bytes.size() <= request.limits.maximumDecodedBytes &&
87 total <= request.limits.maximumDecodedBytes - entry.bytes.size(),
88 "glTF decoded budget exceeded");
89 total += entry.bytes.size();
90 }
91 require(total <= request.limits.maximumDecodedBytes, "glTF decoded budget exceeded");
92 const auto base = "assets/" + ref.id().format() + "/";
93 definition["schema"] = Value(type);
94 definition["schemaVersion"] = Value(std::int64_t(1));
95 definition["blob"] = Value(base + "data.bin");
96 auto json = Value(std::move(definition)).toJson();
97 require(json.ok(), "cannot encode canonical skeletal definition");
98 std::vector<std::uint8_t> bytes(json.value().begin(), json.value().end());
99 output.manifest.assets.push_back(
100 {ref, type, SchemaVersion(1), base + "asset.json", detail::sha256(bytes), {"source:gltf2"}});
101 output.entries.push_back({base + "asset.json", std::move(bytes)});
102 output.entries.push_back({base + "data.bin", std::move(blob)});
103 output.sourceMappings.push_back({source, ref});
104 output.findings.push_back({request.sourceName, source, ImportDisposition::Translated, "converted to " + type});
105}
106void dependency(PreparedAssetImport& output, const AssetRef& from, const AssetRef& to, std::string role,
107 std::string type) {
108 output.manifest.dependencies.push_back(
109 {from, to, asset::EvaDependencyKind::RuntimeRequired, std::move(role), {}, std::move(type)});
110}
111
112void normalizeNodeMatrix(Value::Object& node) {
113 const auto* field = member(node, "matrix");
114 if (!field) return;
115 const auto& values = array(field);
116 require(values.size() == 16, "glTF node matrix must have 16 components");
117 float m[16];
118 for (std::size_t i = 0; i < 16; ++i) m[i] = number(values[i]);
119 require(
120 std::abs(m[3]) < 1e-5f && std::abs(m[7]) < 1e-5f && std::abs(m[11]) < 1e-5f && std::abs(m[15] - 1.f) < 1e-5f,
121 "skeletal node matrix must be affine", DiagnosticCode::Unsupported);
122 const auto length = [&](int offset) {
123 return std::sqrt(m[offset] * m[offset] + m[offset + 1] * m[offset + 1] + m[offset + 2] * m[offset + 2]);
124 };
125 const float sx = length(0), sy = length(4), sz = length(8);
126 require(sx > 1e-8f && sy > 1e-8f && sz > 1e-8f, "skeletal node matrix has zero scale", DiagnosticCode::Unsupported);
127 const float a = m[0] / sx, b = m[1] / sx, c = m[2] / sx;
128 const float d = m[4] / sy, e = m[5] / sy, f = m[6] / sy;
129 const float g = m[8] / sz, h = m[9] / sz, i = m[10] / sz;
130 require(std::abs(a * d + b * e + c * f) < 1e-4f && std::abs(a * g + b * h + c * i) < 1e-4f &&
131 std::abs(d * g + e * h + f * i) < 1e-4f &&
132 std::abs(a * (e * i - f * h) - d * (b * i - c * h) + g * (b * f - c * e) - 1.f) < 1e-4f,
133 "skeletal node matrix has shear or reflection", DiagnosticCode::Unsupported);
134 float x = 0, y = 0, z = 0, w = 1;
135 const float trace = a + e + i;
136 if (trace > 0.f) {
137 const float s = 2.f * std::sqrt(trace + 1.f);
138 w = 0.25f * s;
139 x = (f - h) / s;
140 y = (g - c) / s;
141 z = (b - d) / s;
142 } else if (a > e && a > i) {
143 const float s = 2.f * std::sqrt(1.f + a - e - i);
144 w = (f - h) / s;
145 x = 0.25f * s;
146 y = (d + b) / s;
147 z = (g + c) / s;
148 } else if (e > i) {
149 const float s = 2.f * std::sqrt(1.f + e - a - i);
150 w = (g - c) / s;
151 x = (d + b) / s;
152 y = 0.25f * s;
153 z = (h + f) / s;
154 } else {
155 const float s = 2.f * std::sqrt(1.f + i - a - e);
156 w = (b - d) / s;
157 x = (g + c) / s;
158 y = (h + f) / s;
159 z = 0.25f * s;
160 }
161 const float qLength = std::sqrt(x * x + y * y + z * z + w * w);
162 require(qLength > 1e-8f, "skeletal node matrix has invalid rotation");
163 node.erase("matrix");
164 node["translation"] = Value(Value::Array{Value(m[12]), Value(m[13]), Value(m[14])});
165 node["rotation"] =
166 Value(Value::Array{Value(x / qLength), Value(y / qLength), Value(z / qLength), Value(w / qLength)});
167 node["scale"] = Value(Value::Array{Value(sx), Value(sy), Value(sz)});
168}
169
170void append(const GltfImportRequest& request, const Value::Object& root,
171 const std::vector<std::span<const std::uint8_t>>& buffers, PreparedAssetImport& output) {
172 const auto* skinValue = member(root, "skins");
173 const auto* animationValue = member(root, "animations");
174 if (!skinValue && !animationValue) return;
175 auto nodes = array(member(root, "nodes"));
176 require(!nodes.empty() && nodes.size() <= request.limits.maximumAssets, "glTF node budget exceeded");
177 std::vector<int> parents(nodes.size(), -1), mapped(nodes.size(), -1);
178 for (std::size_t n = 0; n < nodes.size(); ++n) {
179 auto* node = nodes[n].getIf<Value::Object>();
180 require(node != nullptr, "glTF skeletal node must be an object");
181 normalizeNodeMatrix(*node);
182 if (auto* children = member(*node, "children"))
183 for (const auto& child : array(children)) {
184 const auto c = index(&child, nodes.size());
185 require(c != n && parents[c] == -1, "glTF nodes contain a cycle or multiple parents");
186 parents[c] = static_cast<int>(n);
187 }
188 }
189 // Breadth-first order includes non-joint ancestors. Bind and animated local
190 // transforms therefore retain their original parent space without baking.
191 std::vector<std::uint32_t> order;
192 for (std::uint32_t n = 0; n < nodes.size(); ++n)
193 if (parents[n] == -1) order.push_back(n);
194 for (std::size_t cursor = 0; cursor < order.size(); ++cursor) {
195 auto n = order[cursor];
196 mapped[n] = static_cast<int>(cursor);
197 if (auto* children = member(object(nodes[n]), "children"))
198 for (const auto& child : array(children)) order.push_back(index(&child, nodes.size()));
199 }
200 require(order.size() == nodes.size(), "glTF node hierarchy contains a cycle");
201 const auto skeleton = reference(request.package.packageId.child("gltf:skeleton"));
202 std::vector<std::uint8_t> skeletonBytes{'E', 'V', 'S', 'K', 'E', 'L', 0, 1};
203 put32(skeletonBytes, static_cast<std::uint32_t>(nodes.size()));
204 for (auto n : order) {
205 const auto& node = object(nodes[n]);
206 const auto boneName = name(node, "node_" + std::to_string(n), request.limits);
207 const std::uint64_t boneBytes = 48 + boneName.size();
208 require(boneBytes <= request.limits.maximumDecodedBytes &&
209 skeletonBytes.size() <= request.limits.maximumDecodedBytes - boneBytes,
210 "skeleton decoded budget exceeded");
211 put32(skeletonBytes, parents[n] < 0 ? std::uint32_t(-1) : std::uint32_t(mapped[parents[n]]));
212 putString(skeletonBytes, boneName);
213 for (const auto& field : {"translation", "rotation", "scale"}) {
214 const int count = std::string_view(field) == "rotation" ? 4 : 3;
215 const auto* value = member(node, field);
216 if (value) require(array(value).size() == std::size_t(count), "invalid glTF TRS shape");
217 if (value && count == 4) {
218 double length = 0;
219 for (const auto& part : array(value)) {
220 const auto x = number(part);
221 length += double(x) * x;
222 }
223 require(std::abs(length - 1.0) < 0.001, "bind rotation must be a unit quaternion");
224 }
225 for (int c = 0; c < count; ++c) {
226 const float fallback = std::string_view(field) == "scale" || c == 3 ? 1.f : 0.f;
227 putFloat(skeletonBytes, value ? number(array(value)[c]) : fallback);
228 }
229 }
230 }
231 publish(request, output, skeleton, "eve.skeleton",
232 {{"boneCount", Value(std::int64_t(nodes.size()))},
233 {"coordinateSystem", Value("right-handed-x-right-y-up-minus-z-forward")},
234 {"lengthUnit", Value("meter")}},
235 std::move(skeletonBytes), "nodes");
236
237 if (skinValue) {
238 const auto& skins = array(skinValue);
239 const auto& meshes = array(member(root, "meshes"));
240 for (std::uint32_t n = 0; n < nodes.size(); ++n) {
241 const auto& node = object(nodes[n]);
242 if (!member(node, "skin")) continue;
243 const auto skinIndex = index(member(node, "skin"), skins.size());
244 const auto meshIndex = index(member(node, "mesh"), meshes.size());
245 const auto& skin = object(skins[skinIndex]);
246 const auto& joints = array(member(skin, "joints"));
247 require(!joints.empty() && joints.size() <= nodes.size(), "invalid glTF joint count");
248 std::set<std::uint32_t> unique;
249 for (const auto& j : joints) require(unique.insert(index(&j, nodes.size())).second, "duplicate glTF joint");
250 std::optional<Accessor> inverse;
251 if (auto* ibm = member(skin, "inverseBindMatrices")) {
252 inverse = accessor(root, buffers, ibm, request.limits);
253 require(inverse->components == 16 && inverse->componentType == 5126 && inverse->count == joints.size(),
254 "invalid inverse bind matrices");
255 }
256 const auto& primitives = array(member(object(meshes[meshIndex]), "primitives"));
257 for (std::uint32_t p = 0; p < primitives.size(); ++p) {
258 const auto& primitive = object(primitives[p]);
259 const auto& attrs = object(member(primitive, "attributes"));
260 auto position = accessor(root, buffers, member(attrs, "POSITION"), request.limits);
261 std::vector<std::pair<Accessor, Accessor>> sets;
262 for (std::uint32_t set = 0;; ++set) {
263 const auto* j = member(attrs, "JOINTS_" + std::to_string(set));
264 const auto* w = member(attrs, "WEIGHTS_" + std::to_string(set));
265 if (!j && !w) break;
266 require(j && w && set < 64, "incomplete or excessive glTF influence sets");
267 auto ja = accessor(root, buffers, j, request.limits),
268 wa = accessor(root, buffers, w, request.limits);
269 require(ja.components == 4 && wa.components == 4 && ja.count == position.count &&
270 wa.count == position.count,
271 "glTF skin attributes must match vertices");
272 require(!ja.normalized, "JOINTS cannot be normalized");
273 require((wa.componentType == 5126 && !wa.normalized) ||
274 ((wa.componentType == 5121 || wa.componentType == 5123) && wa.normalized),
275 "WEIGHTS must use FLOAT or normalized unsigned bytes/shorts");
276 sets.emplace_back(ja, wa);
277 }
278 require(!sets.empty(), "skinned primitive has no joint weights");
279 for (const auto& [key, value] : attrs) {
280 (void)value;
281 if (key.starts_with("JOINTS_") || key.starts_with("WEIGHTS_")) {
282 bool found = false;
283 for (std::size_t s = 0; s < sets.size(); ++s)
284 found |= key == "JOINTS_" + std::to_string(s) || key == "WEIGHTS_" + std::to_string(s);
285 require(found, "glTF influence sets must be contiguous");
286 }
287 }
288 const auto influences = static_cast<std::uint32_t>(sets.size() * 4);
289 require(std::uint64_t(position.count) * influences * 8 + joints.size() * 68 + 24 <=
290 request.limits.maximumDecodedBytes,
291 "skin decoded budget exceeded");
292 std::vector<std::uint8_t> bytes{'E', 'V', 'S', 'K', 'I', 'N', 0, 1};
293 put32(bytes, position.count);
294 put32(bytes, static_cast<std::uint32_t>(joints.size()));
295 put32(bytes, influences);
296 put32(bytes, static_cast<std::uint32_t>(mapped[n]));
297 for (std::uint32_t j = 0; j < joints.size(); ++j) {
298 put32(bytes, static_cast<std::uint32_t>(mapped[index(&joints[j], nodes.size())]));
299 for (std::uint32_t c = 0; c < 16; ++c)
300 putFloat(bytes, inverse ? component(*inverse, j, c) : (c % 5 == 0 ? 1.f : 0.f));
301 }
302 std::uint32_t normalizedVertices = 0;
303 for (std::uint32_t v = 0; v < position.count; ++v) {
304 const auto rowStart = bytes.size();
305 float sum = 0;
306 for (const auto& [j, w] : sets)
307 for (std::uint32_t c = 0; c < 4; ++c) {
308 auto joint = integerComponent(j, v, c);
309 auto weight = w.componentType == 5126 ? component(w, v, c)
310 : float(integerComponent(w, v, c)) /
311 (w.componentType == 5121 ? 255.f : 65535.f);
312 require(joint < joints.size() && weight >= 0, "invalid glTF joint index or weight");
313 sum += weight;
314 put32(bytes, joint);
316 }
317 require(std::isfinite(sum) && sum > 0, "glTF vertex weights must have a positive finite sum");
318 if (std::abs(sum - 1.f) > 1e-6f) {
319 ++normalizedVertices;
320 for (std::uint32_t i = 0; i < influences; ++i) {
321 const auto offset = rowStart + i * 8 + 4;
322 const auto normalized = std::bit_cast<float>(little32(bytes, offset)) / sum;
323 const auto bits = std::bit_cast<std::uint32_t>(normalized);
324 for (int byte = 0; byte < 4; ++byte)
325 bytes[offset + byte] = static_cast<std::uint8_t>(bits >> (byte * 8));
326 }
327 }
328 }
329 auto meshRef = reference(request.package.packageId.child("gltf:mesh:" + std::to_string(meshIndex) +
330 ":primitive:" + std::to_string(p)));
331 const auto source = "nodes[" + std::to_string(n) + "].skin.primitives[" + std::to_string(p) + "]";
332 auto skinRef = reference(request.package.packageId.child("gltf:" + source));
333 if (normalizedVertices)
334 output.findings.push_back({request.sourceName, source + ".weights", ImportDisposition::Baked,
335 "renormalized all influence sets for " +
336 std::to_string(normalizedVertices) +
337 " vertices with non-unit source weight sums"});
338 publish(request, output, skinRef, "eve.skin",
339 {{"skeleton", Value(skeleton.format())},
340 {"mesh", Value(meshRef.format())},
341 {"vertexCount", Value(std::int64_t(position.count))},
342 {"jointCount", Value(std::int64_t(joints.size()))},
343 {"influencesPerVertex", Value(std::int64_t(influences))}},
344 std::move(bytes), source);
345 dependency(output, skinRef, skeleton, "skeleton", "eve.skeleton/1");
346 dependency(output, skinRef, meshRef, "mesh", "eve.mesh/2");
347 output.manifest.entrypoints.emplace("skin:" + std::to_string(n) + ":" + std::to_string(p), skinRef);
348 }
349 }
350 }
351 if (!animationValue) return;
352 const auto& animations = array(animationValue);
353 for (std::uint32_t a = 0; a < animations.size(); ++a) {
354 const auto& animation = object(animations[a]);
355 const auto& samplers = array(member(animation, "samplers"));
356 const auto& channels = array(member(animation, "channels"));
357 struct Track {
358 std::array<std::vector<std::uint8_t>, 3> keys;
359 std::array<std::uint32_t, 3> counts{};
360 };
361 std::map<std::uint32_t, Track> tracks;
362 float duration = 0;
363 float minimumStep = std::numeric_limits<float>::max();
364 std::uint64_t decodedBytes = 28;
365 for (const auto& c : channels) {
366 const auto& channel = object(c);
367 const auto& target = object(member(channel, "target"));
368 auto node = index(member(target, "node"), nodes.size());
369 const auto* path = member(target, "path");
370 require(path && path->isString(), "animation target path is missing");
371 const auto& pathName = path->asString();
372 int kind = pathName == "translation" ? 0 : pathName == "rotation" ? 1 : pathName == "scale" ? 2 : -1;
373 require(kind >= 0, "animation target " + pathName + " is unsupported", DiagnosticCode::Unsupported);
374 const auto& sampler = object(samplers[index(member(channel, "sampler"), samplers.size())]);
375 if (auto* interpolation = member(sampler, "interpolation"))
376 require(interpolation->isString() && interpolation->asString() == "LINEAR",
377 "only LINEAR skeletal interpolation is supported", DiagnosticCode::Unsupported);
378 auto input = accessor(root, buffers, member(sampler, "input"), request.limits);
379 auto values = accessor(root, buffers, member(sampler, "output"), request.limits);
380 require(input.components == 1 && input.count == values.count && values.components == (kind == 1 ? 4u : 3u),
381 "invalid animation sampler shape");
382 auto& track = tracks[static_cast<std::uint32_t>(mapped[node])];
383 require(track.counts[kind] == 0, "duplicate animation channel target");
384 const auto size = std::uint64_t(input.count) * (values.components + 1) * 4;
385 require(
386 size <= request.limits.maximumDecodedBytes && decodedBytes <= request.limits.maximumDecodedBytes - size,
387 "animation decoded budget exceeded");
388 decodedBytes += size;
389 track.counts[kind] = input.count;
390 float previous = -1;
391 for (std::uint32_t key = 0; key < input.count; ++key) {
392 auto time = component(input, key, 0);
393 require(time >= 0 && time > previous, "animation times must be strictly increasing and non-negative");
394 if (key > 0) minimumStep = std::min(minimumStep, time - previous);
395 previous = time;
396 duration = std::max(duration, time);
397 putFloat(track.keys[kind], time);
398 if (kind == 1) {
399 double length = 0;
400 for (std::uint32_t i = 0; i < 4; ++i) {
401 auto x = component(values, key, i);
402 length += double(x) * x;
403 }
404 require(std::abs(length - 1.0) < 0.001, "animation rotation must be a unit quaternion");
405 }
406 for (std::uint32_t componentIndex = 0; componentIndex < values.components; ++componentIndex)
407 putFloat(track.keys[kind], component(values, key, componentIndex));
408 }
409 }
410 std::vector<std::uint8_t> bytes{'E', 'V', 'A', 'N', 'I', 'M', 0, 1};
411 const float rate = minimumStep == std::numeric_limits<float>::max() ? 1.f : 1.f / minimumStep;
412 require(std::isfinite(rate), "animation sample rate is not representable");
415 put32(bytes, 0);
416 put32(bytes, 0);
417 put32(bytes, static_cast<std::uint32_t>(tracks.size()));
418 for (auto& [bone, track] : tracks) {
419 put32(bytes, bone);
420 for (auto count : track.counts) put32(bytes, count);
421 for (const auto& keys : track.keys) bytes.insert(bytes.end(), keys.begin(), keys.end());
422 }
423 const auto source = "animations[" + std::to_string(a) + "]";
424 const auto ref = reference(request.package.packageId.child("gltf:" + source));
425 publish(request, output, ref, "eve.animation-clip",
426 {{"name", Value(name(animation, source, request.limits))},
427 {"durationSeconds", Value(double(duration))},
428 {"sampleRate", Value(double(rate))},
429 {"loop", Value(false)},
430 {"skeleton", Value(skeleton.format())}},
431 std::move(bytes), source);
432 dependency(output, ref, skeleton, "skeleton", "eve.skeleton/1");
433 output.manifest.entrypoints.emplace("animation:" + std::to_string(a), ref);
434 }
435}
436} // namespace
437
439 const std::vector<std::span<const std::uint8_t>>& buffers, PreparedAssetImport& output) {
440 try {
441 append(request, root, buffers, output);
442 } catch (const Rejection& rejected) {
444 Diagnostic::error(rejected.code, rejected.message, request.sourceName, {}, "asset.import"));
445 }
446 return Result<void>::success();
447}
448} // namespace eve::asset_import::gltf
double z
double y
double m[16]
double x
LogicalId target
Trace trace
Definition Agent.cpp:50
float w
Definition AnimClip.cpp:738
float duration
std::map< std::string, std::vector< Key >, std::less<> > channels
int root
Definition AnimSmr.cpp:119
std::string output
AuthorityStoreHandleRef reference
Definition Authority.cpp:24
std::size_t cursor
const std::string & s
std::unordered_map< std::string, QuestRuntime > entries
glm::vec4 p[6]
eve::Value condition
SQObjectPtr key
Definition ECS.cpp:155
std::string name
Definition ECS.cpp:154
EvpackChunkInput input
Definition Evpack.cpp:170
std::string message
DiagnosticCode code
std::vector< std::uint8_t > blob
const GltfImportRequest & request
tensor::Graph g
Definition GpuGraph.cpp:7
vk::UniqueSampler sampler
glm::vec3 n
Definition Grass.cpp:63
float v
std::int32_t second
std::int32_t c
int h
float length
size_t offset
std::vector< Track > tracks
std::array< float, 3 > position
std::uint32_t bone
std::string to
std::map< std::string, Node > nodes
std::string from
Poco::JSON::Object::Ptr result
std::uint64_t bytes
MeleePoint3 b
Definition MeleeHit.cpp:41
MeleePoint3 a
Definition MeleeHit.cpp:40
std::vector< std::int32_t > order
std::shared_ptr< const OceanSprayFrame > previous
float f
std::string path
Definition PlayHost.cpp:111
std::set< std::string > values
Object::Ptr value
float d
const RoadNode * node
double number
bool found
std::string text
std::string_view source
size_t begin
unsigned column
size_t end
std::string kind
int count
Json object
std::vector< TileLayer::Tileset::Animation > animations
int children
Definition TreeMesh.cpp:432
float size
Definition TreeMesh.cpp:158
float(ui::Theme::* member)[4]
const AssetImportLimits & limits
double weight
uint32_t index
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
std::vector< Value > Array
Definition Value.h:33
bool isString() const
True when string.
Definition Json.cpp:331
std::string asString(const std::string &fallback={}) const
As string.
Definition Json.cpp:412
std::string sha256(std::span< const std::uint8_t > bytes)
Sha 256.
Result< AssetRef > assetRef(PersistentId id)
Asset ref.
Result< Accessor > accessorAt(const Value::Object &root, const std::vector< std::span< const std::uint8_t > > &buffers, std::uint64_t accessorIndex, const AssetImportLimits &limits)
Validate an accessor retaining only buffer spans borrowed for this import.
Result< float > readFloat(const Accessor &accessor, std::uint32_t element, std::uint32_t component)
Read one bounded finite FLOAT component.
void put32(std::vector< std::uint8_t > &bytes, std::uint32_t value)
Append little-endian uint32 to owned storage.
std::uint32_t little32(std::span< const std::uint8_t > bytes, std::size_t offset)
Read a uint32 after the caller has bounded the byte range.
Result< void > appendAnimation(const GltfImportRequest &request, const Value::Object &root, const std::vector< std::span< const std::uint8_t > > &buffers, PreparedAssetImport &output)
Append owning canonical skeleton, skin and clip assets to an unpublished candidate.
std::uint32_t componentSize(std::uint32_t type)
Return encoded component byte size, or zero for an unknown type.
void putFloat(std::vector< std::uint8_t > &bytes, float value)
Append IEEE FLOAT to owned storage.
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
void keys(const Value &value, std::initializer_list< const char * > names)
ShapeState * child(const JPH::Body &body, const JPH::SubShapeID &id)
Resolves a native child record for a synchronous callback or query. @ownership Borrowed from the worl...
Result< int > publish(Heightmap &target, std::vector< float > candidate)
Publish.
std::vector< int64_t > attrs(const Node &n, const char *key, std::vector< int64_t > fallback)
Attrs.
WidgetDesc row(std::vector< WidgetDesc > children, std::string id)
Horizontal elastic layout row.
Definition Widget.cpp:870
DiagnosticCode
Stable machine-readable diagnostic codes.
Definition Diagnostic.h:47
StrongUuid< detail::PersistentIdTag > PersistentId
Stable instance identity for persistence, networking and process boundaries.
Definition Identity.h:253
detail::StrongUint64< detail::SchemaVersionTag > SchemaVersion
Persistent data-format version; not a runtime replacement generation.
Untrusted .gltf/.glb input plus explicitly supplied external URI bytes.
Owning, validated source archive candidate not yet published to disk/database.
glm::uvec4 counts