Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/compositor/operations/COM_MathBaseOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_MathBaseOperation.cpp80
1 files changed, 50 insertions, 30 deletions
diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
index d612361a7fe..2f315855652 100644
--- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp
@@ -25,7 +25,8 @@ extern "C" {
#include "BLI_math.h"
}
-MathBaseOperation::MathBaseOperation(): NodeOperation() {
+MathBaseOperation::MathBaseOperation(): NodeOperation()
+{
this->addInputSocket(COM_DT_VALUE);
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
@@ -33,18 +34,21 @@ MathBaseOperation::MathBaseOperation(): NodeOperation() {
this->inputValue2Operation = NULL;
}
-void MathBaseOperation::initExecution() {
+void MathBaseOperation::initExecution()
+{
this->inputValue1Operation = this->getInputSocketReader(0);
this->inputValue2Operation = this->getInputSocketReader(1);
}
-void MathBaseOperation::deinitExecution() {
+void MathBaseOperation::deinitExecution()
+{
this->inputValue1Operation = NULL;
this->inputValue2Operation = NULL;
}
-void MathAddOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathAddOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -54,7 +58,8 @@ void MathAddOperation::executePixel(float* outputValue, float x, float y, PixelS
outputValue[0] = inputValue1[0] + inputValue2[0];
}
-void MathSubtractOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathSubtractOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -64,7 +69,8 @@ void MathSubtractOperation::executePixel(float* outputValue, float x, float y, P
outputValue[0] = inputValue1[0] - inputValue2[0];
}
-void MathMultiplyOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathMultiplyOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -74,7 +80,8 @@ void MathMultiplyOperation::executePixel(float* outputValue, float x, float y, P
outputValue[0] = inputValue1[0] * inputValue2[0];
}
-void MathDivideOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathDivideOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -82,12 +89,13 @@ void MathDivideOperation::executePixel(float* outputValue, float x, float y, Pix
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
if (inputValue2[0]==0) /* We don't want to divide by zero. */
- outputValue[0]= 0.0;
+ outputValue[0] = 0.0;
else
- outputValue[0]= inputValue1[0] / inputValue2[0];
+ outputValue[0] = inputValue1[0] / inputValue2[0];
}
-void MathSineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -97,7 +105,8 @@ void MathSineOperation::executePixel(float* outputValue, float x, float y, Pixel
outputValue[0] = sin(inputValue1[0]);
}
-void MathCosineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -107,7 +116,8 @@ void MathCosineOperation::executePixel(float* outputValue, float x, float y, Pix
outputValue[0] = cos(inputValue1[0]);
}
-void MathTangentOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -117,7 +127,8 @@ void MathTangentOperation::executePixel(float* outputValue, float x, float y, Pi
outputValue[0] = tan(inputValue1[0]);
}
-void MathArcSineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathArcSineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -125,12 +136,13 @@ void MathArcSineOperation::executePixel(float* outputValue, float x, float y, Pi
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
if (inputValue1[0] <= 1 && inputValue1[0] >= -1 )
- outputValue[0]= asin(inputValue1[0]);
+ outputValue[0] = asin(inputValue1[0]);
else
- outputValue[0]= 0.0;
+ outputValue[0] = 0.0;
}
-void MathArcCosineOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathArcCosineOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -138,12 +150,13 @@ void MathArcCosineOperation::executePixel(float* outputValue, float x, float y,
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
if (inputValue1[0] <= 1 && inputValue1[0] >= -1 )
- outputValue[0]= acos(inputValue1[0]);
+ outputValue[0] = acos(inputValue1[0]);
else
- outputValue[0]= 0.0;
+ outputValue[0] = 0.0;
}
-void MathArcTangentOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathArcTangentOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -153,7 +166,8 @@ void MathArcTangentOperation::executePixel(float* outputValue, float x, float y,
outputValue[0] = atan(inputValue1[0]);
}
-void MathPowerOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathPowerOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -161,13 +175,13 @@ void MathPowerOperation::executePixel(float* outputValue, float x, float y, Pixe
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
if ( inputValue1[0] >= 0 ) {
- outputValue[0]= pow(inputValue1[0], inputValue2[0]);
+ outputValue[0] = pow(inputValue1[0], inputValue2[0]);
}
else {
float y_mod_1 = fmod(inputValue2[0], 1);
/* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
if (y_mod_1 > 0.999 || y_mod_1 < 0.001) {
- outputValue[0]= pow(inputValue1[0], (float)floor(inputValue2[0] + 0.5));
+ outputValue[0] = pow(inputValue1[0], (float)floor(inputValue2[0] + 0.5));
}
else {
outputValue[0] = 0.0;
@@ -175,7 +189,8 @@ void MathPowerOperation::executePixel(float* outputValue, float x, float y, Pixe
}
}
-void MathLogarithmOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathLogarithmOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -183,12 +198,13 @@ void MathLogarithmOperation::executePixel(float* outputValue, float x, float y,
inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers);
if ( inputValue1[0] > 0 && inputValue2[0] > 0 )
- outputValue[0]= log(inputValue1[0]) / log(inputValue2[0]);
+ outputValue[0] = log(inputValue1[0]) / log(inputValue2[0]);
else
- outputValue[0]= 0.0;
+ outputValue[0] = 0.0;
}
-void MathMinimumOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathMinimumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -198,7 +214,8 @@ void MathMinimumOperation::executePixel(float* outputValue, float x, float y, Pi
outputValue[0] = min(inputValue1[0], inputValue2[0]);
}
-void MathMaximumOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathMaximumOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -208,7 +225,8 @@ void MathMaximumOperation::executePixel(float* outputValue, float x, float y, Pi
outputValue[0] = max(inputValue1[0], inputValue2[0]);
}
-void MathRoundOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathRoundOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -218,7 +236,8 @@ void MathRoundOperation::executePixel(float* outputValue, float x, float y, Pixe
outputValue[0] = round(inputValue1[0]);
}
-void MathLessThanOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathLessThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];
@@ -228,7 +247,8 @@ void MathLessThanOperation::executePixel(float* outputValue, float x, float y, P
outputValue[0] = inputValue1[0]<inputValue2[0]?1.0f:0.0f;
}
-void MathGreaterThanOperation::executePixel(float* outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) {
+void MathGreaterThanOperation::executePixel(float *outputValue, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
float inputValue1[4];
float inputValue2[4];