载入中...
搜索中...
未找到
GltfDecode.h
浏览该文件的文档.
1#pragma once
2
4
5// Private importer implementation contract; no runtime consumers.
8struct Document {
10 std::vector<std::uint8_t> binaryChunk;
11};
13struct Accessor {
14 std::span<const std::uint8_t> buffer;
15 std::size_t offset = 0, stride = 0;
16 std::uint32_t count = 0, componentType = 0, components = 0;
17 bool normalized = false;
18};
23const Value* member(const Value::Object& object, std::string_view name);
28[[nodiscard]] Result<std::uint64_t> unsignedValue(const Value* value, std::string path, bool required = true,
29 std::uint64_t fallback = 0);
31std::uint32_t little32(std::span<const std::uint8_t> bytes, std::size_t offset);
33void put32(std::vector<std::uint8_t>& bytes, std::uint32_t value);
35void putFloat(std::vector<std::uint8_t>& bytes, float value);
40 const Document& document,
43std::uint32_t componentSize(std::uint32_t type);
46 const std::vector<std::span<const std::uint8_t>>& buffers,
47 std::uint64_t accessorIndex, const AssetImportLimits& limits);
49[[nodiscard]] Result<float> readFloat(const Accessor& accessor, std::uint32_t element, std::uint32_t component);
51[[nodiscard]] Result<std::uint32_t> readIndex(const Accessor& accessor, std::uint32_t element);
52} // namespace eve::asset_import::gltf
double value
int root
Definition AnimSmr.cpp:119
Tool-side image and glTF importers producing canonical .eva candidates.
const GltfImportRequest & request
size_t offset
bool required
std::uint64_t bytes
std::string name
std::string path
Definition PlayHost.cpp:110
std::string element
float(ui::Theme::* member)[4]
const AssetImportLimits & limits
Move-only operation result carrying either a value or Status.
Definition Result.h:155
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
std::map< std::string, Value > Object
Definition Value.h:34
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.
Result< std::vector< std::span< const std::uint8_t > > > resolveBuffers(const Value::Object &root, const Document &document, const GltfImportRequest &request)
Resolve immutable spans borrowed from document/request; both must outlive their use.
Result< std::uint64_t > unsignedValue(const Value *value, std::string path, bool required, std::uint64_t fallback)
Validate an optional integer field. @ownership Borrowed nullable field owned by the input document....
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< Document > parseDocument(const GltfImportRequest &request)
Parse a bounded document into an owning result.
Result< std::uint32_t > readIndex(const Accessor &accessor, std::uint32_t element)
Read one bounded unsigned scalar index.
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.
Parser and allocation budgets applied to untrusted importer inputs.
Untrusted .gltf/.glb input plus explicitly supplied external URI bytes.
Borrowed validated accessor; its source document/resources must outlive synchronous reads.
Definition GltfDecode.h:13
std::span< const std::uint8_t > buffer
Definition GltfDecode.h:14
Owning parsed document; keep alive while resolved buffer spans are used.
Definition GltfDecode.h:8
std::vector< std::uint8_t > binaryChunk
Definition GltfDecode.h:10