MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / load

Method load

CesiumGltfReader/src/NetworkSchemaAssetDescriptor.cpp:28–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28Future<ResultPointer<Schema>> NetworkSchemaAssetDescriptor::load(
29 const AsyncSystem& asyncSystem,
30 const std::shared_ptr<IAssetAccessor>& pAssetAccessor) const {
31 return this->loadBytesFromNetwork(asyncSystem, pAssetAccessor)
32 .thenInWorkerThread([](Result<std::vector<std::byte>>&& result) {
33 if (!result.value) {
34 return ResultPointer<Schema>(result.errors);
35 }
36
37 SchemaReader reader{};
38 CesiumJsonReader::ReadJsonResult<CesiumGltf::Schema> jsonReadResult =
39 reader.readFromJson(*result.value);
40
41 CesiumUtility::IntrusivePointer<CesiumGltf::Schema> pSchema;
42 if (result.value.has_value()) {
43 pSchema.emplace(std::move(*jsonReadResult.value));
44 }
45
46 result.errors.merge(
47 ErrorList{jsonReadResult.errors, jsonReadResult.warnings});
48
49 return ResultPointer<Schema>(pSchema, std::move(result.errors));
50 });
51}
52} // namespace CesiumGltfReader
53
54std::size_t

Callers

nothing calls this directly

Calls 4

loadBytesFromNetworkMethod · 0.80
thenInWorkerThreadMethod · 0.45
readFromJsonMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected