ArcGIS Procedural Runtime  3.2.10650
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes
prtx::Material Class Referenceabstract

#include <Material.h>

Inheritance diagram for prtx::Material:
[legend]

Public Member Functions

virtual const WStringVectorgetBlindDataKeys () const =0
 
virtual ShaderPtr getShader () const =0
 
virtual TexturePtr getTexture (const std::wstring &key) const =0
 
virtual const TexturePtrVectorgetTextureArray (const std::wstring &key) const =0
 
virtual TexturePtr getTextureArrayItem (const std::wstring &key, size_t index) const =0
 
virtual const WStringVectorgetKeys () const =0
 
virtual bool hasKey (const std::wstring &key) const =0
 
virtual PrimitiveType getType (const std::wstring &key) const =0
 
virtual Bool getBool (const std::wstring &key) const =0
 
virtual int32_t getInt (const std::wstring &key) const =0
 
virtual double getFloat (const std::wstring &key) const =0
 
virtual const std::wstring & getString (const std::wstring &key) const =0
 
virtual const BoolVectorgetBoolArray (const std::wstring &key) const =0
 
virtual const Int32VectorgetIntArray (const std::wstring &key) const =0
 
virtual const DoubleVectorgetFloatArray (const std::wstring &key) const =0
 
virtual const WStringVectorgetStringArray (const std::wstring &key) const =0
 
virtual void * getBlindData (const std::wstring &key) const =0
 
- Public Member Functions inherited from prtx::ComparableContent
virtual bool compare (const ComparableContent &rhs) const =0
 
virtual bool operator!= (const ComparableContent &rhs) const =0
 
virtual bool operator< (const ComparableContent &rhs) const =0
 
virtual bool operator== (const ComparableContent &rhs) const =0
 
- Public Member Functions inherited from prtx::Content
 Content (const Content &)=delete
 
Contentoperator= (const Content &)=delete
 
- Public Member Functions inherited from prtx::BuiltinMaterialAttributes
virtual double ambient_b () const =0
 
virtual double ambient_g () const =0
 
virtual double ambient_r () const =0
 
virtual const std::vector< double > & ambientColor () const =0
 
virtual const std::wstring & bumpmap () const =0
 
virtual const std::vector< prtx::TexturePtr > & bumpMap () const =0
 
virtual double bumpmap_rw () const =0
 
virtual double bumpmap_su () const =0
 
virtual double bumpmap_sv () const =0
 
virtual double bumpmap_tu () const =0
 
virtual double bumpmap_tv () const =0
 
virtual double bumpValue () const =0
 
virtual double color_b () const =0
 
virtual double color_g () const =0
 
virtual double color_r () const =0
 
virtual const std::wstring & colormap () const =0
 
virtual double colormap_rw () const =0
 
virtual double colormap_su () const =0
 
virtual double colormap_sv () const =0
 
virtual double colormap_tu () const =0
 
virtual double colormap_tv () const =0
 
virtual const std::vector< double > & diffuseColor () const =0
 
virtual const std::vector< prtx::TexturePtr > & diffuseMap () const =0
 
virtual const std::wstring & dirtmap () const =0
 
virtual double dirtmap_rw () const =0
 
virtual double dirtmap_su () const =0
 
virtual double dirtmap_sv () const =0
 
virtual double dirtmap_tu () const =0
 
virtual double dirtmap_tv () const =0
 
virtual bool doubleSided () const =0
 
virtual double emissive_b () const =0
 
virtual double emissive_g () const =0
 
virtual double emissive_r () const =0
 
virtual const std::vector< double > & emissiveColor () const =0
 
virtual const std::wstring & emissivemap () const =0
 
virtual const std::vector< prtx::TexturePtr > & emissiveMap () const =0
 
virtual double emissivemap_rw () const =0
 
virtual double emissivemap_su () const =0
 
virtual double emissivemap_sv () const =0
 
virtual double emissivemap_tu () const =0
 
virtual double emissivemap_tv () const =0
 
virtual double metallic () const =0
 
virtual const std::wstring & metallicmap () const =0
 
virtual const std::vector< prtx::TexturePtr > & metallicMap () const =0
 
virtual double metallicmap_rw () const =0
 
