cesium-native  0.41.0
CesiumGltf::TextureView Class Reference
Inheritance diagram for CesiumGltf::TextureView:
CesiumGltf::FeatureIdTextureView CesiumGltf::PropertyTexturePropertyView< ElementType, false > CesiumGltf::PropertyTexturePropertyView< ElementType, true >

Public Member Functions

 TextureView () noexcept
 Constructs an empty, uninitialized texture view.
 
 TextureView (const Model &model, const TextureInfo &textureInfo, const TextureViewOptions &options=TextureViewOptions()) noexcept
 Constructs a view of the texture specified by the given TextureInfo. More...
 
 TextureView (const Sampler &sampler, const ImageAsset &image, int64_t textureCoordinateSetIndex, const ExtensionKhrTextureTransform *pKhrTextureTransformExtension=nullptr, const TextureViewOptions &options=TextureViewOptions()) noexcept
 Constructs a view of the texture specified by the given Sampler and ImageAsset. More...
 
TextureViewStatus getTextureViewStatus () const noexcept
 Get the status of this texture view. More...
 
int64_t getTexCoordSetIndex () const noexcept
 Get the texture coordinate set index for this view. If this view was constructed with options.applyKhrTextureTransformExtension as true, and if the texture contains the KHR_texture_transform extension, then this will return the value from the extension since it is meant to override the original index. However, if the extension does not specify a TEXCOORD set index, then the original index of the texture is returned.
 
const SamplergetSampler () const noexcept
 Get the sampler describing how to sample the data from the property's texture. More...
 
const ImageAssetgetImage () const noexcept
 Get the image containing this property's data. If this view was constructed with options.makeImageCopy set to true, this will return a pointer to the copied image. More...
 
std::optional< KhrTextureTransformgetTextureTransform () const noexcept
 Get the KHR_texture_transform for this texture if it exists. More...
 
std::vector< uint8_t > sampleNearestPixel (double u, double v, const std::vector< int64_t > &channels) const noexcept
 Samples the image at the specified texture coordinates using NEAREST pixel filtering, returning the bytes as uint8_t values. A channels vector must be supplied to specify how many image channels are needed, and in what order the bytes should be retrieved.
 

Detailed Description

Definition at line 95 of file TextureView.h.

Constructor & Destructor Documentation

◆ TextureView() [1/2]

CesiumGltf::TextureView::TextureView ( const Model model,
const TextureInfo textureInfo,
const TextureViewOptions options = TextureViewOptions() 
)
noexcept

Constructs a view of the texture specified by the given TextureInfo.

Parameters
modelThe glTF model in which to look for the texture's data.
textureInfoThe texture info to create a view for.
optionsThe options for constructing the view.

◆ TextureView() [2/2]

CesiumGltf::TextureView::TextureView ( const Sampler sampler,
const ImageAsset image,
int64_t  textureCoordinateSetIndex,
const ExtensionKhrTextureTransform pKhrTextureTransformExtension = nullptr,
const TextureViewOptions options = TextureViewOptions() 
)
noexcept

Constructs a view of the texture specified by the given Sampler and ImageAsset.

Parameters
samplerThe Sampler used by the texture.
imageThe ImageAsset used by the texture.
textureCoordinateSetIndexThe set index for the TEXCOORD_n attribute used to sample this texture.
pKhrTextureTransformExtensionA pointer to the KHR_texture_transform extension on the texture, if it exists.
optionsThe options for constructing the view.

Member Function Documentation

◆ getImage()

const ImageAsset* CesiumGltf::TextureView::getImage ( ) const
inlinenoexcept

Get the image containing this property's data. If this view was constructed with options.makeImageCopy set to true, this will return a pointer to the copied image.

This will be nullptr if the texture view runs into problems during construction.

Definition at line 176 of file TextureView.h.

◆ getSampler()

const Sampler* CesiumGltf::TextureView::getSampler ( ) const
inlinenoexcept

Get the sampler describing how to sample the data from the property's texture.

This will be nullptr if the property texture property view runs into problems during construction.

Definition at line 166 of file TextureView.h.

◆ getTextureTransform()

std::optional<KhrTextureTransform> CesiumGltf::TextureView::getTextureTransform ( ) const
inlinenoexcept

Get the KHR_texture_transform for this texture if it exists.

Even if this view was constructed with options.applyKhrTextureTransformExtension set to false, it will save the extension's values, and they may be retrieved through this function.

If this view was constructed with applyKhrTextureTransformExtension set to true, any texture coordinates passed into get or getRaw will be automatically transformed, so there's no need to re-apply the transform here.

Definition at line 195 of file TextureView.h.

◆ getTextureViewStatus()

TextureViewStatus CesiumGltf::TextureView::getTextureViewStatus ( ) const
inlinenoexcept

Get the status of this texture view.

If invalid, it will not be safe to sample from this view.

Definition at line 139 of file TextureView.h.


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