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

« back to all changes in this revision

Viewing changes to source/blender/compositor/operations/COM_MathBaseOperation.h

  • 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
#ifndef _COM_MathBaseOperation_h
 
24
#define _COM_MathBaseOperation_h
 
25
#include "COM_NodeOperation.h"
 
26
 
 
27
 
 
28
/**
 
29
 * this program converts an input color to an output value.
 
30
 * it assumes we are in sRGB color space.
 
31
 */
 
32
class MathBaseOperation : public NodeOperation {
 
33
protected:
 
34
        /**
 
35
         * Prefetched reference to the inputProgram
 
36
         */
 
37
        SocketReader *m_inputValue1Operation;
 
38
        SocketReader *m_inputValue2Operation;
 
39
 
 
40
        bool m_useClamp;
 
41
 
 
42
protected:
 
43
        /**
 
44
         * Default constructor
 
45
         */
 
46
        MathBaseOperation();
 
47
 
 
48
        void clampIfNeeded(float color[4]);
 
49
public:
 
50
        /**
 
51
         * the inner loop of this program
 
52
         */
 
53
        void executePixel(float output[4], float x, float y, PixelSampler sampler) = 0;
 
54
        
 
55
        /**
 
56
         * Initialize the execution
 
57
         */
 
58
        void initExecution();
 
59
        
 
60
        /**
 
61
         * Deinitialize the execution
 
62
         */
 
63
        void deinitExecution();
 
64
 
 
65
        /**
 
66
         * Determine resolution
 
67
         */
 
68
        void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
 
69
 
 
70
        void setUseClamp(bool value) { this->m_useClamp = value; }
 
71
};
 
72
 
 
73
class MathAddOperation : public MathBaseOperation {
 
74
public:
 
75
        MathAddOperation() : MathBaseOperation() {}
 
76
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
77
};
 
78
class MathSubtractOperation : public MathBaseOperation {
 
79
public:
 
80
        MathSubtractOperation() : MathBaseOperation() {}
 
81
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
82
};
 
83
class MathMultiplyOperation : public MathBaseOperation {
 
84
public:
 
85
        MathMultiplyOperation() : MathBaseOperation() {}
 
86
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
87
};
 
88
class MathDivideOperation : public MathBaseOperation {
 
89
public:
 
90
        MathDivideOperation() : MathBaseOperation() {}
 
91
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
92
};
 
93
class MathSineOperation : public MathBaseOperation {
 
94
public:
 
95
        MathSineOperation() : MathBaseOperation() {}
 
96
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
97
};
 
98
class MathCosineOperation : public MathBaseOperation {
 
99
public:
 
100
        MathCosineOperation() : MathBaseOperation() {}
 
101
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
102
};
 
103
class MathTangentOperation : public MathBaseOperation {
 
104
public:
 
105
        MathTangentOperation() : MathBaseOperation() {}
 
106
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
107
};
 
108
 
 
109
class MathArcSineOperation : public MathBaseOperation {
 
110
public:
 
111
        MathArcSineOperation() : MathBaseOperation() {}
 
112
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
113
};
 
114
class MathArcCosineOperation : public MathBaseOperation {
 
115
public:
 
116
        MathArcCosineOperation() : MathBaseOperation() {}
 
117
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
118
};
 
119
class MathArcTangentOperation : public MathBaseOperation {
 
120
public:
 
121
        MathArcTangentOperation() : MathBaseOperation() {}
 
122
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
123
};
 
124
class MathPowerOperation : public MathBaseOperation {
 
125
public:
 
126
        MathPowerOperation() : MathBaseOperation() {}
 
127
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
128
};
 
129
class MathLogarithmOperation : public MathBaseOperation {
 
130
public:
 
131
        MathLogarithmOperation() : MathBaseOperation() {}
 
132
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
133
};
 
134
class MathMinimumOperation : public MathBaseOperation {
 
135
public:
 
136
        MathMinimumOperation() : MathBaseOperation() {}
 
137
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
138
};
 
139
class MathMaximumOperation : public MathBaseOperation {
 
140
public:
 
141
        MathMaximumOperation() : MathBaseOperation() {}
 
142
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
143
};
 
144
class MathRoundOperation : public MathBaseOperation {
 
145
public:
 
146
        MathRoundOperation() : MathBaseOperation() {}
 
147
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
148
};
 
149
class MathLessThanOperation : public MathBaseOperation {
 
150
public:
 
151
        MathLessThanOperation() : MathBaseOperation() {}
 
152
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
153
};
 
154
class MathGreaterThanOperation : public MathBaseOperation {
 
155
public:
 
156
        MathGreaterThanOperation() : MathBaseOperation() {}
 
157
        void executePixel(float output[4], float x, float y, PixelSampler sampler);
 
158
};
 
159
 
 
160
#endif