Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/nodes/COM_IDMaskNode.cc
| Show All 11 Lines | |||||
| * You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
| * along with this program; if not, write to the Free Software Foundation, | * along with this program; if not, write to the Free Software Foundation, | ||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| * | * | ||||
| * Copyright 2011, Blender Foundation. | * Copyright 2011, Blender Foundation. | ||||
| */ | */ | ||||
| #include "COM_IDMaskNode.h" | #include "COM_IDMaskNode.h" | ||||
| #include "COM_AntiAliasOperation.h" | |||||
| #include "COM_ExecutionSystem.h" | #include "COM_ExecutionSystem.h" | ||||
| #include "COM_IDMaskOperation.h" | #include "COM_IDMaskOperation.h" | ||||
| #include "COM_SMAAOperation.h" | |||||
| namespace blender::compositor { | namespace blender::compositor { | ||||
| IDMaskNode::IDMaskNode(bNode *editorNode) : Node(editorNode) | IDMaskNode::IDMaskNode(bNode *editorNode) : Node(editorNode) | ||||
| { | { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| void IDMaskNode::convertToOperations(NodeConverter &converter, | void IDMaskNode::convertToOperations(NodeConverter &converter, | ||||
| const CompositorContext &context) const | const CompositorContext &context) const | ||||
| { | { | ||||
| bNode *bnode = this->getbNode(); | bNode *bnode = this->getbNode(); | ||||
| IDMaskOperation *operation; | IDMaskOperation *operation; | ||||
| operation = new IDMaskOperation(); | operation = new IDMaskOperation(); | ||||
| operation->setObjectIndex(bnode->custom1); | operation->setObjectIndex(bnode->custom1); | ||||
| converter.addOperation(operation); | converter.addOperation(operation); | ||||
| converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); | converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); | ||||
| if (bnode->custom2 == 0 || context.getRenderData()->scemode & R_FULL_SAMPLE) { | if (bnode->custom2 == 0 || context.getRenderData()->scemode & R_FULL_SAMPLE) { | ||||
| converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); | converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); | ||||
| } | } | ||||
| else { | else { | ||||
| AntiAliasOperation *antiAliasOperation = new AntiAliasOperation(); | SMAAEdgeDetectionOperation *operation1 = nullptr; | ||||
| converter.addOperation(antiAliasOperation); | |||||
| converter.addLink(operation->getOutputSocket(), antiAliasOperation->getInputSocket(0)); | operation1 = new SMAAEdgeDetectionOperation(); | ||||
| converter.mapOutputSocket(getOutputSocket(0), antiAliasOperation->getOutputSocket(0)); | converter.addOperation(operation1); | ||||
| converter.addLink(operation->getOutputSocket(0), operation1->getInputSocket(0)); | |||||
| /* Blending Weight Calculation Pixel Shader (Second Pass). */ | |||||
| SMAABlendingWeightCalculationOperation *operation2 = | |||||
| new SMAABlendingWeightCalculationOperation(); | |||||
| converter.addOperation(operation2); | |||||
| converter.addLink(operation1->getOutputSocket(), operation2->getInputSocket(0)); | |||||
| /* Neighborhood Blending Pixel Shader (Third Pass). */ | |||||
| SMAANeighborhoodBlendingOperation *operation3 = new SMAANeighborhoodBlendingOperation(); | |||||
| converter.addOperation(operation3); | |||||
| converter.addLink(operation->getOutputSocket(0), operation3->getInputSocket(0)); | |||||
| converter.addLink(operation2->getOutputSocket(), operation3->getInputSocket(1)); | |||||
| converter.mapOutputSocket(getOutputSocket(0), operation3->getOutputSocket()); | |||||
| } | } | ||||
| } | } | ||||
| } // namespace blender::compositor | } // namespace blender::compositor | ||||