MaterialX 1.38.2
ConvolutionNode.h
1//
2// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
3// All rights reserved. See LICENSE.txt for license.
4//
5
6#ifndef MATERIALX_CONVOLUTIONNODE_H
7#define MATERIALX_CONVOLUTIONNODE_H
8
10
11#include <array>
12
13namespace MaterialX
14{
15
16extern MX_GENSHADER_API const std::array<float, 3> GAUSSIAN_KERNEL_3;
17extern MX_GENSHADER_API const std::array<float, 5> GAUSSIAN_KERNEL_5;
18extern MX_GENSHADER_API const std::array<float, 7> GAUSSIAN_KERNEL_7;
19
22class MX_GENSHADER_API ConvolutionNode : public ShaderNodeImpl
23{
24 public:
25 void createVariables(const ShaderNode& node, GenContext& context, Shader& shader) const override;
26
27 protected:
30
32 virtual bool acceptsInputType(const TypeDesc* type) const = 0;
33
34 // Derived classes are responsible for computing offset strings relative to the center sample
35 // The sample size and offset type are passed in as arguments.
36 virtual void computeSampleOffsetStrings(const string& sampleSizeName, const string& offsetTypeString,
37 unsigned int filterWidth, StringVec& offsetStrings) const = 0;
38
41 virtual const ShaderInput* getSamplingInput(const ShaderNode& node) const;
42
45 void emitInputSamplesUV(const ShaderNode& node,
46 unsigned int sampleCount, unsigned int filterWidth,
47 float filterSize, float filterOffset,
48 const string& sampleSizeFunctionUV,
49 GenContext& context, ShaderStage& stage,
50 StringVec& sampleStrings) const;
51};
52
53} // namespace MaterialX
54
55#endif
vector< string > StringVec
A vector of strings.
Definition: Library.h:56
Base class for shader node implementations.
Utility class for implementations of nodes which perform convolutions.
Definition: ConvolutionNode.h:23
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:27
Class containing all data needed during shader generation.
Definition: Shader.h:34
An input on a ShaderNode.
Definition: ShaderNode.h:256
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:32
A shader stage, containing the state and resulting source code for the stage.
Definition: ShaderStage.h:124
A type descriptor for MaterialX data types.
Definition: TypeDesc.h:29