cesium-native 0.43.0
Loading...
Searching...
No Matches
CesiumGltfReader::GltfReader Class Reference

Reads glTF models and images. More...

#include <CesiumGltfReader/GltfReader.h>

Public Member Functions

 GltfReader ()
 Constructs a new instance.
 
CesiumJsonReader::JsonReaderOptionsgetOptions ()
 Gets the options controlling how the JSON is read.
 
const CesiumJsonReader::JsonReaderOptionsgetExtensions () const
 Gets the options controlling how the JSON is read.
 
GltfReaderResult readGltf (const std::span< const std::byte > &data, const GltfReaderOptions &options=GltfReaderOptions()) const
 Reads a glTF or binary glTF (GLB) from a buffer.
 
CesiumAsync::Future< GltfReaderResultloadGltf (const CesiumAsync::AsyncSystem &asyncSystem, const std::string &url, const std::vector< CesiumAsync::IAssetAccessor::THeader > &headers, const std::shared_ptr< CesiumAsync::IAssetAccessor > &pAssetAccessor, const GltfReaderOptions &options=GltfReaderOptions()) const
 Reads a glTF or binary glTF file from a URL and resolves external buffers and images.
 
void postprocessGltf (GltfReaderResult &readGltf, const GltfReaderOptions &options)
 Performs post-load processing on a glTF. The specific operations performed are controlled by the provided options.
 

Static Public Member Functions

static CesiumAsync::Future< GltfReaderResultresolveExternalData (const CesiumAsync::AsyncSystem &asyncSystem, const std::string &baseUrl, const CesiumAsync::HttpHeaders &headers, const std::shared_ptr< CesiumAsync::IAssetAccessor > &pAssetAccessor, const GltfReaderOptions &options, GltfReaderResult &&result)
 Accepts the result of readGltf and resolves any remaining external buffers and images.
 
static ImageReaderResult readImage (const std::span< const std::byte > &data, const CesiumGltf::Ktx2TranscodeTargets &ktx2TranscodeTargets)
 Reads an Image from a buffer.
 
static std::optional< std::string > generateMipMaps (CesiumGltf::ImageAsset &image)
 Generate mipmaps for this image.
 

Detailed Description

Reads glTF models and images.

Definition at line 129 of file GltfReader.h.

Member Function Documentation

◆ generateMipMaps()

static std:: optional< std::string > CesiumGltfReader::GltfReader::generateMipMaps ( CesiumGltf::ImageAsset & image)
static

Generate mipmaps for this image.

Deprecated
Use ImageDecoder::generateMipMaps instead.

◆ loadGltf()

CesiumAsync::Future< GltfReaderResult > CesiumGltfReader::GltfReader::loadGltf ( const CesiumAsync::AsyncSystem & asyncSystem,
const std::string & url,
const std::vector< CesiumAsync::IAssetAccessor::THeader > & headers,
const std::shared_ptr< CesiumAsync::IAssetAccessor > & pAssetAccessor,
const GltfReaderOptions & options = GltfReaderOptions() ) const

Reads a glTF or binary glTF file from a URL and resolves external buffers and images.

Parameters
asyncSystemThe async system to use for resolving external data.
urlThe url for reading the file.
headershttp headers needed to make the request.
pAssetAccessorThe asset accessor to use to make the necessary requests.
optionsOptions for how to read the glTF.

◆ postprocessGltf()

void CesiumGltfReader::GltfReader::postprocessGltf ( GltfReaderResult & readGltf,
const GltfReaderOptions & options )

Performs post-load processing on a glTF. The specific operations performed are controlled by the provided options.

Parameters
readGltfThe result of reading the glTF.
optionsThe options to use in post-processing.

◆ readGltf()

GltfReaderResult CesiumGltfReader::GltfReader::readGltf ( const std::span< const std::byte > & data,
const GltfReaderOptions & options = GltfReaderOptions() ) const

Reads a glTF or binary glTF (GLB) from a buffer.

Parameters
dataThe buffer from which to read the glTF.
optionsOptions for how to read the glTF.
Returns
The result of reading the glTF.

◆ readImage()

static ImageReaderResult CesiumGltfReader::GltfReader::readImage ( const std::span< const std::byte > & data,
const CesiumGltf::Ktx2TranscodeTargets & ktx2TranscodeTargets )
static

Reads an Image from a buffer.

Deprecated
Use ImageDecoder::readImage instead.

◆ resolveExternalData()

static CesiumAsync::Future< GltfReaderResult > CesiumGltfReader::GltfReader::resolveExternalData ( const CesiumAsync::AsyncSystem & asyncSystem,
const std::string & baseUrl,
const CesiumAsync::HttpHeaders & headers,
const std::shared_ptr< CesiumAsync::IAssetAccessor > & pAssetAccessor,
const GltfReaderOptions & options,
GltfReaderResult && result )
static

Accepts the result of readGltf and resolves any remaining external buffers and images.

Parameters
asyncSystemThe async system to use for resolving external data.
baseUrlThe base url that all the external uris are relative to.
headersThe http headers needed to make any external data requests.
pAssetAccessorThe asset accessor to use to request the external buffers and images.
optionsOptions for how to read the glTF.
resultThe result of the synchronous readGltf invocation.

The documentation for this class was generated from the following file: