MaterialX 1.38.10
Loading...
Searching...
No Matches
ConvolutionNode.h
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
11#include <array>
12
13MATERIALX_NAMESPACE_BEGIN
14
15extern MX_GENSHADER_API const std::array<float, 3> GAUSSIAN_KERNEL_3;
16extern MX_GENSHADER_API const std::array<float, 5> GAUSSIAN_KERNEL_5;
17extern MX_GENSHADER_API const std::array<float, 7> GAUSSIAN_KERNEL_7;
18
21class MX_GENSHADER_API ConvolutionNode : public ShaderNodeImpl
22{
23 public:
24 void createVariables(const ShaderNode& node, GenContext& context, Shader& shader) const override;
25
26 protected:
29
31 virtual bool acceptsInputType(const TypeDesc* type) const = 0;
32
33 // Derived classes are responsible for computing offset strings relative to the center sample
34 // The sample size and offset type are passed in as arguments.
35 virtual void computeSampleOffsetStrings(const string& sampleSizeName, const string& offsetTypeString,
36 unsigned int filterWidth, StringVec& offsetStrings) const = 0;
37
40 virtual const ShaderInput* getSamplingInput(const ShaderNode& node) const;
41
44 void emitInputSamplesUV(const ShaderNode& node,
45 unsigned int sampleCount, unsigned int filterWidth,
46 float filterSize, float filterOffset,
47 const string& sampleSizeFunctionUV,
48 GenContext& context, ShaderStage& stage,
49 StringVec& sampleStrings) const;
50};
51
52MATERIALX_NAMESPACE_END
53
54#endif
vector< string > StringVec
A vector of strings.
Definition: Library.h:57
Base class for shader node implementations.
Utility class for implementations of nodes which perform convolutions.
Definition: ConvolutionNode.h:22
virtual bool acceptsInputType(const TypeDesc *type) const =0
Derived classes are responsible for returning if a given type is an acceptable input.
A context class for shader generation.
Definition: GenContext.h:31
Class containing all data needed during shader generation.
Definition: Shader.h:33
An input on a ShaderNode.
Definition: ShaderNode.h:264
Class representing a node in the shader generation DAG.
Definition: ShaderNode.h:326
Class handling the shader generation implementation for a node.
Definition: ShaderNodeImpl.h:31
virtual void createVariables(const ShaderNode &node, GenContext &context, Shader &shader) const
Create shader variables needed for the implementation of this node (e.g.
Definition: ShaderNodeImpl.cpp:49
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:28