cesium-native 0.62.0
Loading...
Searching...
No Matches
CesiumGltf::PropertyTexturePropertyView< ElementType, true > Class Template Reference

A view of the normalized data specified by a PropertyTextureProperty. More...

#include <CesiumGltf/PropertyTexturePropertyView.h>

Inheritance diagram for CesiumGltf::PropertyTexturePropertyView< ElementType, true >:
CesiumGltf::PropertyView< ElementType, true > CesiumGltf::TextureView

Public Member Functions

 PropertyTexturePropertyView () noexcept
 Constructs an invalid instance for a non-existent property.
 
 PropertyTexturePropertyView (PropertyViewStatusType status) noexcept
 Constructs an invalid instance for an erroneous property.
 
 PropertyTexturePropertyView (const ClassProperty &classProperty) noexcept
 Constructs an instance of an empty property that specifies a default value. Although this property has no data, it can return the default value when PropertyTexturePropertyView<ElementType, true>::get is called. However, PropertyTexturePropertyView<ElementType, true>::getRaw cannot be used.
 
 PropertyTexturePropertyView (const PropertyTextureProperty &property, const ClassProperty &classProperty, const Sampler &sampler, const CesiumImage::ImageAsset &image, const TextureViewOptions &options=TextureViewOptions()) noexcept
 Construct a view of the data specified by a PropertyTextureProperty.
 
std::optional< PropertyValueViewToCopy< NormalizedType > > get (double u, double v) const noexcept
 Gets the value of the property for the given texture coordinates with all value transforms applied. That is, if the property specifies an offset and scale, they will be applied to the value before the value is returned. The sampler's wrapping mode will be used when sampling the texture.
 
PropertyValueViewToCopy< ElementType > getRaw (double u, double v) const noexcept
 Gets the raw value of the property for the given texture coordinates. The sampler's wrapping mode will be used when sampling the texture.
 
const std::vector< int64_t > & getChannels () const noexcept
 Gets the channels of this property texture property.
 
const std::string & getSwizzle () const noexcept
 Gets this property's channels as a swizzle string.
 
- Public Member Functions inherited from CesiumGltf::PropertyView< ElementType, true >
 PropertyView ()
 Constructs an empty property instance.
 
 PropertyView (const ClassProperty &classProperty)
 Constructs a property instance from a class definition only.
 
PropertyViewStatusType status () const noexcept
 Constructs an empty property instance. false>status
 
const std::optional< std::string > & name () const noexcept
 Constructs an empty property instance. false>name
 
const std::optional< std::string > & semantic () const noexcept
 Constructs an empty property instance. false>semantic
 
const std::optional< std::string > & description () const noexcept
 Constructs an empty property instance. false>description
 
int64_t arrayCount () const noexcept
 Constructs an empty property instance. false>arrayCount
 
bool normalized () const noexcept
 Constructs an empty property instance. false>normalized
 
std::optional< NormalizedType > offset () const noexcept
 Constructs an empty property instance. false>offset
 
std::optional< NormalizedType > scale () const noexcept
 Constructs an empty property instance. false>scale
 
std::optional< NormalizedType > max () const noexcept
 Constructs an empty property instance. false>max
 
std::optional< NormalizedType > min () const noexcept
 Constructs an empty property instance. false>min
 
bool required () const noexcept
 Constructs an empty property instance. false>required
 
std::optional< ElementType > noData () const noexcept
 Constructs an empty property instance. false>noData
 
std::optional< NormalizedType > defaultValue () const noexcept
 Constructs an empty property instance. false>defaultValue
 
PropertyType propertyType () const noexcept
 Returns the PropertyType of the property this view is accessing.
 
