6#ifndef MATERIALX_TYPEDESC_H
7#define MATERIALX_TYPEDESC_H
17using ChannelMap = std::unordered_map<char, int>;
58 static const TypeDesc* registerType(
const string& name,
unsigned char basetype,
unsigned char semantic = SEMANTIC_NONE,
59 size_t size = 1,
bool editable =
true,
const ChannelMap& channelMapping = ChannelMap());
63 static const TypeDesc* get(
const string& name);
66 const string&
getName()
const {
return _name; }
73 int getChannelIndex(
char channel)
const;
96 bool isArray()
const {
return _size == 0; }
99 bool isFloat2()
const {
return _size == 2 && (_semantic == SEMANTIC_COLOR || _semantic == SEMANTIC_VECTOR); }
102 bool isFloat3()
const {
return _size == 3 && (_semantic == SEMANTIC_COLOR || _semantic == SEMANTIC_VECTOR); }
105 bool isFloat4()
const {
return _size == 4 && (_semantic == SEMANTIC_COLOR || _semantic == SEMANTIC_VECTOR); }
108 TypeDesc(
const string& name,
unsigned char basetype,
unsigned char semantic,
size_t size,
109 bool editable,
const ChannelMap& channelMapping);
112 const unsigned char _basetype;
113 const unsigned char _semantic;
115 const bool _editable;
116 const ChannelMap _channelMapping;
126 extern MX_GENSHADER_API
const TypeDesc* NONE;
127 extern MX_GENSHADER_API
const TypeDesc* BOOLEAN;
128 extern MX_GENSHADER_API
const TypeDesc* INTEGER;
129 extern MX_GENSHADER_API
const TypeDesc* INTEGERARRAY;
130 extern MX_GENSHADER_API
const TypeDesc* FLOAT;
131 extern MX_GENSHADER_API
const TypeDesc* FLOATARRAY;
132 extern MX_GENSHADER_API
const TypeDesc* VECTOR2;
133 extern MX_GENSHADER_API
const TypeDesc* VECTOR3;
134 extern MX_GENSHADER_API
const TypeDesc* VECTOR4;
135 extern MX_GENSHADER_API
const TypeDesc* COLOR3;
136 extern MX_GENSHADER_API
const TypeDesc* COLOR4;
137 extern MX_GENSHADER_API
const TypeDesc* MATRIX33;
138 extern MX_GENSHADER_API
const TypeDesc* MATRIX44;
139 extern MX_GENSHADER_API
const TypeDesc* STRING;
140 extern MX_GENSHADER_API
const TypeDesc* FILENAME;
141 extern MX_GENSHADER_API
const TypeDesc* BSDF;
142 extern MX_GENSHADER_API
const TypeDesc* EDF;
143 extern MX_GENSHADER_API
const TypeDesc* VDF;
144 extern MX_GENSHADER_API
const TypeDesc* SURFACESHADER;
145 extern MX_GENSHADER_API
const TypeDesc* VOLUMESHADER;
146 extern MX_GENSHADER_API
const TypeDesc* DISPLACEMENTSHADER;
147 extern MX_GENSHADER_API
const TypeDesc* LIGHTSHADER;
Macros for declaring imported and exported symbols.
A type descriptor for MaterialX data types.
Definition: TypeDesc.h:29
bool isEditable() const
Returns true if the type is editable by users.
Definition: TypeDesc.h:87
const string & getName() const
Return the name of the type.
Definition: TypeDesc.h:66
bool isScalar() const
Return true if the type is a scalar type.
Definition: TypeDesc.h:90
size_t getSize() const
Return the number of elements the type is composed of.
Definition: TypeDesc.h:82
bool isFloat3() const
Return true if the type is an aggregate of 3 floats.
Definition: TypeDesc.h:102
unsigned char getSemantic() const
Return the semantic for the type.
Definition: TypeDesc.h:76
bool isAggregate() const
Return true if the type is an aggregate type.
Definition: TypeDesc.h:93
bool isFloat2() const
Return true if the type is an aggregate of 2 floats.
Definition: TypeDesc.h:99
bool isArray() const
Return true if the type is an array type.
Definition: TypeDesc.h:96
bool isFloat4() const
Return true if the type is an aggregate of 4 floats.
Definition: TypeDesc.h:105
unsigned char getBaseType() const
Return the basetype for the type.
Definition: TypeDesc.h:69