virtual double metallicmap_su () const =0
 
virtual double metallicmap_sv () const =0
 
virtual double metallicmap_tu () const =0
 
virtual double metallicmap_tv () const =0
 
virtual const std::wstring & name () const =0
 
virtual const std::wstring & normalmap () const =0
 
virtual const std::vector< prtx::TexturePtr > & normalMap () const =0
 
virtual double normalmap_rw () const =0
 
virtual double normalmap_su () const =0
 
virtual double normalmap_sv () const =0
 
virtual double normalmap_tu () const =0
 
virtual double normalmap_tv () const =0
 
virtual const std::wstring & occlusionmap () const =0
 
virtual const std::vector< prtx::TexturePtr > & occlusionMap () const =0
 
virtual double occlusionmap_rw () const =0
 
virtual double occlusionmap_su () const =0
 
virtual double occlusionmap_sv () const =0
 
virtual double occlusionmap_tu () const =0
 
virtual double occlusionmap_tv () const =0
 
virtual double opacity () const =0
 
virtual const std::wstring & opacitymap () const =0
 
virtual const std::vector< prtx::TexturePtr > & opacityMap () const =0
 
virtual double opacitymap_cutoff () const =0
 
virtual const std::wstring & opacitymap_mode () const =0
 
virtual double opacitymap_rw () const =0
 
virtual double opacitymap_su () const =0
 
virtual double opacitymap_sv () const =0
 
virtual double opacitymap_tu () const =0
 
virtual double opacitymap_tv () const =0
 
virtual double reflectivity () const =0
 
virtual double roughness () const =0
 
virtual const std::wstring & roughnessmap () const =0
 
virtual const std::vector< prtx::TexturePtr > & roughnessMap () const =0
 
virtual double roughnessmap_rw () const =0
 
virtual double roughnessmap_su () const =0
 
virtual double roughnessmap_sv () const =0
 
virtual double roughnessmap_tu () const =0
 
virtual double roughnessmap_tv () const =0
 
virtual const std::wstring & shader () const =0
 
virtual double shininess () const =0
 
virtual double specular_b () const =0
 
virtual double specular_g () const =0
 
virtual double specular_r () const =0
 
virtual const std::vector< double > & specularColor () const =0
 
virtual const std::wstring & specularmap () const =0
 
virtual const std::vector< prtx::TexturePtr > & specularMap () const =0
 
virtual double specularmap_rw () const =0
 
virtual double specularmap_su () const =0
 
virtual double specularmap_sv () const =0
 
virtual double specularmap_tu () const =0
 
virtual double specularmap_tv () const =0
 

Static Public Member Functions

static std::pair< std::wstring, size_t > getShaderTextureArrayKeyAndIndexFromCGAMapName (const std::wstring &cgaMapName)
 

Static Public Attributes

static constexpr PrimitiveType PT_COUNT = prtx::Attributable::PT_COUNT + 2
 
static constexpr PrimitiveType PT_TEXTURE = PT_BLIND_DATA_ARRAY + 1
 
static constexpr PrimitiveType PT_TEXTURE_ARRAY = PT_TEXTURE + 1
 
- Static Public Attributes inherited from prtx::Attributable
static constexpr PrimitiveType PT_BLIND_DATA = prt::Attributable::PT_BLIND_DATA
 
static constexpr PrimitiveType PT_BLIND_DATA_ARRAY = prt::Attributable::PT_BLIND_DATA_ARRAY
 
static constexpr PrimitiveType PT_BOOL = prt::Attributable::PT_BOOL
 
static constexpr PrimitiveType PT_BOOL_ARRAY = prt::Attributable::PT_BOOL_ARRAY
 
static constexpr PrimitiveType PT_COUNT = prt::Attributable::PT_COUNT
 
static constexpr PrimitiveType PT_FLOAT = prt::Attributable::PT_FLOAT
 
static constexpr PrimitiveType PT_FLOAT_ARRAY = prt::Attributable::PT_FLOAT_ARRAY
 
static constexpr PrimitiveType PT_INT = prt::Attributable::PT_INT
 
static constexpr PrimitiveType PT_INT_ARRAY = prt::Attributable::PT_INT_ARRAY
 
static constexpr PrimitiveType PT_STRING = prt::Attributable::PT_STRING
 