- Public Member Functions inherited from CesiumGltf::TextureView
 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.
 
 TextureView (const Sampler &sampler, const CesiumImage::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 CesiumImage::ImageAsset.
 
TextureViewStatus getTextureViewStatus () const noexcept
 Get the status of this texture view.
 
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.
 
const CesiumImage::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.
 
std::optional< KhrTextureTransformgetTextureTransform () const noexcept
 Get the KHR_texture_transform for this texture if it exists.
 
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.
 

Additional Inherited Members

- Protected Member Functions inherited from CesiumGltf::PropertyView< ElementType, true >
 PropertyView (PropertyViewStatusType status)
 Constructs an invalid instance for an erroneous property.
 
 PropertyView (const ClassProperty &classProperty, const PropertyTableProperty &property)
 Constructs a property instance from a property table property and its class definition.
 
 PropertyView (const ClassProperty &classProperty, const PropertyTextureProperty &property)
 Constructs a property instance from a property texture property and its class definition.
 
 PropertyView (const ClassProperty &classProperty, const PropertyAttributeProperty &property)
 Constructs a property instance from a property attribute property and its class definition.
 
- Protected Attributes inherited from CesiumGltf::PropertyView< ElementType, true >
PropertyViewStatusType _status
 Indicates the status of a property view.
 

Detailed Description

template<typename ElementType>
class CesiumGltf::PropertyTexturePropertyView< ElementType, true >

A view of the normalized data specified by a PropertyTextureProperty.

Provides utilities to sample the property texture property using texture coordinates.

Definition at line 574 of file PropertyTexturePropertyView.h.

Constructor & Destructor Documentation

◆ PropertyTexturePropertyView() [1/4]

template<typename ElementType>
CesiumGltf::PropertyTexturePropertyView< ElementType, true >::PropertyTexturePropertyView ( )
inlinenoexcept

Constructs an invalid instance for a non-existent property.

Definition at line 583 of file PropertyTexturePropertyView.h.

◆ PropertyTexturePropertyView() [2/4]

template<typename ElementType>
CesiumGltf::PropertyTexturePropertyView< ElementType, true >::PropertyTexturePropertyView ( PropertyViewStatusType status)
inlinenoexcept

Constructs an invalid instance for an erroneous property.

Parameters
statusThe code from PropertyTexturePropertyViewStatus indicating the error with the property.

Definition at line 594 of file PropertyTexturePropertyView.h.

◆ PropertyTexturePropertyView() [3/4]

template<typename ElementType>
CesiumGltf::PropertyTexturePropertyView< ElementType, true >::PropertyTexturePropertyView ( const ClassProperty & classProperty)
inlinenoexcept

Constructs an instance of an empty property that specifies a default value. Although this property has no data, it can return the default value when PropertyTexturePropertyView<ElementType, true>::get is called. However, PropertyTexturePropertyView<ElementType, true>::getRaw cannot be used.

Parameters
classPropertyThe ClassProperty this property conforms to.

Definition at line 613 of file PropertyTexturePropertyView.h.

◆ PropertyTexturePropertyView() [4/4]

template<typename ElementType>
CesiumGltf::PropertyTexturePropertyView< ElementType, true >::PropertyTexturePropertyView ( const PropertyTextureProperty & property,
const ClassProperty & classProperty,
const Sampler & sampler,
const CesiumImage::ImageAsset & image,
const TextureViewOptions & options = TextureViewOptions() )
inlinenoexcept

Construct a view of the data specified by a PropertyTextureProperty.

Parameters
propertyThe PropertyTextureProperty
classPropertyThe ClassProperty this property conforms to.
samplerThe Sampler used by the property.
imageThe CesiumImage::ImageAsset used by the property.
optionsThe options for constructing the view.

Definition at line 646 of file PropertyTexturePropertyView.h.

Member Function Documentation

◆ get()

template<typename ElementType>
std::optional< PropertyValueViewToCopy< NormalizedType > > CesiumGltf::PropertyTexturePropertyView< ElementType, true >::get ( double u,
double v ) const
inlinenoexcept

Gets the value of the property for the given texture coordinates with all value transforms applied. That is, if the property specifies an offset and scale, they will be applied to the value before the value is returned. The sampler's wrapping mode will be used when sampling the texture.

If this property has a specified "no data" value, and the retrieved element is equal to that value, then this will return the property's specified default value. If the property did not provide a default value, this returns std::nullopt.

Parameters
uThe u-component of the texture coordinates.
vThe v-component of the texture coordinates.
Returns
The value of the element, or std::nullopt if it matches the "no data" value

Definition at line 729 of file PropertyTexturePropertyView.h.

◆ getChannels()

template<typename ElementType>
const std::vector< int64_t > & CesiumGltf::PropertyTexturePropertyView< ElementType, true >::getChannels ( ) const
inlinenoexcept

Gets the channels of this property texture property.

Definition at line 800 of file PropertyTexturePropertyView.h.

◆ getRaw()

template<typename ElementType>
PropertyValueViewToCopy< ElementType > CesiumGltf::PropertyTexturePropertyView< ElementType, true >::getRaw ( double u,
double v ) const
inlinenoexcept

Gets the raw value of the property for the given texture coordinates. The sampler's wrapping mode will be used when sampling the texture.

If this property has a specified "no data" value, the raw value will still be returned, even if it equals the "no data" value.

Parameters
uThe u-component of the texture coordinates.
vThe v-component of the texture coordinates.
Returns
The value at the nearest pixel to the texture coordinates.

Definition at line 785 of file PropertyTexturePropertyView.h.

◆ getSwizzle()

template<typename ElementType>
const std::string & CesiumGltf::PropertyTexturePropertyView< ElementType, true >::getSwizzle ( ) const
inlinenoexcept

Gets this property's channels as a swizzle string.

Definition at line 807 of file PropertyTexturePropertyView.h.


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