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

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

#include <CesiumGltf/PropertyTexturePropertyView.h>

Inheritance diagram for CesiumGltf::PropertyTexturePropertyView< ElementType, false >:
CesiumGltf::PropertyView< ElementType, false > 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 get is called. However, 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.
 
 PropertyTexturePropertyView (const PropertyTextureProperty &property, const ClassProperty &classProperty, const CesiumGltf::Enum *pEnumDefinition, 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< ElementType > > 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, false >
 PropertyView ()
 Constructs an empty property instance.
 
 PropertyView (const ClassProperty &classProperty)
 Constructs a property instance from a class definition only.
 
 PropertyView (const ClassProperty &classProperty, const CesiumGltf::Enum *pEnumDefinition)
 Constructs a property instance from a class definition and enum definition.
 
PropertyViewStatusType status () const noexcept
 Gets the status of this property view, indicating whether an error occurred.
 
const std::optional< std::string > & name () const noexcept
 Gets the name of the property being viewed. Returns std::nullopt if no name was specified.
 
const std::optional< std::string > & semantic () const noexcept
 Gets the semantic of the property being viewed. The semantic is an identifier that describes how this property should be interpreted, and cannot be used by other properties in the class. Returns std::nullopt if no semantic was specified.
 
const std::optional< std::string > & description () const noexcept
 Gets the description of the property being viewed. Returns std::nullopt if no description was specified.
 
int64_t arrayCount () const noexcept
 Get the element count of the fixed-length arrays in this property. Only applicable when the property is an array type.
 
bool normalized () const noexcept
 Whether this property has a normalized integer type.
 
std::optional< ElementType > offset () const noexcept
 Gets the offset to apply to property values. Only applicable to SCALAR, VECN, and MATN types when the component type is FLOAT32 or FLOAT64, or when the property is normalized.
 
std::optional< ElementType > scale () const noexcept
 Gets the scale to apply to property values. Only applicable to SCALAR, VECN, and MATN types when the component type is FLOAT32 or FLOAT64, or when the property is normalized.
 
std::optional< ElementType > max () const noexcept
 Gets the maximum allowed value for the property. Only applicable to SCALAR, VECN, and MATN types. This is the maximum of all property values, after the transforms based on the normalized, offset, and scale properties have been applied.
 
std::optional< ElementType > min () const noexcept
 Gets the minimum allowed value for the property. Only applicable to SCALAR, VECN, and MATN types. This is the minimum of all property values, after the transforms based on the normalized, offset, and scale properties have been applied.
 
bool required () const noexcept
 Whether the property must be present in every entity conforming to the class. If not required, instances of the property may include "no data" values, or the entire property may be omitted.
 
std::optional< ElementType > noData () const noexcept
 Gets the "no data" value, i.e., the value representing missing data in the property wherever it appears. Also known as a sentinel value. This is given as the plain property value, without the transforms from the normalized, offset, and scale properties.
 
std::optional< ElementType > defaultValue () const noexcept
 Gets the default value to use when encountering a "no data" value or an omitted property. The value is given in its final form, taking the effect of normalized, offset, and scale properties into account.
 
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, false >
 PropertyView (PropertyViewStatusType status)
 Constructs an invalid instance for an erroneous property.
 
 PropertyView (const ClassProperty &classProperty, const PropertyTableProperty &property, const CesiumGltf::Enum *pEnumDefinition=nullptr)
 Constructs a property instance from a property table property and its class definition, with an optional associated enum definition.
 
 PropertyView (const ClassProperty &classProperty, const PropertyTextureProperty &property, const CesiumGltf::Enum *pEnumDefinition=nullptr)
 Constructs a property instance from a property texture property, class definition, and an optional associated enum definition.
 
 PropertyView (const ClassProperty &classProperty, const PropertyAttributeProperty &property, const CesiumGltf::Enum *pEnumDefinition=nullptr)
 Constructs a property instance from a property attribute property and its class definition, along with an optional enum definition.
 
- Protected Attributes inherited from CesiumGltf::PropertyView< ElementType, false >
PropertyViewStatusType _status
 Indicates the status of a property view.
 

Detailed Description

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

A view of the non-normalized data specified by a PropertyTextureProperty.

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

Template Parameters
ElementTypeThe type of the elements represented in the property view

Definition at line 265 of file PropertyTexturePropertyView.h.

Constructor & Destructor Documentation

◆ PropertyTexturePropertyView() [1/5]

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

Constructs an invalid instance for a non-existent property.

Definition at line 271 of file PropertyTexturePropertyView.h.

◆ PropertyTexturePropertyView() [2/5]

template<typename ElementType>
CesiumGltf::PropertyTexturePropertyView< ElementType, false >::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 282 of file PropertyTexturePropertyView.h.

◆ PropertyTexturePropertyView() [3/5]

template<typename ElementType>
CesiumGltf::PropertyTexturePropertyView< ElementType, false >::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 get is called. However, getRaw cannot be used.

Parameters
classPropertyThe ClassProperty this property conforms to.

Definition at line 299 of file PropertyTexturePropertyView.h.

◆ PropertyTexturePropertyView() [4/5]

template<typename ElementType>
CesiumGltf::PropertyTexturePropertyView< ElementType, false >::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 332 of file PropertyTexturePropertyView.h.

◆ PropertyTexturePropertyView() [5/5]

template<typename ElementType>
CesiumGltf::PropertyTexturePropertyView< ElementType, false >::PropertyTexturePropertyView ( const PropertyTextureProperty & property,
const ClassProperty & classProperty,
const CesiumGltf::Enum * pEnumDefinition,
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.
pEnumDefinitionThe CesiumGltf::Enum definition this property uses.
samplerThe Sampler used by the property.
imageThe CesiumImage::ImageAsset used by the property.
optionsThe options for constructing the view.

Definition at line 409 of file PropertyTexturePropertyView.h.

Member Function Documentation

◆ get()

template<typename ElementType>
std::optional< PropertyValueViewToCopy< ElementType > > CesiumGltf::PropertyTexturePropertyView< ElementType, false >::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, this will return the property's default value for any elements that equal this "no data" value. If the property did not specify 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 496 of file PropertyTexturePropertyView.h.

◆ getChannels()

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

Gets the channels of this property texture property.

Definition at line 548 of file PropertyTexturePropertyView.h.

◆ getRaw()

template<typename ElementType>
PropertyValueViewToCopy< ElementType > CesiumGltf::PropertyTexturePropertyView< ElementType, false >::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 533 of file PropertyTexturePropertyView.h.

◆ getSwizzle()

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

Gets this property's channels as a swizzle string.

Definition at line 555 of file PropertyTexturePropertyView.h.


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