6 #ifndef MATERIALX_HWSHADERGENERATOR_H
7 #define MATERIALX_HWSHADERGENERATOR_H
249 return std::make_shared<HwLightShaders>();
261 _shaders.erase(type);
274 auto it = _shaders.find(
type);
275 return it != _shaders.end() ? it->second.get() :
nullptr;
279 const std::unordered_map<unsigned int, ShaderNodePtr>&
get()
const
285 std::unordered_map<unsigned int, ShaderNodePtr>
_shaders;
306 static void bindLightShader(
const NodeDef& nodeDef,
unsigned int lightTypeId,
GenContext& context);
309 static void unbindLightShader(
unsigned int lightTypeId,
GenContext& context);
312 static void unbindLightShaders(
GenContext& context);
315 virtual string getVertexDataPrefix(
const VariableBlock& vertexData)
const = 0;
MX_GENSHADER_API const string DIR_V
virtual ~HwResourceBindingContext()
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
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
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.
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
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.
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
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
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
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.
MX_GENSHADER_API const string PIXEL_OUTPUTS
MX_GENSHADER_API const string OCCLUSION
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
MX_GENSHADER_API const string T_ALBEDO_TABLE
MX_GENSHADER_API const string VERTEX_DATA_INSTANCE
#define MATERIALX_NAMESPACE_END
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
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