6#ifndef MATERIALX_GLSLSHADERGENERATOR_H
7#define MATERIALX_GLSLSHADERGENERATOR_H
16MATERIALX_NAMESPACE_BEGIN
18using GlslShaderGeneratorPtr = shared_ptr<class GlslShaderGenerator>;
22class MX_GENGLSL_API GlslShaderGenerator :
public HwShaderGenerator
25 GlslShaderGenerator();
41 bool assignValue =
true)
const override;
58 virtual void emitVertexStage(
const ShaderGraph& graph,
GenContext& context,
ShaderStage& stage)
const;
84 static void toVec4(
TypeDesc type,
string& variable);
85 [[deprecated]]
static void toVec4(
const TypeDesc* type,
string& variable) { toVec4(*type, variable); }
92class MX_GENGLSL_API GlslImplementation :
public HwImplementation
98 GlslImplementation() { }
101MATERIALX_NAMESPACE_END
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
Definition Element.h:31
Hardware shader generator base class.
shared_ptr< class HwResourceBindingContext > HwResourceBindingContextPtr
Shared pointer to a HwResourceBindingContext.
Definition HwShaderGenerator.h:239
Macros for declaring imported and exported symbols.
shared_ptr< Shader > ShaderPtr
Shared pointer to a Shader.
Definition Library.h:34
shared_ptr< ShaderNodeImpl > ShaderNodeImplPtr
Shared pointer to a ShaderNodeImpl.
Definition Library.h:40
shared_ptr< ShaderGenerator > ShaderGeneratorPtr
Shared pointer to a ShaderGenerator.
Definition Library.h:38
A context class for shader generation.
Definition GenContext.h:31
const string & getTarget() const override
Return an identifier for the target used by this implementation.
const string & getTarget() const override
Return a unique identifier for the target this generator is for.
Definition GlslShaderGenerator.h:34
virtual void emitLightFunctionDefinitions(const ShaderGraph &graph, GenContext &context, ShaderStage &stage) const
Emit function definitions for lighting code.
virtual const string & getVersion() const
Return the version string for the GLSL version this generator is for.
Definition GlslShaderGenerator.h:37
vector< ShaderNodePtr > _lightSamplingNodes
Nodes used internally for light sampling.
Definition GlslShaderGenerator.h:88
static const string TARGET
Unique identifier for this generator target.
Definition GlslShaderGenerator.h:52
ShaderPtr generate(const string &name, ElementPtr element, GenContext &context) const override
Generate a shader starting from the given element, translating the element and all dependencies upstr...
virtual bool requiresLighting(const ShaderGraph &graph) const
Logic to indicate whether code to support direct lighting should be emitted.
void emitVariableDeclaration(const ShaderPort *variable, const string &qualifier, GenContext &context, ShaderStage &stage, bool assignValue=true) const override
Emit a shader variable.
virtual void emitSpecularEnvironment(GenContext &context, ShaderStage &stage) const
Emit specular environment lookup code.
string getVertexDataPrefix(const VariableBlock &vertexData) const override
Determine the prefix of vertex data variables.
virtual void emitTransmissionRender(GenContext &context, ShaderStage &stage) const
Emit transmission rendering code.
static const string VERSION
Version string for the generator target.
Definition GlslShaderGenerator.h:55
ShaderNodeImplPtr getImplementation(const NodeDef &nodedef, GenContext &context) const override
Return a registered shader node implementation given an implementation element.
A node definition element within a Document.
Definition Definition.h:82
An input or output port on a ShaderNode.
Definition ShaderNode.h:123
A shader stage, containing the state and resulting source code for the stage.
Definition ShaderStage.h:139
A type descriptor for MaterialX data types.
Definition TypeDesc.h:36
A block of variables in a shader stage.
Definition ShaderStage.h:61