HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConvolutionNode.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_CONVOLUTIONNODE_H
7 #define MATERIALX_CONVOLUTIONNODE_H
8 
10 
12 
14 
15 /// Utility class for implementations of nodes which perform convolutions
16 ///
18 {
19  public:
20  void createVariables(const ShaderNode& node, GenContext& context, Shader& shader) const override;
21 
22  protected:
23  /// Constructor
25 
26  /// Derived classes are responsible for returning if a given type is an acceptable input.
27  virtual bool acceptsInputType(TypeDesc type) const = 0;
28  [[deprecated]] bool acceptsInputType(const TypeDesc* type) const { return acceptsInputType(*type); }
29 
30  // Derived classes are responsible for computing offset strings relative to the center sample
31  // The sample size and offset type are passed in as arguments.
32  virtual void computeSampleOffsetStrings(const string& sampleSizeName, const string& offsetTypeString,
33  unsigned int filterWidth, StringVec& offsetStrings) const = 0;
34 
35  /// Get input which is used for sampling. If there is none
36  /// then a null pointer is returned.
37  virtual const ShaderInput* getSamplingInput(const ShaderNode& node) const;
38 
39  /// Generate upstream / input sampling code in uv space and cache the output variable names which
40  /// will hold the sample values after execution.
41  void emitInputSamplesUV(const ShaderNode& node,
42  unsigned int sampleCount, unsigned int filterWidth,
43  float filterSize, float filterOffset,
44  const string& sampleSizeFunctionUV,
45  GenContext& context, ShaderStage& stage,
46  StringVec& sampleStrings) const;
47 };
48 
50 
51 #endif
bool acceptsInputType(const TypeDesc *type) const
#define MATERIALX_NAMESPACE_BEGIN
Definition: Generated.h:25
vector< string > StringVec
A vector of strings.
Definition: Library.h:61
#define MX_GENMDL_API
Definition: Export.h:18
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
int & sampleCount(char *base, int xStride, int yStride, int x, int y)
Definition: ImfMisc.h:62
GLuint shader
Definition: glcorearb.h:785
Definition: Shader.h:32
#define MATERIALX_NAMESPACE_END
Definition: Generated.h:26
virtual void createVariables(const ShaderNode &node, GenContext &context, Shader &shader) const