2
* Copyright 2011, Blender Foundation.
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.
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.
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.
23
#include "COM_MathNode.h"
24
#include "COM_MathBaseOperation.h"
25
#include "COM_ExecutionSystem.h"
27
void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
29
MathBaseOperation *operation = NULL;
31
switch (this->getbNode()->custom1) {
33
operation = new MathAddOperation();
35
case 1: /* Subtract */
36
operation = new MathSubtractOperation();
38
case 2: /* Multiply */
39
operation = new MathMultiplyOperation();
42
operation = new MathDivideOperation();
45
operation = new MathSineOperation();
48
operation = new MathCosineOperation();
51
operation = new MathTangentOperation();
53
case 7: /* Arc-Sine */
54
operation = new MathArcSineOperation();
56
case 8: /* Arc-Cosine */
57
operation = new MathArcCosineOperation();
59
case 9: /* Arc-Tangent */
60
operation = new MathArcTangentOperation();
63
operation = new MathPowerOperation();
65
case 11: /* Logarithm */
66
operation = new MathLogarithmOperation();
68
case 12: /* Minimum */
69
operation = new MathMinimumOperation();
71
case 13: /* Maximum */
72
operation = new MathMaximumOperation();
75
operation = new MathRoundOperation();
77
case 15: /* Less Than */
78
operation = new MathLessThanOperation();
80
case 16: /* Greater Than */
81
operation = new MathGreaterThanOperation();
85
if (operation != NULL) {
86
bool useClamp = this->getbNode()->custom2;
88
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
89
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
90
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
92
operation->setUseClamp(useClamp);
94
graph->addOperation(operation);