static constexpr PrimitiveType PT_STRING_ARRAY = prt::Attributable::PT_STRING_ARRAY
 
static constexpr PrimitiveType PT_UNDEFINED = prt::Attributable::PT_UNDEFINED
 

Additional Inherited Members

- Public Types inherited from prtx::Attributable
using PrimitiveType = uint8_t
 
- Protected Member Functions inherited from prtx::BuiltinMaterialAttributes
virtual void fillBuiltinKeys (WStringVector &keys) const override
 
virtual bool getBuiltinBool (const std::wstring &k, bool &stat) const override
 
virtual double getBuiltinFloat (const std::wstring &k, bool &stat) const override
 
virtual const std::wstring & getBuiltinString (const std::wstring &k, bool &val) const override
 
virtual prt::Attributable::PrimitiveType getBuiltinType (const std::wstring &k) const override
 

Detailed Description

The read-only Material class stores values for the keys defined by CGA material shape attributes on the one hand and by the attached Shader on the other. The values can be accessed via the Attributable interface or via the BuiltinMaterialAttributes interface. While the former is a generic standard interface, the later is a set of named functions and significantly faster in most cases. For example, getting the red color component can be done in a few ways:

 CGA code:                  material.color.r
 Attributable interface:    mat.getFloat("color.r")
 BuiltinMaterialAttributes: mat.color_r()
                            mat.diffuseColor()[0]

The Attributable interface is extended with getters for the Texture type.

Colors (i.e. rgb tuples) are in (non-linear) sRGB space, as well as the matching rgb textures. See also below.

Below is a list of all supported keys. Please note that the two key sets are two different views on the same values. The CGA keys correspond 1:1 to the material attributes in CGA while the shader keys are designed for ease of use in conjunction with he typical formats encountered in decoder/encoder programming.

Valid keys:

See also
CGA material shape attributes, MaterialBuilder

Member Function Documentation

◆ getBlindData()

virtual void* prtx::Material::getBlindData ( const std::wstring &  key) const
pure virtual

Gets a blind data value.

Parameters
keyKey to look for.
Returns
blind data value associated with a key or throws an exception if key not found.

Implements prtx::Attributable.

◆ getBlindDataKeys()

virtual const WStringVector& prtx::Material::getBlindDataKeys ( ) const
pure virtual

Get all set blind data keys. The returned reference stays valid until destruction of the Attributable.

Returns
reference to vector with all blind data keys.

◆ getBool()

virtual Bool prtx::Material::getBool ( const std::wstring &  key) const
pure virtual

Gets a boolean value.

Parameters
keyKey to look for.
Returns
the value associated with a key or throws an exception if key not found.

Implements prtx::Attributable.

◆ getBoolArray()

virtual const BoolVector& prtx::Material::getBoolArray ( const std::wstring &  key) const
pure virtual

Gets an array of booleans. The returned reference stays valid until destruction of the Attributable.

Parameters
keyKey to look for.
Returns
reference to a vector associated with a key or throws an exception if key not found.

Implements prtx::Attributable.

◆ getFloat()

virtual double prtx::Material::getFloat ( const std::wstring &  key) const
pure virtual

Gets a float value.

Parameters
keyKey to look for.
Returns
the value associated with a key or throws an exception if key not found.

Implements prtx::Attributable.

◆ getFloatArray()

virtual const DoubleVector& prtx::Material::getFloatArray ( const std::wstring &  key) const
pure virtual

Gets an array of floats. The returned reference stays valid until destruction of the Attributable.

Parameters
keyKey to look for.
Returns
reference to a vector associated with a key or throws an exception if key not found.

Implements prtx::Attributable.

◆ getInt()

virtual int32_t prtx::Material::getInt ( const std::wstring &  key) const
pure virtual

Gets an integer value.

Parameters
keyKey to look for.
Returns
the value associated with a key or throws an exception if key not found.

Implements prtx::Attributable.

◆ getIntArray()

virtual const Int32Vector& prtx::Material::getIntArray ( const std::wstring &  key) const
pure virtual

Gets an array of integers. The returned reference stays valid until destruction of the Attributable.

Parameters
keyKey to look for.
Returns
reference to a vector associated with a key or throws an exception if key not found.

