~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/compositor/nodes/COM_MathNode.cpp

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2011, 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: 
 
19
 *              Jeroen Bakker 
 
20
 *              Monique Dewanchand
 
21
 */
 
22
 
 
23
#include "COM_MathNode.h"
 
24
#include "COM_MathBaseOperation.h"
 
25
#include "COM_ExecutionSystem.h"
 
26
 
 
27
void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
 
28
{
 
29
        MathBaseOperation *operation = NULL;
 
30
        
 
31
        switch (this->getbNode()->custom1) {
 
32
                case 0: /* Add */
 
33
                        operation = new MathAddOperation();
 
34
                        break;
 
35
                case 1: /* Subtract */
 
36
                        operation = new MathSubtractOperation();
 
37
                        break;
 
38
                case 2: /* Multiply */
 
39
                        operation = new MathMultiplyOperation();
 
40
                        break;
 
41
                case 3: /* Divide */
 
42
                        operation = new MathDivideOperation();
 
43
                        break;
 
44
                case 4: /* Sine */
 
45
                        operation = new MathSineOperation();
 
46
                        break;
 
47
                case 5: /* Cosine */
 
48
                        operation = new MathCosineOperation();
 
49
                        break;
 
50
                case 6: /* Tangent */
 
51
                        operation = new MathTangentOperation();
 
52
                        break;
 
53
                case 7: /* Arc-Sine */
 
54
                        operation = new MathArcSineOperation();
 
55
                        break;
 
56
                case 8: /* Arc-Cosine */
 
57
                        operation = new MathArcCosineOperation();
 
58
                        break;
 
59
                case 9: /* Arc-Tangent */
 
60
                        operation = new MathArcTangentOperation();
 
61
                        break;
 
62
                case 10: /* Power */
 
63
                        operation = new MathPowerOperation();
 
64
                        break;
 
65
                case 11: /* Logarithm */
 
66
                        operation = new MathLogarithmOperation();
 
67
                        break;
 
68
                case 12: /* Minimum */
 
69
                        operation = new MathMinimumOperation();
 
70
                        break;
 
71
                case 13: /* Maximum */
 
72
                        operation = new MathMaximumOperation();
 
73
                        break;
 
74
                case 14: /* Round */
 
75
                        operation = new MathRoundOperation();
 
76
                        break;
 
77
                case 15: /* Less Than */
 
78
                        operation = new MathLessThanOperation();
 
79
                        break;
 
80
                case 16: /* Greater Than */
 
81
                        operation = new MathGreaterThanOperation();
 
82
                        break;
 
83
        }
 
84
        
 
85
        if (operation != NULL) {
 
86
                bool useClamp = this->getbNode()->custom2;
 
87
 
 
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());
 
91
 
 
92
                operation->setUseClamp(useClamp);
 
93
 
 
94
                graph->addOperation(operation);
 
95
        }
 
96
}