cesium-native 0.43.0
|
Creates GltfConverterResult
objects from a a binary content.
More...
#include <Cesium3DTilesContent/GltfConverters.h>
Public Types | |
using | ConverterFunction |
A function pointer that can create a GltfConverterResult from a tile binary content. | |
Static Public Member Functions | |
static void | registerMagic (const std::string &magic, ConverterFunction converter) |
Register the given function for the given magic header. | |
static void | registerFileExtension (const std::string &fileExtension, ConverterFunction converter) |
Register the given function for the given file extension. | |
static ConverterFunction | getConverterByFileExtension (const std::string &filePath) |
Retrieve the converter function that is already registered for the given file extension. If no such function is found, nullptr will be returned. | |
static ConverterFunction | getConverterByMagic (const std::span< const std::byte > &content) |
Retrieve the converter function that is registered for the given magic header. If no such function is found, nullptr will be returned. | |
static CesiumAsync::Future< GltfConverterResult > | convert (const std::string &filePath, const std::span< const std::byte > &content, const CesiumGltfReader::GltfReaderOptions &options, const AssetFetcher &assetFetcher) |
Creates the GltfConverterResult from the given binary content. | |
static CesiumAsync::Future< GltfConverterResult > | convert (const std::span< const std::byte > &content, const CesiumGltfReader::GltfReaderOptions &options, const AssetFetcher &assetFetcher) |
Creates the GltfConverterResult from the given binary content. | |
Creates GltfConverterResult
objects from a a binary content.
The class offers a lookup functionality for registering ConverterFunction
instances that can create GltfConverterResult
instances from a binary content.
The loaders are registered based on the magic header or the file extension of the input data. The binary data is usually received as a response to a network request, and the first four bytes of the raw data form the magic header. Based on this header or the file extension of the network response, the loader that will be used for processing the input can be looked up.
Definition at line 120 of file GltfConverters.h.
A function pointer that can create a GltfConverterResult
from a tile binary content.
Definition at line 126 of file GltfConverters.h.
|
static |
Creates the GltfConverterResult
from the given binary content.
This will look up the ConverterFunction
that can be used to process the given input data, based on all loaders that have been registered with GltfConverters::registerMagic
.
It will try to find a loader based on the magic header of the content
in the given input. If no such loader is found then an empty GltfConverterResult
is returned.
If a matching loader is found, it will be applied to the given input, and the result will be returned.
content | The tile binary content that may contains the magic header to look up the converter and is used to convert to gltf model. |
options | The CesiumGltfReader::GltfReaderOptions for how to read a glTF. |
assetFetcher | An object that can perform recursive asset requests. |
GltfConverterResult
that stores the gltf model converted from the binary data.
|
static |
Creates the GltfConverterResult
from the given binary content.
This will look up the ConverterFunction
that can be used to process the given input data, based on all loaders that have been registered with GltfConverters::registerMagic
or GltfConverters::registerFileExtension
.
It will first try to find a loader based on the magic header of the content
in the given input. If no matching loader is found, then it will look up a loader based on the file extension of filePath
of the given input.
If no such loader is found then an empty GltfConverterResult
is returned.
If a matching loader is found, it will be applied to the given input, and the result will be returned.
filePath | The file path that contains the file extension to look up the converter. |
content | The tile binary content that may contains the magic header to look up the converter and is used to convert to gltf model. |
options | The CesiumGltfReader::GltfReaderOptions for how to read a glTF. |
assetFetcher | An object that can perform recursive asset requests. |
GltfConverterResult
that stores the gltf model converted from the binary data.
|
static |
Retrieve the converter function that is already registered for the given file extension. If no such function is found, nullptr will be returned.
filePath | The file path that contains the file extension. |
ConverterFunction
that is registered with the file extension.
|
static |
Retrieve the converter function that is registered for the given magic header. If no such function is found, nullptr will be returned.
The given magic header is a 4-character string. It will be compared to the first 4 bytes of the raw input data, to decide whether the given factory function should be used to create the GltfConverterResult
from the input data.
content | The binary tile content that contains the magic header. |
ConverterFunction
that is registered with the magic header.
|
static |
Register the given function for the given file extension.
The given string is a file extension including the "." (e.g. ".ext"). It is used for deciding whether the given factory function should be used to create the GltfConverterResult
from the input data with the same file extension in its url.
fileExtension | The file extension. |
converter | The converter that will be used to create the tile gltf content |
|
static |
Register the given function for the given magic header.
The given magic header is a 4-character string. It will be compared to the first 4 bytes of the raw input data, to decide whether the given factory function should be used to create the GltfConverterResult
from the input data.
magic | The string describing the magic header. |
converter | The converter that will be used to create the tile gltf content. |