![]() |
MaterialX 1.38.7
|
A type descriptor for MaterialX data types. More...
#include <TypeDesc.h>
Public Member Functions | |
const string & | getName () const |
Return the name of the type. | |
unsigned char | getBaseType () const |
Return the basetype for the type. | |
int | getChannelIndex (char channel) const |
Returns the channel index for the supplied channel name. More... | |
unsigned char | getSemantic () const |
Return the semantic for the type. | |
size_t | getSize () const |
Return the number of elements the type is composed of. More... | |
bool | isEditable () const |
Returns true if the type is editable by users. More... | |
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. | |
Static Public Member Functions | |
static const TypeDesc * | registerType (const string &name, unsigned char basetype, unsigned char semantic=SEMANTIC_NONE, size_t size=1, bool editable=true, const ChannelMap &channelMapping=ChannelMap()) |
Register a type descriptor for a MaterialX data type. More... | |
static const TypeDesc * | get (const string &name) |
Get a type descriptor for given name. More... | |
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. A unique type descriptor pointer is the identifier used for types, and can be used for type comparisons as well as getting more information about the type. All standard library data types are registered by default and their type descriptors can be accessed from the Type namespace, e.g. MaterialX::Type::FLOAT. If custom types are used they must be registered by calling TypeDesc::registerType(). Descriptors for registered types can be retreived using TypeDesc::get(), see below.
|
static |
Get a type descriptor for given name.
Returns an empty shared pointer if no type with the given name is found.
int getChannelIndex | ( | char | channel | ) | const |
Returns the channel index for the supplied channel name.
Will return -1 on failure to find a matching index.
|
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.
|
inline |
Returns true if the type is editable by users.
Editable types are allowed to be published as shader uniforms and hence must be presentable in a user interface.
|
static |
Register a type descriptor for a MaterialX data type.
Throws an exception if a type with the same name is already registered.