MaterialX 1.38.2
Util.h
Go to the documentation of this file.
1//
2// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
3// All rights reserved. See LICENSE.txt for license.
4//
5
6#ifndef MATERIALX_RENDER_UTIL_H
7#define MATERIALX_RENDER_UTIL_H
8
11
13
17
18#include <map>
19
20namespace MaterialX
21{
22
25
27MX_RENDER_API ShaderPtr createShader(const string& shaderName, GenContext& context, ElementPtr elem);
28
31MX_RENDER_API ShaderPtr createConstantShader(GenContext& context,
32 DocumentPtr stdLib,
33 const string& shaderName,
34 const Color3& color);
35
38MX_RENDER_API ShaderPtr createDepthShader(GenContext& context,
39 DocumentPtr stdLib,
40 const string& shaderName);
41
44MX_RENDER_API ShaderPtr createAlbedoTableShader(GenContext& context,
45 DocumentPtr stdLib,
46 const string& shaderName);
47
49MX_RENDER_API ShaderPtr createBlurShader(GenContext& context,
50 DocumentPtr stdLib,
51 const string& shaderName,
52 const string& filterType,
53 float filterSize);
54
58
60struct MX_RENDER_API UIProperties
61{
63 string uiName;
64
66 string uiFolder;
67
70
72 vector<ValuePtr> enumerationValues;
73
76
79
82
85
88
90 bool uiAdvanced = false;
91};
92
95MX_RENDER_API unsigned int getUIProperties(InputPtr input, const string& target, UIProperties& uiProperties);
96
98struct MX_RENDER_API UIPropertyItem
99{
100 string label;
101 ShaderPort* variable = nullptr;
102 UIProperties ui;
103};
104
106using UIPropertyGroup = std::multimap<string, UIPropertyItem>;
107
110MX_RENDER_API void createUIPropertyGroups(DocumentPtr doc, const VariableBlock& block, UIPropertyGroup& groups,
111 UIPropertyGroup& unnamedGroups, const string& pathSeparator, bool showAllInputs);
112
114
115} // namespace MaterialX
116
117#endif
shared_ptr< Document > DocumentPtr
A shared pointer to a Document.
Definition: Document.h:23
Context classes for shader generation.
shared_ptr< Input > InputPtr
A shared pointer to an Input.
Definition: Interface.h:32
vector< string > StringVec
A vector of strings.
Definition: Library.h:56
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition: Library.h:34
Shader generation utility methods.
Macros for declaring imported and exported symbols.
std::multimap< string, UIPropertyItem > UIPropertyGroup
A grouping of property items by name.
Definition: Util.h:106
Base shader generator class.
shared_ptr< Value > ValuePtr
A shared pointer to a Value.
Definition: Value.h:30
An input or output port on a ShaderNode.
Definition: ShaderNode.h:125
A block of variables in a shader stage.
Definition: ShaderStage.h:53
Set of possible UI properties for an element.
Definition: Util.h:61
ValuePtr uiStep
UI step value.
Definition: Util.h:87
ValuePtr uiMin
UI minimum value.
Definition: Util.h:75
ValuePtr uiSoftMin
UI soft minimum value.
Definition: Util.h:81
string uiName
UI name.
Definition: Util.h:63
StringVec enumeration
Enumeration.
Definition: Util.h:69
vector< ValuePtr > enumerationValues
Enumeration Values.
Definition: Util.h:72
ValuePtr uiSoftMax
UI soft maximum value.
Definition: Util.h:84
string uiFolder
UI folder.
Definition: Util.h:66
ValuePtr uiMax
UI maximum value.
Definition: Util.h:78
Interface for holding the UI properties associated shader port.
Definition: Util.h:99