HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BlurNode.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_BLURNODE_H
7 #define MATERIALX_BLURNODE_H
8 
10 
12 
13 /// Blur node implementation
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:
21  /// Constructor
22  BlurNode();
23 
24  /// Emit function definitions for sampling functions used by this node.
25  virtual void emitSamplingFunctionDefinition(const ShaderNode& node, GenContext& context, ShaderStage& stage) const = 0;
26 
27  /// Return if given type is an acceptible input
28  bool acceptsInputType(const TypeDesc* type) const override;
29 
30  /// Compute offset strings for sampling
31  void computeSampleOffsetStrings(const string& sampleSizeName, const string& offsetTypeString,
32  unsigned int filterWidth, StringVec& offsetStrings) const override;
33 
34  /// Output sample array
35  virtual void outputSampleArray(const ShaderGenerator& shadergen, ShaderStage& stage, const TypeDesc* inputType,
36  const string& sampleName, const StringVec& sampleStrings) const;
37 
38  static const string _sampleSizeFunctionUV;
39  static const float _filterSize;
40  static const float _filterOffset;
41 
42  /// Box filter option on blur
43  static const string BOX_FILTER;
44  /// Box filter weights variable name
45  static const string BOX_WEIGHTS_VARIABLE;
46 
47  /// Gaussian filter option on blur
48  static const string GAUSSIAN_FILTER;
49  /// Gaussian filter weights variable name
50  static const string GAUSSIAN_WEIGHTS_VARIABLE;
51 
52  /// List of filters
53  static const string FILTER_LIST;
54 
55  /// String constants
56  static const string IN_STRING;
57  static const string FILTER_TYPE_STRING;
58  static const string FILTER_SIZE_STRING;
59 };
60 
62 
63 #endif
static const string GAUSSIAN_WEIGHTS_VARIABLE
Gaussian filter weights variable name.
Definition: BlurNode.h:50
static const float _filterOffset
Definition: BlurNode.h:40
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
vector< string > StringVec
A vector of strings.
Definition: Library.h:57
static const string GAUSSIAN_FILTER
Gaussian filter option on blur.
Definition: BlurNode.h:48
static const string IN_STRING
String constants.
Definition: BlurNode.h:56
#define MX_GENSHADER_API
Definition: Export.h:18
virtual void emitFunctionDefinition(const ShaderNode &node, GenContext &context, ShaderStage &stage) const
Emit function definition for the given node instance.
virtual void computeSampleOffsetStrings(const string &sampleSizeName, const string &offsetTypeString, unsigned int filterWidth, StringVec &offsetStrings) const =0
static const string _sampleSizeFunctionUV
Definition: BlurNode.h:38
static const string FILTER_SIZE_STRING
Definition: BlurNode.h:58
static const string FILTER_TYPE_STRING
Definition: BlurNode.h:57
virtual bool acceptsInputType(const TypeDesc *type) const =0
Derived classes are responsible for returning if a given type is an acceptable input.
static const string BOX_WEIGHTS_VARIABLE
Box filter weights variable name.
Definition: BlurNode.h:45
static const string BOX_FILTER
Box filter option on blur.
Definition: BlurNode.h:43
Blur node implementation.
Definition: BlurNode.h:14
static const float _filterSize
Definition: BlurNode.h:39
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
type
Definition: core.h:1059
virtual void emitFunctionCall(const ShaderNode &node, GenContext &context, ShaderStage &stage) const
Emit the function call or inline source code for given node instance in the given context...
static const string FILTER_LIST
List of filters.
Definition: BlurNode.h:53