![]() |
MaterialX 1.39.3
|
A type descriptor for MaterialX data types. More...
#include <TypeDesc.h>
Classes | |
class | DataBlock |
Data block holding large data needed by the type description. More... | |
struct | Hasher |
Hash operator. More... | |
Public Types | |
enum | BaseType { BASETYPE_NONE , BASETYPE_BOOLEAN , BASETYPE_INTEGER , BASETYPE_FLOAT , BASETYPE_STRING , BASETYPE_STRUCT , BASETYPE_LAST } |
enum | Semantic { SEMANTIC_NONE , SEMANTIC_COLOR , SEMANTIC_VECTOR , SEMANTIC_MATRIX , SEMANTIC_FILENAME , SEMANTIC_CLOSURE , SEMANTIC_SHADER , SEMANTIC_MATERIAL , SEMANTIC_ENUM , SEMANTIC_LAST } |
using | DataBlockPtr = std::shared_ptr<DataBlock> |
Public Member Functions | |
constexpr | TypeDesc () noexcept |
Empty constructor. | |
constexpr | TypeDesc (std::string_view name, uint8_t basetype, uint8_t semantic, uint16_t size, const DataBlock *data) noexcept |
Constructor. | |
uint32_t | typeId () const |
Return the unique id assigned to this type. | |
const string & | getName () const |
Return the name of the type. | |
unsigned char | getBaseType () const |
Return the basetype for the type. | |
unsigned char | getSemantic () const |
Return the semantic for the type. | |
size_t | getSize () const |
Return the number of elements the type is composed of. | |
bool | isScalar () const |
Return true if the type is a scalar type. | |
bool | isAggregate () const |
Return true if the type is an aggregate type. | |
bool | isArray () const |
Return true if the type is an array type. | |
bool | isFloat2 () const |
Return true if the type is an aggregate of 2 floats. | |
bool | isFloat3 () const |
Return true if the type is an aggregate of 3 floats. | |
bool | isFloat4 () const |
Return true if the type is an aggregate of 4 floats. | |
bool | isClosure () const |
Return true if the type represents a closure. | |
bool | isStruct () const |
Return true if the type represents a struct. | |
StructMemberDescVecPtr | getStructMembers () const |
Return a pointer to the struct member description. | |
bool | operator== (TypeDesc rhs) const |
Equality operator. | |
bool | operator!= (TypeDesc rhs) const |
Inequality operator. | |
bool | operator< (TypeDesc rhs) const |
Less-than operator. | |
ValuePtr | createValueFromStrings (const string &value) const |
Create a Value from a string for a given typeDesc. | |
Static Public Attributes | |
static const string | NONE_TYPE_NAME |
A type descriptor for MaterialX data types.
All types need to have a type descriptor registered in order for shader generators to know about the type. It can be used for type comparisons as well as getting more information about the type. Type descriptors for all standard library data types are defined by default and can be accessed from the Type namespace, e.g. Type::FLOAT. Custom struct types defined through typedef elements in a data library are loaded in and registered by calling the ShaderGenerator::registerTypeDefs method. The TypeSystem class, see below, is used to manage all type descriptions. It can be used to query the registered types.
|
inline |
Return the number of elements the type is composed of.
Will return 1 for scalar types and a size greater than 1 for aggregate type. For array types 0 is returned since the number of elements is undefined until an array is instantiated.
StructMemberDescVecPtr getStructMembers | ( | ) | const |
Return a pointer to the struct member description.
Will return nullptr if this is not a struct type.
|
inline |
Return the unique id assigned to this type.
The id is a hash of the given type name.