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
#ifndef _COM_MathBaseOperation_h
24
#define _COM_MathBaseOperation_h
25
#include "COM_NodeOperation.h"
29
* this program converts an input color to an output value.
30
* it assumes we are in sRGB color space.
32
class MathBaseOperation : public NodeOperation {
35
* Prefetched reference to the inputProgram
37
SocketReader *m_inputValue1Operation;
38
SocketReader *m_inputValue2Operation;
48
void clampIfNeeded(float color[4]);
51
* the inner loop of this program
53
void executePixel(float output[4], float x, float y, PixelSampler sampler) = 0;
56
* Initialize the execution
61
* Deinitialize the execution
63
void deinitExecution();
66
* Determine resolution
68
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
70
void setUseClamp(bool value) { this->m_useClamp = value; }
73
class MathAddOperation : public MathBaseOperation {
75
MathAddOperation() : MathBaseOperation() {}
76
void executePixel(float output[4], float x, float y, PixelSampler sampler);
78
class MathSubtractOperation : public MathBaseOperation {
80
MathSubtractOperation() : MathBaseOperation() {}
81
void executePixel(float output[4], float x, float y, PixelSampler sampler);
83
class MathMultiplyOperation : public MathBaseOperation {
85
MathMultiplyOperation() : MathBaseOperation() {}
86
void executePixel(float output[4], float x, float y, PixelSampler sampler);
88
class MathDivideOperation : public MathBaseOperation {
90
MathDivideOperation() : MathBaseOperation() {}
91
void executePixel(float output[4], float x, float y, PixelSampler sampler);
93
class MathSineOperation : public MathBaseOperation {
95
MathSineOperation() : MathBaseOperation() {}
96
void executePixel(float output[4], float x, float y, PixelSampler sampler);
98
class MathCosineOperation : public MathBaseOperation {
100
MathCosineOperation() : MathBaseOperation() {}
101
void executePixel(float output[4], float x, float y, PixelSampler sampler);
103
class MathTangentOperation : public MathBaseOperation {
105
MathTangentOperation() : MathBaseOperation() {}
106
void executePixel(float output[4], float x, float y, PixelSampler sampler);
109
class MathArcSineOperation : public MathBaseOperation {
111
MathArcSineOperation() : MathBaseOperation() {}
112
void executePixel(float output[4], float x, float y, PixelSampler sampler);
114
class MathArcCosineOperation : public MathBaseOperation {
116
MathArcCosineOperation() : MathBaseOperation() {}
117
void executePixel(float output[4], float x, float y, PixelSampler sampler);
119
class MathArcTangentOperation : public MathBaseOperation {
121
MathArcTangentOperation() : MathBaseOperation() {}
122
void executePixel(float output[4], float x, float y, PixelSampler sampler);
124
class MathPowerOperation : public MathBaseOperation {
126
MathPowerOperation() : MathBaseOperation() {}
127
void executePixel(float output[4], float x, float y, PixelSampler sampler);
129
class MathLogarithmOperation : public MathBaseOperation {
131
MathLogarithmOperation() : MathBaseOperation() {}
132
void executePixel(float output[4], float x, float y, PixelSampler sampler);
134
class MathMinimumOperation : public MathBaseOperation {
136
MathMinimumOperation() : MathBaseOperation() {}
137
void executePixel(float output[4], float x, float y, PixelSampler sampler);
139
class MathMaximumOperation : public MathBaseOperation {
141
MathMaximumOperation() : MathBaseOperation() {}
142
void executePixel(float output[4], float x, float y, PixelSampler sampler);
144
class MathRoundOperation : public MathBaseOperation {
146
MathRoundOperation() : MathBaseOperation() {}
147
void executePixel(float output[4], float x, float y, PixelSampler sampler);
149
class MathLessThanOperation : public MathBaseOperation {
151
MathLessThanOperation() : MathBaseOperation() {}
152
void executePixel(float output[4], float x, float y, PixelSampler sampler);
154
class MathGreaterThanOperation : public MathBaseOperation {
156
MathGreaterThanOperation() : MathBaseOperation() {}
157
void executePixel(float output[4], float x, float y, PixelSampler sampler);