cesium-native  0.41.0
CesiumGltf::PropertyTextureView Class Reference

A view on a PropertyTexture. More...

#include <CesiumGltf/PropertyTextureView.h>

Public Member Functions

 PropertyTextureView (const Model &model, const PropertyTexture &propertyTexture) noexcept
 Construct a PropertyTextureView. More...
 
PropertyTextureViewStatus status () const noexcept
 Gets the status of this property texture view. More...
 
const std::optional< std::string > & name () const noexcept
 Gets the name of the property texture being viewed. Returns std::nullopt if no name was specified.
 
const ClassgetClass () const noexcept
 Gets the Class that this property texture conforms to. More...
 
const ClassPropertygetClassProperty (const std::string &propertyId) const
 Finds the ClassProperty that describes the type information of the property with the specified id. More...
 
template<typename T , bool Normalized = false>
PropertyTexturePropertyView< T, Normalized > getPropertyView (const std::string &propertyId, const TextureViewOptions &propertyOptions=TextureViewOptions()) const
 Gets a PropertyTexturePropertyView that views the data of a property stored in the PropertyTexture. More...
 
template<typename Callback >
void getPropertyView (const std::string &propertyId, Callback &&callback, const TextureViewOptions &propertyOptions=TextureViewOptions()) const
 Gets a PropertyTexturePropertyView through a callback that accepts a property id and a PropertyTexturePropertyView<T> that views the data of the property with the specified id. More...
 
template<typename Callback >
void forEachProperty (Callback &&callback, const TextureViewOptions &propertyOptions=TextureViewOptions()) const
 Iterates over each property in the PropertyTexture with a callback that accepts a property id and a PropertyTexturePropertyView<T> to view the data stored in the PropertyTextureProperty. More...
 

Detailed Description

A view on a PropertyTexture.

This should be used to get a PropertyTexturePropertyView of a property in the property texture. It will validate the EXT_structural_metadata format and ensure PropertyTexturePropertyView does not access data out of bounds.

Definition at line 50 of file PropertyTextureView.h.

Constructor & Destructor Documentation

◆ PropertyTextureView()

CesiumGltf::PropertyTextureView::PropertyTextureView ( const Model model,
const PropertyTexture propertyTexture 
)
noexcept

Construct a PropertyTextureView.

Parameters
modelThe glTF that contains the property texture's data.
propertyTextureThe PropertyTexture from which the view will retrieve data.

Member Function Documentation

◆ forEachProperty()

template<typename Callback >
void CesiumGltf::PropertyTextureView::forEachProperty ( Callback &&  callback,
const TextureViewOptions propertyOptions = TextureViewOptions() 
) const
inline

Iterates over each property in the PropertyTexture with a callback that accepts a property id and a PropertyTexturePropertyView<T> to view the data stored in the PropertyTextureProperty.

This method will validate the EXT_structural_metadata format to ensure PropertyTexturePropertyView retrieves the correct data. T must be a scalar with a supported component type (int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float), a glm vecN composed of one of the scalar types, or a PropertyArrayView containing one of the scalar types.

If the property is invalid, an empty PropertyTexturePropertyView with an error status will be passed to the callback. Otherwise, a valid property view will be passed to the callback.

Template Parameters
callbackA callback function that accepts property id and PropertyTexturePropertyView<T>
Parameters
propertyOptionsThe options to apply to each property in the property texture.

Definition at line 291 of file PropertyTextureView.h.

◆ getClass()

const Class* CesiumGltf::PropertyTextureView::getClass ( ) const
inlinenoexcept

Gets the Class that this property texture conforms to.

Returns
A pointer to the Class. Returns nullptr if the PropertyTexture did not specify a valid class.

Definition at line 85 of file PropertyTextureView.h.

◆ getClassProperty()

const ClassProperty* CesiumGltf::PropertyTextureView::getClassProperty ( const std::string &  propertyId) const

Finds the ClassProperty that describes the type information of the property with the specified id.

Parameters
propertyIdThe id of the property to retrieve the class for.
Returns
A pointer to the ClassProperty. Return nullptr if the PropertyTextureView is invalid or if no class property was found.

◆ getPropertyView() [1/2]

template<typename Callback >
void CesiumGltf::PropertyTextureView::getPropertyView ( const std::string &  propertyId,
Callback &&  callback,
const TextureViewOptions propertyOptions = TextureViewOptions() 
) const
inline

Gets a PropertyTexturePropertyView through a callback that accepts a property id and a PropertyTexturePropertyView<T> that views the data of the property with the specified id.

This method will validate the EXT_structural_metadata format to ensure PropertyTexturePropertyView retrieves the correct data. T must be a scalar with a supported component type (int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float), a glm vecN composed of one of the scalar types, or a PropertyArrayView containing one of the scalar types.

If the property is somehow invalid, an empty PropertyTexturePropertyView with an error status will be passed to the callback. Otherwise, a valid property view will be passed to the callback.

Parameters
propertyIdThe id of the property to retrieve data from
Template Parameters
callbackA callback function that accepts a property id and a PropertyTexturePropertyView<T>
Parameters
propertyOptionsThe options to apply to the property.

Definition at line 163 of file PropertyTextureView.h.

◆ getPropertyView() [2/2]

template<typename T , bool Normalized = false>
PropertyTexturePropertyView<T, Normalized> CesiumGltf::PropertyTextureView::getPropertyView ( const std::string &  propertyId,
const TextureViewOptions propertyOptions = TextureViewOptions() 
) const
inline

Gets a PropertyTexturePropertyView that views the data of a property stored in the PropertyTexture.

This method will validate the EXT_structural_metadata format to ensure PropertyTexturePropertyView retrieves the correct data. T must be a scalar with a supported component type (int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, float), a glm vecN composed of one of the scalar types, or a PropertyArrayView containing one of the scalar types.

If T does not match the type specified by the class property, this returns an invalid PropertyTexturePropertyView. Likewise, if the value of Normalized does not match the value of {@ClassProperty::normalized} for that class property, this returns an invalid property view. Only types with integer components may be normalized.

Template Parameters
TThe C++ type corresponding to the type of the data retrieved.
NormalizedWhether the property is normalized. Only applicable to types with integer components.
Parameters
propertyIdThe ID of the property to retrieve data from
propertyOptionsThe options to apply to the property.
Returns
A PropertyTexturePropertyView of the property. If no valid property is found, the property view will be invalid.

Definition at line 122 of file PropertyTextureView.h.

◆ status()

PropertyTextureViewStatus CesiumGltf::PropertyTextureView::status ( ) const
inlinenoexcept

Gets the status of this property texture view.

Indicates whether the view accurately reflects the property texture's data, or whether an error occurred.

Definition at line 69 of file PropertyTextureView.h.


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