6#ifndef MATERIALX_SHADERGEN_UTIL_H
7#define MATERIALX_SHADERGEN_UTIL_H
16#include <unordered_set>
18MATERIALX_NAMESPACE_BEGIN
96MATERIALX_NAMESPACE_END
shared_ptr< const NodeDef > ConstNodeDefPtr
A shared pointer to a const NodeDef.
Definition: Definition.h:34
The top-level Document class.
shared_ptr< const Document > ConstDocumentPtr
A shared pointer to a const Document.
Definition: Document.h:24
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
Definition: Element.h:31
shared_ptr< const TypedElement > ConstTypedElementPtr
A shared pointer to a const TypedElement.
Definition: Element.h:38
shared_ptr< Input > InputPtr
A shared pointer to an Input.
Definition: Interface.h:31
shared_ptr< Output > OutputPtr
A shared pointer to an Output.
Definition: Interface.h:36
vector< string > StringVec
A vector of strings.
Definition: Library.h:55
std::unordered_map< string, string > StringMap
An unordered map with strings as both keys and values.
Definition: Library.h:57
Macros for declaring imported and exported symbols.
MX_GENSHADER_API void tokenSubstitution(const StringMap &substitutions, string &source)
Perform token substitutions on the given source string, using the given substituation map.
MX_GENSHADER_API bool hasElementAttributes(OutputPtr output, const StringVec &attributes)
Returns true if there is are any value elements with a given set of attributes either on the starting...
MX_GENSHADER_API NodePtr connectsToWorldSpaceNode(OutputPtr output)
Determine whether the given output is directly connected to a node that generates world-space coordin...
MX_GENSHADER_API bool elementRequiresShading(ConstTypedElementPtr element)
Determine if a given element requires shading / lighting for rendering.
MX_GENSHADER_API vector< TypedElementPtr > findRenderableMaterialNodes(ConstDocumentPtr doc)
Find all renderable material nodes in the given document.
MX_GENSHADER_API bool isTransparentSurface(ElementPtr element, const string &target=EMPTY_STRING)
Returns true if the given element is a surface shader with the potential of being transparent.
MX_GENSHADER_API InputPtr getNodeDefInput(InputPtr nodeInput, const string &target)
Given a node input, return the corresponding input within its matching nodedef.
MX_GENSHADER_API void mapValueToColor(ConstValuePtr value, Color4 &color)
Maps a value to a four channel color if it is of the appropriate type.
MX_GENSHADER_API bool requiresImplementation(ConstNodeDefPtr nodeDef)
Return whether a nodedef requires an implementation.
MX_GENSHADER_API vector< Vector2 > getUdimCoordinates(const StringVec &udimIdentifiers)
Compute the UDIM coordinates for a set of UDIM identifiers.
MX_GENSHADER_API void getUdimScaleAndOffset(const vector< Vector2 > &udimCoordinates, Vector2 &scaleUV, Vector2 &offsetUV)
Get the UV scale and offset to transform uv coordinates from UDIM uv space to 0..1 space.
MX_GENSHADER_API vector< TypedElementPtr > findRenderableElements(ConstDocumentPtr doc)
Find all renderable elements in the given document, including material nodes if present,...
shared_ptr< Node > NodePtr
A shared pointer to a Node.
Definition: Node.h:24
shared_ptr< const Value > ConstValuePtr
A shared pointer to a const Value.
Definition: Value.h:31
A four-component color value.
Definition: Types.h:364
Base class for shader generators All third-party shader generators should derive from this class.
Definition: ShaderGenerator.h:31
A vector of two floating-point values.
Definition: Types.h:286