Implements prtx::Attributable.

◆ getKeys()

virtual const WStringVector& prtx::Material::getKeys ( ) const
pure virtual

Attributable Interface

Implements prtx::Attributable.

◆ getShader()

virtual ShaderPtr prtx::Material::getShader ( ) const
pure virtual
Returns
The Shader associated with this Material.

◆ getShaderTextureArrayKeyAndIndexFromCGAMapName()

static std::pair<std::wstring, size_t> prtx::Material::getShaderTextureArrayKeyAndIndexFromCGAMapName ( const std::wstring &  cgaMapName)
static

Helper function to find the texture array key and index representing a cga map. Each CGA shape material map attribute (e.g., colormap) has an associated item in an Texture array in the default shader. See ShaderTextureKeys. In order to get a Texture via getTextureArrayItem(), getTextureArray() or getTexture(), the shader key must be used.

Parameters
cgaMapNameThe name of the CGA Shape material attribute, e.g. "colormap" or "metallicmap".
Returns
A pair with the matching shader key for the texture array (e.g. "diffuseMap") and the index into that array (e.g. 0).

◆ getString()

virtual const std::wstring& prtx::Material::getString ( const std::wstring &  key) const
pure virtual

Gets a string. The returned reference stays valid until destruction of the Attributable.

Parameters
keyKey to look for.
Returns
reference to the string associated with a key or throws an exception if key not found.

Implements prtx::Attributable.

◆ getStringArray()

virtual const WStringVector& prtx::Material::getStringArray ( const std::wstring &  key) const
pure virtual

Gets an array of strings. The returned reference stays valid until destruction of the Attributable.

Parameters
keyKey to look for.
Returns
reference to a vector associated with a key or throws an exception if key not found.

Implements prtx::Attributable.

◆ getTexture()

virtual TexturePtr prtx::Material::getTexture ( const std::wstring &  key) const
pure virtual

Gets a Texture.

Parameters
keyKey to look for. Valid keys are listed in ShaderTextureKeys.
Returns
Pointer to the Texture associated with a key or throws an exception if key not found.
See also
Material::getShaderTextureArrayKeyAndIndexFromCGAMapName().

◆ getTextureArray()

virtual const TexturePtrVector& prtx::Material::getTextureArray ( const std::wstring &  key) const
pure virtual

Gets an array of Textures. The returned reference stays valid until destruction of the Material. Note that for convenience, getTextureArray() can also be used to get attributes of type PT_TEXTURE as an array with 1 element.

Parameters
keyKey to look for. Valid keys are listed in ShaderTextureKeys.
Returns
reference to a vector associated with a key or throws an exception if key not found.
See also
Material::getShaderTextureArrayKeyAndIndexFromCGAMapName().

◆ getTextureArrayItem()

virtual TexturePtr prtx::Material::getTextureArrayItem ( const std::wstring &  key,
size_t  index 
) const
pure virtual

Gets the item at index in an array of Textures. Note that for convenience, getTextureArrayItem() can also be used to get attributes of type PT_TEXTURE (use index 0).

Parameters
keyKey to look for. Valid keys are listed in ShaderTextureKeys.
indexThe index of the desired texture in the array. Throws std::out_of_range if index is out of range. Valid indices are listed in ShaderTextureKeys.
Returns
Pointer to a Texture associated with a key or throws an exception if key not found.
Exceptions
std::out_of_range
See also
Material::getShaderTextureArrayKeyAndIndexFromCGAMapName().

◆ getType()

virtual PrimitiveType prtx::Material::getType ( const std::wstring &  key) const
pure virtual
Parameters
keyKey to look for.
Returns
the type of the key's value or throws an exception if key is not found.

Implements prtx::Attributable.

◆ hasKey()

virtual bool prtx::Material::hasKey ( const std::wstring &  key) const
pure virtual

Checks whether a key is set.

Parameters
keyKey to look for.
Returns
true if the key is set, false otherwise.

Implements prtx::Attributable.

Member Data Documentation

◆ PT_TEXTURE

constexpr PrimitiveType prtx::Material::PT_TEXTURE = PT_BLIND_DATA_ARRAY + 1
static

Additional primitive types for Material


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