MaterialX 1.39.1
Loading...
Searching...
No Matches
BlurNode.h
1//
2// Copyright Contributors to the MaterialX Project
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#ifndef MATERIALX_BLURNODE_H
7#define MATERIALX_BLURNODE_H
8
9#include <MaterialXGenShader/Nodes/ConvolutionNode.h>
10
11MATERIALX_NAMESPACE_BEGIN
12
14class MX_GENSHADER_API BlurNode : public ConvolutionNode
15{
16 public:
17 void emitFunctionDefinition(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override;
18 void emitFunctionCall(const ShaderNode& node, GenContext& context, ShaderStage& stage) const override;
19
20 protected:
23
25 virtual void emitSamplingFunctionDefinition(const ShaderNode& node, GenContext& context, ShaderStage& stage) const = 0;
26
28 bool acceptsInputType(TypeDesc type) const override;
29
31 void computeSampleOffsetStrings(const string& sampleSizeName, const string& offsetTypeString,
32 unsigned int filterWidth, StringVec& offsetStrings) const override;
33
35 virtual void outputSampleArray(const ShaderGenerator& shadergen, ShaderStage& stage, TypeDesc inputType,
36 const string& sampleName, const StringVec& sampleStrings) const;
37 [[deprecated]] void outputSampleArray(const ShaderGenerator& shadergen, ShaderStage& stage, const TypeDesc* inputType,
38 const string& sampleName, const StringVec& sampleStrings) const
39 {
40 return outputSampleArray(shadergen, stage, *inputType, sampleName, sampleStrings);
41 }
42
43 static const string _sampleSizeFunctionUV;
44 static const float _filterSize;
45 static const float _filterOffset;
46
48 static const string BOX_FILTER;
50 static const string BOX_WEIGHTS_VARIABLE;
51
53 static const string GAUSSIAN_FILTER;
55 static const string GAUSSIAN_WEIGHTS_VARIABLE;
56
58 static const string FILTER_LIST;
59
61 static const string IN_STRING;
62 static const string FILTER_TYPE_STRING;
63 static const string FILTER_SIZE_STRING;
64};
65
66MATERIALX_NAMESPACE_END
67
68#endif
vector< string > StringVec
A vector of strings.
Definition: Library.h:55
Blur node implementation.
Definition: BlurNode.h:15
static const string IN_STRING
String constants.
Definition: BlurNode.h:61
virtual void emitSamplingFunctionDefinition(const ShaderNode &node, GenContext &context, ShaderStage &stage) const =0
Emit function definitions for sampling functions used by this node.
void computeSampleOffsetStrings(const string &sampleSizeName, const string &offsetTypeString, unsigned int filterWidth, StringVec &offsetStrings) const override
Compute offset strings for sampling.
static const string BOX_WEIGHTS_VARIABLE
Box filter weights variable name.
Definition: BlurNode.h:50
BlurNode()
Constructor.
static const string FILTER_LIST
List of filters.
Definition: BlurNode.h:58
static const string BOX_FILTER
Box filter option on blur.
Definition: BlurNode.h:48
void emitFunctionDefinition(const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
Emit function definition for the given node instance.
static const string GAUSSIAN_FILTER
Gaussian filter option on blur.
Definition: BlurNode.h:53
void emitFunctionCall(const ShaderNode &node, GenContext &context, ShaderStage &stage) const override
Emit the function call or inline source code for given node instance in the given context.
virtual void outputSampleArray(const ShaderGenerator &shadergen, ShaderStage &stage, TypeDesc inputType, const string &sampleName, const StringVec &sampleStrings) const
Output sample array.
bool acceptsInputType(TypeDesc type) const override
Return if given type is an acceptible input.
static const string GAUSSIAN_WEIGHTS_VARIABLE
Gaussian filter weights variable name.
Definition: BlurNode.h:55
Utility class for implementations of nodes which perform convolutions.
Definition: ConvolutionNode.h:22
A context class for shader generation.
Definition: GenContext.h:31
Base class for shader generators All third-party shader generators should derive from this class.
Definition: ShaderGenerator.h:31
Class representing a node in the shader generation DAG.
Definition: ShaderNode.h:320
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:35