HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HwShaderGenerator.h
Go to the documentation of this file.
1 //
2 // Copyright Contributors to the MaterialX Project
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 
6 #ifndef MATERIALX_HWSHADERGENERATOR_H
7 #define MATERIALX_HWSHADERGENERATOR_H
8 
9 /// @file
10 /// Hardware shader generator base class
11 
13 
16 
18 
19 /*
20 The HW shader generators have a number of predefined variables (inputs and uniforms) with binding rules.
21 When these are used by a shader the application must bind them to the expected data. The following table is
22 a listing of the variables with a description of what data they should be bound to.
23 
24 However, different renderers can have different requirements on naming conventions for these variables.
25 In order to facilitate this the generators will use token substitution for naming the variables. The
26 first colum below shows the token names that should be used in source code before the token substitution
27 is done. The second row shows the real identifier names that will be used by default after substitution.
28 An generator can override these identifier names in order to use a custom naming convention for these.
29 Overriding identifier names is done by changing the entries in the identifiers map given to the function
30 replaceIdentifiers(), which is handling the token substitution on a shader stage.
31 
32 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
33  TOKEN NAME DEFAULT IDENTIFIER NAME TYPE BINDING
34 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
35 
36 Vertex input variables :
37  $inPosition i_position vec3 Vertex position in object space
38  $inNormal i_normal vec3 Vertex normal in object space
39  $inTangent i_tangent vec3 Vertex tangent in object space
40  $inBitangent i_bitangent vec3 Vertex bitangent in object space
41  $inTexcoord_N i_texcoord_N vec2 Vertex texture coordinate for the N:th uv set
42  $inColor_N i_color_N vec4 Vertex color for the N:th color set (RGBA)
43 
44 Uniform variables :
45  $worldMatrix u_worldMatrix mat4 World transformation
46  $worldInverseMatrix u_worldInverseMatrix mat4 World transformation, inverted
47  $worldTransposeMatrix u_worldTransposeMatrix mat4 World transformation, transposed
48  $worldInverseTransposeMatrix u_worldInverseTransposeMatrix mat4 World transformation, inverted and transposed
49  $viewMatrix u_viewMatrix mat4 View transformation
50  $viewInverseMatrix u_viewInverseMatrix mat4 View transformation, inverted
51  $viewTransposeMatrix u_viewTransposeMatrix mat4 View transformation, transposed
52  $viewInverseTransposeMatrix u_viewInverseTransposeMatrix mat4 View transformation, inverted and transposed
53  $projectionMatrix u_projectionMatrix mat4 Projection transformation
54  $projectionInverseMatrix u_projectionInverseMatrix mat4 Projection transformation, inverted
55  $projectionTransposeMatrix u_projectionTransposeMatrix mat4 Projection transformation, transposed
56  $projectionInverseTransposeMatrix u_projectionInverseTransposeMatrix mat4 Projection transformation, inverted and transposed
57  $worldViewMatrix u_worldViewMatrix mat4 World-view transformation
58  $viewProjectionMatrix u_viewProjectionMatrix mat4 View-projection transformation
59  $worldViewProjectionMatrix u_worldViewProjectionMatrix mat4 World-view-projection transformation
60  $viewPosition u_viewPosition vec3 World-space position of the view (camera)
61  $viewDirection u_viewDirection vec3 World-space direction of the view (camera)
62  $frame u_frame float The current frame number as defined by the host application
63  $time u_time float The current time in seconds
64  $geomprop_<name> u_geomprop_<name> <type> A named property of given <type> where <name> is the name of the variable on the geometry
65  $numActiveLightSources u_numActiveLightSources int The number of currently active light sources. Note that in shader this is clamped against
66  the maximum allowed number of lights sources. The maximum number is set by the generation
67  option GenOptions.hwMaxActiveLightSources.
68  $lightData[] u_lightData[] struct Array of struct LightData holding parameters for active light sources.
69  The LightData struct is built dynamically depending on requirements for
70  bound light shaders.
71  $envMatrix u_envMatrix mat4 Rotation matrix for the environment.
72  $envIrradiance u_envIrradiance sampler2D Sampler for the texture used for diffuse environment lighting.
73  $envRadiance u_envRadiance sampler2D Sampler for the texture used for specular environment lighting.
74  $envLightIntensity u_envLightIntensity float Linear multiplier for environment lighting
75  $envRadianceMips u_envRadianceMips int Number of mipmaps used on the specular environment texture.
76  $envRadianceSamples u_envRadianceSamples int Samples to use if Filtered Importance Sampling is used for specular environment lighting.
77 
78 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
79 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
80 */
81 
82 /// HW specific identifiers.
83 namespace HW
84 {
85 /// Token identifiers
86 extern MX_GENSHADER_API const string T_IN_POSITION;
87 extern MX_GENSHADER_API const string T_IN_NORMAL;
88 extern MX_GENSHADER_API const string T_IN_TANGENT;
89 extern MX_GENSHADER_API const string T_IN_BITANGENT;
90 extern MX_GENSHADER_API const string T_IN_TEXCOORD;
91 extern MX_GENSHADER_API const string T_IN_GEOMPROP;
92 extern MX_GENSHADER_API const string T_IN_COLOR;
93 extern MX_GENSHADER_API const string T_POSITION_WORLD;
94 extern MX_GENSHADER_API const string T_NORMAL_WORLD;
95 extern MX_GENSHADER_API const string T_TANGENT_WORLD;
96 extern MX_GENSHADER_API const string T_BITANGENT_WORLD;
97 extern MX_GENSHADER_API const string T_POSITION_OBJECT;
98 extern MX_GENSHADER_API const string T_NORMAL_OBJECT;
99 extern MX_GENSHADER_API const string T_TANGENT_OBJECT;
100 extern MX_GENSHADER_API const string T_BITANGENT_OBJECT;
101 extern MX_GENSHADER_API const string T_TEXCOORD;
102 extern MX_GENSHADER_API const string T_COLOR;
103 extern MX_GENSHADER_API const string T_WORLD_MATRIX;
104 extern MX_GENSHADER_API const string T_WORLD_INVERSE_MATRIX;
105 extern MX_GENSHADER_API const string T_WORLD_TRANSPOSE_MATRIX;
107 extern MX_GENSHADER_API const string T_VIEW_MATRIX;
108 extern MX_GENSHADER_API const string T_VIEW_INVERSE_MATRIX;
109 extern MX_GENSHADER_API const string T_VIEW_TRANSPOSE_MATRIX;
111 extern MX_GENSHADER_API const string T_PROJ_MATRIX;
112 extern MX_GENSHADER_API const string T_PROJ_INVERSE_MATRIX;
113 extern MX_GENSHADER_API const string T_PROJ_TRANSPOSE_MATRIX;
115 extern MX_GENSHADER_API const string T_WORLD_VIEW_MATRIX;
116 extern MX_GENSHADER_API const string T_VIEW_PROJECTION_MATRIX;
118 extern MX_GENSHADER_API const string T_VIEW_POSITION;
119 extern MX_GENSHADER_API const string T_VIEW_DIRECTION;
120 extern MX_GENSHADER_API const string T_FRAME;
121 extern MX_GENSHADER_API const string T_TIME;
122 extern MX_GENSHADER_API const string T_GEOMPROP;
123 extern MX_GENSHADER_API const string T_ALPHA_THRESHOLD;
124 extern MX_GENSHADER_API const string T_NUM_ACTIVE_LIGHT_SOURCES;
125 extern MX_GENSHADER_API const string T_ENV_MATRIX;
126 extern MX_GENSHADER_API const string T_ENV_RADIANCE;
127 extern MX_GENSHADER_API const string T_ENV_RADIANCE_MIPS;
128 extern MX_GENSHADER_API const string T_ENV_RADIANCE_SAMPLES;
129 extern MX_GENSHADER_API const string T_ENV_IRRADIANCE;
130 extern MX_GENSHADER_API const string T_ENV_LIGHT_INTENSITY;
131 extern MX_GENSHADER_API const string T_ENV_PREFILTER_MIP;
132 extern MX_GENSHADER_API const string T_REFRACTION_TWO_SIDED;
133 extern MX_GENSHADER_API const string T_ALBEDO_TABLE;
134 extern MX_GENSHADER_API const string T_ALBEDO_TABLE_SIZE;
135 extern MX_GENSHADER_API const string T_AMB_OCC_MAP;
136 extern MX_GENSHADER_API const string T_AMB_OCC_GAIN;
137 extern MX_GENSHADER_API const string T_SHADOW_MAP;
138 extern MX_GENSHADER_API const string T_SHADOW_MATRIX;
139 extern MX_GENSHADER_API const string T_VERTEX_DATA_INSTANCE;
140 extern MX_GENSHADER_API const string T_LIGHT_DATA_INSTANCE;
141 
142 /// Default names for identifiers.
143 /// Replacing above tokens in final code.
144 extern MX_GENSHADER_API const string IN_POSITION;
145 extern MX_GENSHADER_API const string IN_NORMAL;
146 extern MX_GENSHADER_API const string IN_TANGENT;
147 extern MX_GENSHADER_API const string IN_BITANGENT;
148 extern MX_GENSHADER_API const string IN_TEXCOORD;
149 extern MX_GENSHADER_API const string IN_GEOMPROP;
150 extern MX_GENSHADER_API const string IN_COLOR;
151 extern MX_GENSHADER_API const string POSITION_WORLD;
152 extern MX_GENSHADER_API const string NORMAL_WORLD;
153 extern MX_GENSHADER_API const string TANGENT_WORLD;
154 extern MX_GENSHADER_API const string BITANGENT_WORLD;
155 extern MX_GENSHADER_API const string POSITION_OBJECT;
156 extern MX_GENSHADER_API const string NORMAL_OBJECT;
157 extern MX_GENSHADER_API const string TANGENT_OBJECT;
158 extern MX_GENSHADER_API const string BITANGENT_OBJECT;
159 extern MX_GENSHADER_API const string TEXCOORD;
160 extern MX_GENSHADER_API const string COLOR;
161 extern MX_GENSHADER_API const string WORLD_MATRIX;
162 extern MX_GENSHADER_API const string WORLD_INVERSE_MATRIX;
163 extern MX_GENSHADER_API const string WORLD_TRANSPOSE_MATRIX;
165 extern MX_GENSHADER_API const string VIEW_MATRIX;
166 extern MX_GENSHADER_API const string VIEW_INVERSE_MATRIX;
167 extern MX_GENSHADER_API const string VIEW_TRANSPOSE_MATRIX;
169 extern MX_GENSHADER_API const string PROJ_MATRIX;
170 extern MX_GENSHADER_API const string PROJ_INVERSE_MATRIX;
171 extern MX_GENSHADER_API const string PROJ_TRANSPOSE_MATRIX;
173 extern MX_GENSHADER_API const string WORLD_VIEW_MATRIX;
174 extern MX_GENSHADER_API const string VIEW_PROJECTION_MATRIX;
176 extern MX_GENSHADER_API const string VIEW_POSITION;
177 extern MX_GENSHADER_API const string VIEW_DIRECTION;
178 extern MX_GENSHADER_API const string FRAME;
179 extern MX_GENSHADER_API const string TIME;
180 extern MX_GENSHADER_API const string GEOMPROP;
181 extern MX_GENSHADER_API const string ALPHA_THRESHOLD;
182 extern MX_GENSHADER_API const string NUM_ACTIVE_LIGHT_SOURCES;
183 extern MX_GENSHADER_API const string ENV_MATRIX;
184 extern MX_GENSHADER_API const string ENV_RADIANCE;
185 extern MX_GENSHADER_API const string ENV_RADIANCE_MIPS;
186 extern MX_GENSHADER_API const string ENV_RADIANCE_SAMPLES;
187 extern MX_GENSHADER_API const string ENV_IRRADIANCE;
188 extern MX_GENSHADER_API const string ENV_LIGHT_INTENSITY;
189 extern MX_GENSHADER_API const string ENV_PREFILTER_MIP;
190 extern MX_GENSHADER_API const string REFRACTION_TWO_SIDED;
191 extern MX_GENSHADER_API const string ALBEDO_TABLE;
192 extern MX_GENSHADER_API const string ALBEDO_TABLE_SIZE;
193 extern MX_GENSHADER_API const string AMB_OCC_MAP;
194 extern MX_GENSHADER_API const string AMB_OCC_GAIN;
195 extern MX_GENSHADER_API const string SHADOW_MAP;
196 extern MX_GENSHADER_API const string SHADOW_MATRIX;
197 extern MX_GENSHADER_API const string VERTEX_DATA_INSTANCE;
198 extern MX_GENSHADER_API const string LIGHT_DATA_INSTANCE;
200 
201 /// Variable blocks names.
202 extern MX_GENSHADER_API const string VERTEX_INPUTS; // Geometric inputs for vertex stage.
203 extern MX_GENSHADER_API const string VERTEX_DATA; // Connector block for data transfer from vertex stage to pixel stage.
204 extern MX_GENSHADER_API const string PRIVATE_UNIFORMS; // Uniform inputs set privately by application.
205 extern MX_GENSHADER_API const string PUBLIC_UNIFORMS; // Uniform inputs visible in UI and set by user.
206 extern MX_GENSHADER_API const string LIGHT_DATA; // Uniform inputs for light sources.
207 extern MX_GENSHADER_API const string PIXEL_OUTPUTS; // Outputs from the main/pixel stage.
208 
209 /// Variable names for lighting parameters.
210 extern MX_GENSHADER_API const string DIR_N;
211 extern MX_GENSHADER_API const string DIR_L;
212 extern MX_GENSHADER_API const string DIR_V;
213 extern MX_GENSHADER_API const string WORLD_POSITION;
214 extern MX_GENSHADER_API const string OCCLUSION;
215 
216 /// Attribute names.
217 extern MX_GENSHADER_API const string ATTR_TRANSPARENT;
218 
219 /// User data names.
220 extern MX_GENSHADER_API const string USER_DATA_LIGHT_SHADERS;
221 extern MX_GENSHADER_API const string USER_DATA_BINDING_CONTEXT;
222 } // namespace HW
223 
224 namespace Stage
225 {
226 /// Identifier for vertex stage.
227 extern MX_GENSHADER_API const string VERTEX;
228 } // namespace Stage
229 
230 class HwLightShaders;
231 class HwShaderGenerator;
233 
234 /// Shared pointer to a HwLightShaders
235 using HwLightShadersPtr = shared_ptr<class HwLightShaders>;
236 /// Shared pointer to a HwShaderGenerator
237 using HwShaderGeneratorPtr = shared_ptr<class HwShaderGenerator>;
238 /// Shared pointer to a HwResourceBindingContext
239 using HwResourceBindingContextPtr = shared_ptr<class HwResourceBindingContext>;
240 
241 /// @class HwLightShaders
242 /// Hardware light shader user data
244 {
245  public:
246  /// Create and return a new instance.
248  {
249  return std::make_shared<HwLightShaders>();
250  }
251 
252  /// Bind a light shader to a light type id.
253  void bind(unsigned int type, ShaderNodePtr shader)
254  {
255  _shaders[type] = shader;
256  }
257 
258  /// Unbind a light shader previously bound to a light type id.
259  void unbind(unsigned int type)
260  {
261  _shaders.erase(type);
262  }
263 
264  /// Clear all light shaders previously bound.
265  void clear()
266  {
267  _shaders.clear();
268  }
269 
270  /// Return the light shader bound to the given light type,
271  /// or nullptr if not light shader is bound to this type.
272  const ShaderNode* get(unsigned int type) const
273  {
274  auto it = _shaders.find(type);
275  return it != _shaders.end() ? it->second.get() : nullptr;
276  }
277 
278  /// Return the map of bound light shaders.
279  const std::unordered_map<unsigned int, ShaderNodePtr>& get() const
280  {
281  return _shaders;
282  }
283 
284  protected:
285  std::unordered_map<unsigned int, ShaderNodePtr> _shaders;
286 };
287 
288 /// @class HwShaderGenerator
289 /// Base class for shader generators targeting HW rendering.
291 {
292  public:
293  /// Add the function call for a single node.
294  void emitFunctionCall(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override;
295 
296  /// Emit code for active light count definitions and uniforms
297  virtual void addStageLightingUniforms(GenContext& context, ShaderStage& stage) const;
298 
299  /// Return the closure contexts defined for the given node.
300  void getClosureContexts(const ShaderNode& node, vector<ClosureContext*>& cct) const override;
301 
302  /// Bind a light shader to a light type id, for usage in surface shaders created
303  /// by the generator. The lightTypeId should be a unique identifier for the light
304  /// type (node definition) and the same id should be used when setting light parameters on a
305  /// generated surface shader.
306  static void bindLightShader(const NodeDef& nodeDef, unsigned int lightTypeId, GenContext& context);
307 
308  /// Unbind a light shader previously bound to the given light type id.
309  static void unbindLightShader(unsigned int lightTypeId, GenContext& context);
310 
311  /// Unbind all light shaders previously bound.
312  static void unbindLightShaders(GenContext& context);
313 
314  /// Determine the prefix of vertex data variables.
315  virtual string getVertexDataPrefix(const VariableBlock& vertexData) const = 0;
316 
317  /// Types of closure contexts for HW.
319  {
324  EMISSION
325  };
326 
327  /// String constants for closure context suffixes.
330  static const string CLOSURE_CONTEXT_SUFFIX_INDIRECT;
331 
332  protected:
334 
335  /// Create and initialize a new HW shader for shader generation.
336  virtual ShaderPtr createShader(const string& name, ElementPtr element, GenContext& context) const;
337 
338  /// Closure contexts for defining closure functions.
344 };
345 
346 /// @class HwShaderGenerator
347 /// Base class for HW node implementations.
349 {
350  public:
351  bool isEditable(const ShaderInput& input) const override;
352 
353  protected:
355 
356  // Integer identifiers for coordinate spaces.
357  // The order must match the order given for the space enum string in stdlib.
358  enum Space
359  {
360  MODEL_SPACE = 0,
361  OBJECT_SPACE = 1,
362  WORLD_SPACE = 2
363  };
364 
365  /// Internal string constants
366  static const string SPACE;
367  static const string INDEX;
368  static const string GEOMPROP;
369 };
370 
371 /// @class HwResourceBindingContext
372 /// Class representing a context for resource binding for hardware resources.
374 {
375  public:
377 
378  // Initialize the context before generation starts.
379  virtual void initialize() = 0;
380 
381  // Emit directives required for binding support
382  virtual void emitDirectives(GenContext& context, ShaderStage& stage) = 0;
383 
384  // Emit uniforms with binding information
385  virtual void emitResourceBindings(GenContext& context, const VariableBlock& uniforms, ShaderStage& stage) = 0;
386 
387  // Emit struct uniforms with binding information
388  virtual void emitStructuredResourceBindings(GenContext& context, const VariableBlock& uniforms,
389  ShaderStage& stage, const std::string& structInstanceName,
390  const std::string& arraySuffix = EMPTY_STRING) = 0;
391 };
392 
394 
395 #endif
MX_GENSHADER_API const string DIR_V
MX_GENSHADER_API const string USER_DATA_LIGHT_SHADERS
User data names.
MX_GENSHADER_API const string T_NORMAL_WORLD
ClosureContextType
Types of closure contexts for HW.
MX_GENSHADER_API const string VIEW_INVERSE_TRANSPOSE_MATRIX
MX_GENSHADER_API const string T_TIME
void clear()
Clear all light shaders previously bound.
MX_GENSHADER_API const string LIGHT_DATA_INSTANCE
MX_GENSHADER_API const string T_REFRACTION_TWO_SIDED
MX_GENSHADER_API const string T_WORLD_TRANSPOSE_MATRIX
MX_GENSHADER_API const string ALBEDO_TABLE
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
MX_GENSHADER_API const string T_VIEW_MATRIX
MX_GENSHADER_API const string GEOMPROP
MX_GENSHADER_API const string VIEW_INVERSE_MATRIX
MX_GENSHADER_API const string PROJ_INVERSE_MATRIX
static const string SPACE
Internal string constants.
MX_GENSHADER_API const string PROJ_INVERSE_TRANSPOSE_MATRIX
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
MX_GENSHADER_API const string T_WORLD_MATRIX
MX_GENSHADER_API const string T_ENV_RADIANCE
MX_GENSHADER_API const string PUBLIC_UNIFORMS
MX_GENSHADER_API const string ENV_RADIANCE_SAMPLES
MX_GENSHADER_API const string VERTEX_INPUTS
Variable blocks names.
static const string INDEX
MX_GENSHADER_API const string T_ALBEDO_TABLE_SIZE
MATERIALX_NAMESPACE_BEGIN MX_CORE_API const string EMPTY_STRING
shared_ptr< Syntax > SyntaxPtr
Shared pointer to a Syntax.
Definition: Syntax.h:26
MX_GENSHADER_API const string IN_BITANGENT
MX_GENSHADER_API const string T_ENV_IRRADIANCE
MX_GENSHADER_API const string ATTR_TRANSPARENT
Attribute names.
MX_GENSHADER_API const string T_ENV_PREFILTER_MIP
MX_GENSHADER_API const string TEXCOORD
MX_GENSHADER_API const string FRAME
#define MX_GENSHADER_API
Definition: Export.h:18
virtual bool isEditable(const ShaderInput &) const
MX_GENSHADER_API const string BITANGENT_WORLD
shared_ptr< class HwShaderGenerator > HwShaderGeneratorPtr
Shared pointer to a HwShaderGenerator.
MX_GENSHADER_API const string ENV_RADIANCE_MIPS
MX_GENSHADER_API const string T_ENV_RADIANCE_MIPS
MX_GENSHADER_API const string LIGHT_DATA_MAX_LIGHT_SOURCES
MX_GENSHADER_API const string WORLD_TRANSPOSE_MATRIX
MX_GENSHADER_API const string T_NUM_ACTIVE_LIGHT_SOURCES
MX_GENSHADER_API const string DIR_L
MX_GENSHADER_API const string NORMAL_WORLD
MX_GENSHADER_API const string ENV_LIGHT_INTENSITY
MX_GENSHADER_API const string T_WORLD_INVERSE_TRANSPOSE_MATRIX
MX_GENSHADER_API const string T_AMB_OCC_MAP
static const string CLOSURE_CONTEXT_SUFFIX_INDIRECT
MX_GENSHADER_API const string WORLD_POSITION
MX_GENSHADER_API const string IN_TEXCOORD
MX_GENSHADER_API const string T_SHADOW_MAP
MX_GENSHADER_API const string T_BITANGENT_WORLD
static const string CLOSURE_CONTEXT_SUFFIX_TRANSMISSION
MX_GENSHADER_API const string PROJ_TRANSPOSE_MATRIX
shared_ptr< class HwResourceBindingContext > HwResourceBindingContextPtr
Shared pointer to a HwResourceBindingContext.
static const string GEOMPROP
MX_GENSHADER_API const string T_VIEW_TRANSPOSE_MATRIX
MX_GENSHADER_API const string VIEW_POSITION
MX_GENSHADER_API const string T_AMB_OCC_GAIN
ClosureContext _defEmission
void unbind(unsigned int type)
Unbind a light shader previously bound to a light type id.
MX_GENSHADER_API const string T_VIEW_INVERSE_MATRIX
MX_GENSHADER_API const string DIR_N
Variable names for lighting parameters.
shared_ptr< class ShaderNode > ShaderNodePtr
Shared pointer to a ShaderNode.
Definition: ShaderNode.h:35
MX_GENSHADER_API const string WORLD_MATRIX
MX_GENSHADER_API const string SHADOW_MAP
MX_GENSHADER_API const string T_IN_COLOR
MX_GENSHADER_API const string VIEW_PROJECTION_MATRIX
MX_GENSHADER_API const string IN_POSITION
MX_GENSHADER_API const string TIME
MX_GENSHADER_API const string VERTEX
Identifier for vertex stage.
virtual void getClosureContexts(const ShaderNode &node, vector< ClosureContext * > &cct) const
Return the closure contexts defined for the given node.
MX_GENSHADER_API const string VIEW_TRANSPOSE_MATRIX
MX_GENSHADER_API const string AMB_OCC_GAIN
MX_GENSHADER_API const string T_POSITION_OBJECT
static const string CLOSURE_CONTEXT_SUFFIX_REFLECTION
String constants for closure context suffixes.
MX_GENSHADER_API const string T_SHADOW_MATRIX
MX_GENSHADER_API const string T_WORLD_INVERSE_MATRIX
MX_GENSHADER_API const string VIEW_DIRECTION
MX_GENSHADER_API const string IN_GEOMPROP
MX_GENSHADER_API const string T_VIEW_PROJECTION_MATRIX
MX_GENSHADER_API const string POSITION_WORLD
MX_GENSHADER_API const string ENV_PREFILTER_MIP
std::unordered_map< unsigned int, ShaderNodePtr > _shaders
GLuint const GLchar * name
Definition: glcorearb.h:786
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
Definition: logging.h:294
MX_GENSHADER_API const string IN_TANGENT
MX_GENSHADER_API const string T_TANGENT_OBJECT
MX_GENSHADER_API const string WORLD_INVERSE_MATRIX
MX_GENSHADER_API const string PRIVATE_UNIFORMS
MX_GENSHADER_API const string T_PROJ_TRANSPOSE_MATRIX
ClosureContext _defIndirect
MX_GENSHADER_API const string ENV_MATRIX
MX_GENSHADER_API const string T_POSITION_WORLD
MX_GENSHADER_API const string T_VIEW_POSITION
MX_GENSHADER_API const string T_TEXCOORD
MX_GENSHADER_API const string T_TANGENT_WORLD
ClosureContext _defTransmission
MX_GENSHADER_API const string VERTEX_DATA
MX_GENSHADER_API const string TANGENT_OBJECT
MX_GENSHADER_API const string WORLD_VIEW_MATRIX
MX_GENSHADER_API const string ALBEDO_TABLE_SIZE
MX_GENSHADER_API const string T_ALPHA_THRESHOLD
MX_GENSHADER_API const string IN_NORMAL
MX_GENSHADER_API const string T_IN_TANGENT
GLuint shader
Definition: glcorearb.h:785
MX_GENSHADER_API const string T_WORLD_VIEW_PROJECTION_MATRIX
void bind(unsigned int type, ShaderNodePtr shader)
Bind a light shader to a light type id.
MX_GENSHADER_API const string T_ENV_MATRIX
MX_GENSHADER_API const string TANGENT_WORLD
MX_GENSHADER_API const string T_WORLD_VIEW_MATRIX
MX_GENSHADER_API const string AMB_OCC_MAP
MX_GENSHADER_API const string T_IN_TEXCOORD
MX_GENSHADER_API const string T_ENV_RADIANCE_SAMPLES
MX_GENSHADER_API const string SHADOW_MATRIX
MX_GENSHADER_API const string T_PROJ_INVERSE_MATRIX
MX_GENSHADER_API const string IN_COLOR
virtual void emitFunctionCall(const ShaderNode &node, GenContext &context, ShaderStage &stage) const
Add the function call for a single node.
MX_GENSHADER_API const string T_IN_POSITION
Token identifiers.
MX_GENSHADER_API const string T_PROJ_INVERSE_TRANSPOSE_MATRIX
MX_GENSHADER_API const string T_COLOR
MX_GENSHADER_API const string T_GEOMPROP
MX_GENSHADER_API const string USER_DATA_BINDING_CONTEXT
MX_GENSHADER_API const string ENV_IRRADIANCE
MX_GENSHADER_API const string REFRACTION_TWO_SIDED
MX_GENSHADER_API const string T_BITANGENT_OBJECT
MX_GENSHADER_API const string ENV_RADIANCE
MX_GENSHADER_API const string T_IN_GEOMPROP
MX_GENSHADER_API const string NUM_ACTIVE_LIGHT_SOURCES
MX_GENSHADER_API const string T_IN_BITANGENT
ClosureContext _defDefault
Closure contexts for defining closure functions.
MX_RENDER_API ShaderPtr createShader(const string &shaderName, GenContext &context, ElementPtr elem)
Create a shader for a given element.
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition: Library.h:34
MX_GENSHADER_API const string PIXEL_OUTPUTS
MX_GENSHADER_API const string OCCLUSION
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
Definition: Element.h:31
MX_GENSHADER_API const string T_ALBEDO_TABLE
MX_GENSHADER_API const string VERTEX_DATA_INSTANCE
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
MX_GENSHADER_API const string PROJ_MATRIX
MX_GENSHADER_API const string T_VIEW_DIRECTION
MX_GENSHADER_API const string T_VERTEX_DATA_INSTANCE
MX_GENSHADER_API const string T_ENV_LIGHT_INTENSITY
MX_GENSHADER_API const string T_PROJ_MATRIX
shared_ptr< class HwLightShaders > HwLightShadersPtr
Shared pointer to a HwLightShaders.
MX_GENSHADER_API const string LIGHT_DATA
MX_GENSHADER_API const string NORMAL_OBJECT
MX_GENSHADER_API const string VIEW_MATRIX
MX_GENSHADER_API const string ALPHA_THRESHOLD
MX_GENSHADER_API const string WORLD_VIEW_PROJECTION_MATRIX
type
Definition: core.h:1059
MX_GENSHADER_API const string WORLD_INVERSE_TRANSPOSE_MATRIX
ClosureContext _defReflection
static HwLightShadersPtr create()
Create and return a new instance.
MX_GENSHADER_API const string T_VIEW_INVERSE_TRANSPOSE_MATRIX
MX_GENSHADER_API const string COLOR
MX_GENSHADER_API const string T_FRAME
MX_GENSHADER_API const string T_LIGHT_DATA_INSTANCE
MX_GENSHADER_API const string POSITION_OBJECT
MX_GENSHADER_API const string T_NORMAL_OBJECT
MX_GENSHADER_API const string BITANGENT_OBJECT
MX_GENSHADER_API const string T_IN_NORMAL