Blender  V2.93
COM_AntiAliasingNode.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2017, Blender Foundation.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * Contributor: IRIE Shinsuke
19  */
20 
21 #include "COM_AntiAliasingNode.h"
22 #include "COM_SMAAOperation.h"
23 #include "DNA_node_types.h"
24 
25 namespace blender::compositor {
26 
28  const CompositorContext & /*context*/) const
29 {
30  bNode *node = this->getbNode();
32 
33  /* Edge Detection (First Pass) */
34  SMAAEdgeDetectionOperation *operation1 = nullptr;
35 
36  operation1 = new SMAAEdgeDetectionOperation();
37  operation1->setThreshold(data->threshold);
38  operation1->setLocalContrastAdaptationFactor(data->contrast_limit);
39  converter.addOperation(operation1);
40 
41  converter.mapInputSocket(getInputSocket(0), operation1->getInputSocket(0));
42 
43  /* Blending Weight Calculation Pixel Shader (Second Pass) */
46  operation2->setCornerRounding(data->corner_rounding);
47  converter.addOperation(operation2);
48 
49  converter.addLink(operation1->getOutputSocket(), operation2->getInputSocket(0));
50 
51  /* Neighborhood Blending Pixel Shader (Third Pass) */
53  converter.addOperation(operation3);
54 
55  converter.mapInputSocket(getInputSocket(0), operation3->getInputSocket(0));
56  converter.addLink(operation2->getOutputSocket(), operation3->getInputSocket(1));
57  converter.mapOutputSocket(getOutputSocket(0), operation3->getOutputSocket());
58 }
59 
60 } // namespace blender::compositor
void convertToOperations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
Overall context of the compositor.
void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket)
void addOperation(NodeOperation *operation)
void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
void addLink(NodeOperationOutput *from, NodeOperationInput *to)
NodeOperationInput * getInputSocket(unsigned int index)
NodeOperationOutput * getOutputSocket(unsigned int index=0)
NodeOutput * getOutputSocket(const unsigned int index=0) const
Definition: COM_Node.cc:108
bNode * getbNode() const
get the reference to the SDNA bNode struct
Definition: COM_Node.h:82
NodeInput * getInputSocket(const unsigned int index) const
Definition: COM_Node.cc:113
OperationNode * node