Merge some operations into a single file
This merges all mix operations into a COM_MixBaseOperation (naming could be better, but this way it corresponds to what's going on with math operations. Same was done with RenderLayers operations. Overall this gives 20% of bf_compositor library compilation time decrease. And it was rather annoying to have tens of files with just a single-line constructors anyway. TODO: - All Convert operations could also be merged into a single file, but that would require adding some ConvertBaseOperation to reduce code duplication (ideally). Leaving it unchanged for now. - Some operations' headers seems to be wrongly including MixOperation header, they need to include NodeOperation instead it seems. This is rather harmless, but would be nice to doublecheck on this eventually.
This commit is contained in:
@@ -368,48 +368,8 @@ set(SRC
|
||||
|
||||
operations/COM_ColorSpillOperation.cpp
|
||||
operations/COM_ColorSpillOperation.h
|
||||
operations/COM_RenderLayersBaseProg.cpp
|
||||
operations/COM_RenderLayersBaseProg.h
|
||||
operations/COM_RenderLayersImageProg.cpp
|
||||
operations/COM_RenderLayersImageProg.h
|
||||
operations/COM_RenderLayersAlphaProg.cpp
|
||||
operations/COM_RenderLayersAlphaProg.h
|
||||
operations/COM_RenderLayersDepthProg.cpp
|
||||
operations/COM_RenderLayersDepthProg.h
|
||||
operations/COM_RenderLayersNormalOperation.cpp
|
||||
operations/COM_RenderLayersNormalOperation.h
|
||||
operations/COM_RenderLayersSpeedOperation.cpp
|
||||
operations/COM_RenderLayersSpeedOperation.h
|
||||
operations/COM_RenderLayersColorOperation.cpp
|
||||
operations/COM_RenderLayersColorOperation.h
|
||||
operations/COM_RenderLayersUVOperation.cpp
|
||||
operations/COM_RenderLayersUVOperation.h
|
||||
operations/COM_RenderLayersMistOperation.cpp
|
||||
operations/COM_RenderLayersMistOperation.h
|
||||
operations/COM_RenderLayersObjectIndexOperation.cpp
|
||||
operations/COM_RenderLayersObjectIndexOperation.h
|
||||
operations/COM_RenderLayersMaterialIndexOperation.cpp
|
||||
operations/COM_RenderLayersMaterialIndexOperation.h
|
||||
operations/COM_RenderLayersDiffuseOperation.cpp
|
||||
operations/COM_RenderLayersDiffuseOperation.h
|
||||
operations/COM_RenderLayersSpecularOperation.cpp
|
||||
operations/COM_RenderLayersSpecularOperation.h
|
||||
operations/COM_RenderLayersShadowOperation.cpp
|
||||
operations/COM_RenderLayersShadowOperation.h
|
||||
operations/COM_RenderLayersAOOperation.cpp
|
||||
operations/COM_RenderLayersAOOperation.h
|
||||
operations/COM_RenderLayersEmitOperation.cpp
|
||||
operations/COM_RenderLayersEmitOperation.h
|
||||
operations/COM_RenderLayersReflectionOperation.cpp
|
||||
operations/COM_RenderLayersReflectionOperation.h
|
||||
operations/COM_RenderLayersRefractionOperation.cpp
|
||||
operations/COM_RenderLayersRefractionOperation.h
|
||||
operations/COM_RenderLayersEnvironmentOperation.cpp
|
||||
operations/COM_RenderLayersEnvironmentOperation.h
|
||||
operations/COM_RenderLayersIndirectOperation.cpp
|
||||
operations/COM_RenderLayersIndirectOperation.h
|
||||
operations/COM_RenderLayersCyclesOperation.cpp
|
||||
operations/COM_RenderLayersCyclesOperation.h
|
||||
operations/COM_RenderLayersProg.cpp
|
||||
operations/COM_RenderLayersProg.h
|
||||
|
||||
operations/COM_ImageOperation.cpp
|
||||
operations/COM_ImageOperation.h
|
||||
@@ -500,16 +460,8 @@ set(SRC
|
||||
operations/COM_ReadBufferOperation.h
|
||||
operations/COM_WriteBufferOperation.cpp
|
||||
operations/COM_WriteBufferOperation.h
|
||||
operations/COM_MixBaseOperation.h
|
||||
operations/COM_MixBaseOperation.cpp
|
||||
operations/COM_MixBlendOperation.cpp
|
||||
operations/COM_MixBlendOperation.h
|
||||
operations/COM_MixGlareOperation.cpp
|
||||
operations/COM_MixGlareOperation.h
|
||||
operations/COM_MixAddOperation.h
|
||||
operations/COM_MixAddOperation.cpp
|
||||
operations/COM_MixMultiplyOperation.h
|
||||
operations/COM_MixMultiplyOperation.cpp
|
||||
operations/COM_MixOperation.h
|
||||
operations/COM_MixOperation.cpp
|
||||
operations/COM_BrightnessOperation.cpp
|
||||
operations/COM_BrightnessOperation.h
|
||||
operations/COM_GammaOperation.cpp
|
||||
@@ -523,37 +475,6 @@ set(SRC
|
||||
operations/COM_SetVectorOperation.h
|
||||
operations/COM_SetVectorOperation.cpp
|
||||
|
||||
operations/COM_MixBurnOperation.h
|
||||
operations/COM_MixBurnOperation.cpp
|
||||
operations/COM_MixColorOperation.h
|
||||
operations/COM_MixColorOperation.cpp
|
||||
operations/COM_MixDarkenOperation.h
|
||||
operations/COM_MixDarkenOperation.cpp
|
||||
operations/COM_MixDodgeOperation.h
|
||||
operations/COM_MixDodgeOperation.cpp
|
||||
operations/COM_MixDifferenceOperation.h
|
||||
operations/COM_MixDifferenceOperation.cpp
|
||||
operations/COM_MixDivideOperation.h
|
||||
operations/COM_MixDivideOperation.cpp
|
||||
operations/COM_MixHueOperation.h
|
||||
operations/COM_MixHueOperation.cpp
|
||||
operations/COM_MixLightenOperation.h
|
||||
operations/COM_MixLightenOperation.cpp
|
||||
operations/COM_MixLinearLightOperation.h
|
||||
operations/COM_MixLinearLightOperation.cpp
|
||||
operations/COM_MixOverlayOperation.h
|
||||
operations/COM_MixOverlayOperation.cpp
|
||||
operations/COM_MixSaturationOperation.h
|
||||
operations/COM_MixSaturationOperation.cpp
|
||||
operations/COM_MixScreenOperation.h
|
||||
operations/COM_MixScreenOperation.cpp
|
||||
operations/COM_MixSoftLightOperation.h
|
||||
operations/COM_MixSoftLightOperation.cpp
|
||||
operations/COM_MixValueOperation.h
|
||||
operations/COM_MixValueOperation.cpp
|
||||
operations/COM_MixSubtractOperation.h
|
||||
operations/COM_MixSubtractOperation.cpp
|
||||
|
||||
operations/COM_MathBaseOperation.h
|
||||
operations/COM_MathBaseOperation.cpp
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "COM_AlphaOverNode.h"
|
||||
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
#include "COM_AlphaOverKeyOperation.h"
|
||||
#include "COM_AlphaOverMixedOperation.h"
|
||||
#include "COM_AlphaOverPremultiplyOperation.h"
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include "COM_ColorBalanceASCCDLOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "BKE_node.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
ColorBalanceNode::ColorBalanceNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include "COM_ConvolutionEdgeFilterOperation.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "BKE_node.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
FilterNode::FilterNode(bNode *editorNode) : Node(editorNode)
|
||||
{
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include "COM_GlareSimpleStarOperation.h"
|
||||
#include "COM_GlareStreaksOperation.h"
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_MixGlareOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
#include "COM_FastGaussianBlurOperation.h"
|
||||
#include "COM_GlareGhostOperation.h"
|
||||
#include "COM_GlareFogGlowOperation.h"
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_ConvertRGBToHSVOperation.h"
|
||||
#include "COM_ConvertHSVToRGBOperation.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
#include "COM_SetColorOperation.h"
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_ChangeHSVOperation.h"
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_ConvertRGBToHSVOperation.h"
|
||||
#include "COM_ConvertHSVToRGBOperation.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
#include "COM_SetColorOperation.h"
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_ChangeHSVOperation.h"
|
||||
|
@@ -22,24 +22,7 @@
|
||||
|
||||
#include "COM_MixNode.h"
|
||||
|
||||
#include "COM_MixBlendOperation.h"
|
||||
#include "COM_MixAddOperation.h"
|
||||
#include "COM_MixMultiplyOperation.h"
|
||||
#include "COM_MixBurnOperation.h"
|
||||
#include "COM_MixColorOperation.h"
|
||||
#include "COM_MixDarkenOperation.h"
|
||||
#include "COM_MixDifferenceOperation.h"
|
||||
#include "COM_MixDivideOperation.h"
|
||||
#include "COM_MixHueOperation.h"
|
||||
#include "COM_MixLightenOperation.h"
|
||||
#include "COM_MixLinearLightOperation.h"
|
||||
#include "COM_MixOverlayOperation.h"
|
||||
#include "COM_MixSaturationOperation.h"
|
||||
#include "COM_MixScreenOperation.h"
|
||||
#include "COM_MixSoftLightOperation.h"
|
||||
#include "COM_MixSubtractOperation.h"
|
||||
#include "COM_MixValueOperation.h"
|
||||
#include "COM_MixDodgeOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_SetValueOperation.h"
|
||||
|
@@ -22,26 +22,7 @@
|
||||
|
||||
#include "COM_RenderLayersNode.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
#include "COM_RenderLayersImageProg.h"
|
||||
#include "COM_RenderLayersAlphaProg.h"
|
||||
#include "COM_RenderLayersDepthProg.h"
|
||||
#include "COM_RenderLayersNormalOperation.h"
|
||||
#include "COM_RenderLayersSpeedOperation.h"
|
||||
#include "COM_RenderLayersColorOperation.h"
|
||||
#include "COM_RenderLayersUVOperation.h"
|
||||
#include "COM_RenderLayersMistOperation.h"
|
||||
#include "COM_RenderLayersObjectIndexOperation.h"
|
||||
#include "COM_RenderLayersDiffuseOperation.h"
|
||||
#include "COM_RenderLayersSpecularOperation.h"
|
||||
#include "COM_RenderLayersShadowOperation.h"
|
||||
#include "COM_RenderLayersAOOperation.h"
|
||||
#include "COM_RenderLayersEmitOperation.h"
|
||||
#include "COM_RenderLayersReflectionOperation.h"
|
||||
#include "COM_RenderLayersRefractionOperation.h"
|
||||
#include "COM_RenderLayersEnvironmentOperation.h"
|
||||
#include "COM_RenderLayersIndirectOperation.h"
|
||||
#include "COM_RenderLayersMaterialIndexOperation.h"
|
||||
#include "COM_RenderLayersCyclesOperation.h"
|
||||
#include "COM_RenderLayersProg.h"
|
||||
#include "COM_TranslateOperation.h"
|
||||
#include "COM_RotateOperation.h"
|
||||
#include "COM_ScaleOperation.h"
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "COM_Node.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
#include "COM_RenderLayersProg.h"
|
||||
|
||||
/**
|
||||
* @brief RenderLayersNode
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "COM_SetValueOperation.h"
|
||||
#include "COM_MathBaseOperation.h"
|
||||
#include "COM_AntiAliasOperation.h"
|
||||
#include "COM_MixBlendOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
#include "DNA_material_types.h" // the ramp types
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifndef _COM_AlphaOverKeyOperation_h
|
||||
#define _COM_AlphaOverKeyOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifndef _COM_AlphaOverMixedOperation_h_
|
||||
#define _COM_AlphaOverMixedOperation_h_
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifndef _COM_AlphaOverPremultiplyOperation_h
|
||||
#define _COM_AlphaOverPremultiplyOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifndef _COM_ChangeHSVOperation_h
|
||||
#define _COM_ChangeHSVOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef _COM_ChannelMatteOperation_h
|
||||
#define _COM_ChannelMatteOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef _COM_ChromaMatteOperation_h
|
||||
#define _COM_ChromaMatteOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef _COM_ColorMatteOperation_h
|
||||
#define _COM_ColorMatteOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifndef _COM_DifferenceMatteOperation_h
|
||||
#define _COM_DifferenceMatteOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef _COM_DistanceRGBMatteOperation_h
|
||||
#define _COM_DistanceRGBMatteOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef _COM_DistanceYCCMatteOperation_h
|
||||
#define _COM_DistanceYCCMatteOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
#include "COM_DistanceRGBMatteOperation.h"
|
||||
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef _COM_LuminanceMatteOperation_h
|
||||
#define _COM_LuminanceMatteOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixAddOperation.h"
|
||||
|
||||
MixAddOperation::MixAddOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixAddOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
output[0] = inputColor1[0] + value * inputColor2[0];
|
||||
output[1] = inputColor1[1] + value * inputColor2[1];
|
||||
output[2] = inputColor1[2] + value * inputColor2[2];
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixAddOperation_h
|
||||
#define _COM_MixAddOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixAddOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixAddOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
MixBaseOperation::MixBaseOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputValueOperation = NULL;
|
||||
this->m_inputColor1Operation = NULL;
|
||||
this->m_inputColor2Operation = NULL;
|
||||
this->setUseValueAlphaMultiply(false);
|
||||
this->setUseClamp(false);
|
||||
}
|
||||
|
||||
void MixBaseOperation::initExecution()
|
||||
{
|
||||
this->m_inputValueOperation = this->getInputSocketReader(0);
|
||||
this->m_inputColor1Operation = this->getInputSocketReader(1);
|
||||
this->m_inputColor2Operation = this->getInputSocketReader(2);
|
||||
}
|
||||
|
||||
void MixBaseOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
|
||||
output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
|
||||
output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
}
|
||||
|
||||
void MixBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
|
||||
{
|
||||
InputSocket *socket;
|
||||
unsigned int tempPreferredResolution[2] = {0, 0};
|
||||
unsigned int tempResolution[2];
|
||||
|
||||
socket = this->getInputSocket(1);
|
||||
socket->determineResolution(tempResolution, tempPreferredResolution);
|
||||
if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
}
|
||||
else {
|
||||
socket = this->getInputSocket(2);
|
||||
socket->determineResolution(tempResolution, tempPreferredResolution);
|
||||
if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
|
||||
this->setResolutionInputSocketIndex(2);
|
||||
}
|
||||
else {
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
}
|
||||
}
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
}
|
||||
|
||||
void MixBaseOperation::deinitExecution()
|
||||
{
|
||||
this->m_inputValueOperation = NULL;
|
||||
this->m_inputColor1Operation = NULL;
|
||||
this->m_inputColor2Operation = NULL;
|
||||
}
|
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixBaseOperation_h
|
||||
#define _COM_MixBaseOperation_h
|
||||
#include "COM_NodeOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixBaseOperation : public NodeOperation {
|
||||
protected:
|
||||
/**
|
||||
* Prefetched reference to the inputProgram
|
||||
*/
|
||||
SocketReader *m_inputValueOperation;
|
||||
SocketReader *m_inputColor1Operation;
|
||||
SocketReader *m_inputColor2Operation;
|
||||
bool m_valueAlphaMultiply;
|
||||
bool m_useClamp;
|
||||
|
||||
inline void clampIfNeeded(float color[4])
|
||||
{
|
||||
if (m_useClamp) {
|
||||
CLAMP(color[0], 0.0f, 1.0f);
|
||||
CLAMP(color[1], 0.0f, 1.0f);
|
||||
CLAMP(color[2], 0.0f, 1.0f);
|
||||
CLAMP(color[3], 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixBaseOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
|
||||
|
||||
|
||||
void setUseValueAlphaMultiply(const bool value) { this->m_valueAlphaMultiply = value; }
|
||||
bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; }
|
||||
void setUseClamp(bool value) { this->m_useClamp = value; }
|
||||
};
|
||||
#endif
|
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixBlendOperation.h"
|
||||
|
||||
MixBlendOperation::MixBlendOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixBlendOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
float value;
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
value = inputValue[0];
|
||||
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
|
||||
output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
|
||||
output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixBlendOperation_h
|
||||
#define _COM_MixBlendOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixBlendOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixBlendOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixBurnOperation.h"
|
||||
|
||||
MixBurnOperation::MixBurnOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixBurnOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
float tmp;
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
tmp = valuem + value * inputColor2[0];
|
||||
if (tmp <= 0.0f)
|
||||
output[0] = 0.0f;
|
||||
else {
|
||||
tmp = 1.0f - (1.0f - inputColor1[0]) / tmp;
|
||||
if (tmp < 0.0f)
|
||||
output[0] = 0.0f;
|
||||
else if (tmp > 1.0f)
|
||||
output[0] = 1.0f;
|
||||
else
|
||||
output[0] = tmp;
|
||||
}
|
||||
|
||||
tmp = valuem + value * inputColor2[1];
|
||||
if (tmp <= 0.0f)
|
||||
output[1] = 0.0f;
|
||||
else {
|
||||
tmp = 1.0f - (1.0f - inputColor1[1]) / tmp;
|
||||
if (tmp < 0.0f)
|
||||
output[1] = 0.0f;
|
||||
else if (tmp > 1.0f)
|
||||
output[1] = 1.0f;
|
||||
else
|
||||
output[1] = tmp;
|
||||
}
|
||||
|
||||
tmp = valuem + value * inputColor2[2];
|
||||
if (tmp <= 0.0f)
|
||||
output[2] = 0.0f;
|
||||
else {
|
||||
tmp = 1.0f - (1.0f - inputColor1[2]) / tmp;
|
||||
if (tmp < 0.0f)
|
||||
output[2] = 0.0f;
|
||||
else if (tmp > 1.0f)
|
||||
output[2] = 1.0f;
|
||||
else
|
||||
output[2] = tmp;
|
||||
}
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixBurnOperation_h
|
||||
#define _COM_MixBurnOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixBurnOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixBurnOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixColorOperation.h"
|
||||
|
||||
extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
MixColorOperation::MixColorOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float colH, colS, colV;
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
if (colS != 0.0f) {
|
||||
float rH, rS, rV;
|
||||
float tmpr, tmpg, tmpb;
|
||||
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
|
||||
hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb);
|
||||
output[0] = (valuem * inputColor1[0]) + (value * tmpr);
|
||||
output[1] = (valuem * inputColor1[1]) + (value * tmpg);
|
||||
output[2] = (valuem * inputColor1[2]) + (value * tmpb);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(output, inputColor1);
|
||||
}
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixColorOperation_h
|
||||
#define _COM_MixColorOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixColorOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixColorOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixDarkenOperation.h"
|
||||
|
||||
MixDarkenOperation::MixDarkenOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixDarkenOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
float tmp;
|
||||
tmp = inputColor2[0] + ((1.0f - inputColor2[0]) * valuem);
|
||||
if (tmp < inputColor1[0]) output[0] = tmp;
|
||||
else output[0] = inputColor1[0];
|
||||
tmp = inputColor2[1] + ((1.0f - inputColor2[1]) * valuem);
|
||||
if (tmp < inputColor1[1]) output[1] = tmp;
|
||||
else output[1] = inputColor1[1];
|
||||
tmp = inputColor2[2] + ((1.0f - inputColor2[2]) * valuem);
|
||||
if (tmp < inputColor1[2]) output[2] = tmp;
|
||||
else output[2] = inputColor1[2];
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixDarkenOperation_h
|
||||
#define _COM_MixDarkenOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixDarkenOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixDarkenOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixDifferenceOperation.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
MixDifferenceOperation::MixDifferenceOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixDifferenceOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = valuem * inputColor1[0] + value *fabsf(inputColor1[0] - inputColor2[0]);
|
||||
output[1] = valuem * inputColor1[1] + value *fabsf(inputColor1[1] - inputColor2[1]);
|
||||
output[2] = valuem * inputColor1[2] + value *fabsf(inputColor1[2] - inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixDifferenceOperation_h
|
||||
#define _COM_MixDifferenceOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixDifferenceOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixDifferenceOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixDivideOperation.h"
|
||||
|
||||
MixDivideOperation::MixDivideOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixDivideOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
if (inputColor2[0] != 0.0f)
|
||||
output[0] = valuem * (inputColor1[0]) + value * (inputColor1[0]) / inputColor2[0];
|
||||
else
|
||||
output[0] = 0.0f;
|
||||
if (inputColor2[1] != 0.0f)
|
||||
output[1] = valuem * (inputColor1[1]) + value * (inputColor1[1]) / inputColor2[1];
|
||||
else
|
||||
output[1] = 0.0f;
|
||||
if (inputColor2[2] != 0.0f)
|
||||
output[2] = valuem * (inputColor1[2]) + value * (inputColor1[2]) / inputColor2[2];
|
||||
else
|
||||
output[2] = 0.0f;
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixDivideOperation_h
|
||||
#define _COM_MixDivideOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixDivideOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixDivideOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixDodgeOperation.h"
|
||||
|
||||
MixDodgeOperation::MixDodgeOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixDodgeOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
float tmp;
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
|
||||
if (inputColor1[0] != 0.0f) {
|
||||
tmp = 1.0f - value * inputColor2[0];
|
||||
if (tmp <= 0.0f)
|
||||
output[0] = 1.0f;
|
||||
else {
|
||||
tmp = inputColor1[0] / tmp;
|
||||
if (tmp > 1.0f)
|
||||
output[0] = 1.0f;
|
||||
else
|
||||
output[0] = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
output[0] = 0.0f;
|
||||
|
||||
if (inputColor1[1] != 0.0f) {
|
||||
tmp = 1.0f - value * inputColor2[1];
|
||||
if (tmp <= 0.0f)
|
||||
output[1] = 1.0f;
|
||||
else {
|
||||
tmp = inputColor1[1] / tmp;
|
||||
if (tmp > 1.0f)
|
||||
output[1] = 1.0f;
|
||||
else
|
||||
output[1] = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
output[1] = 0.0f;
|
||||
|
||||
if (inputColor1[2] != 0.0f) {
|
||||
tmp = 1.0f - value * inputColor2[2];
|
||||
if (tmp <= 0.0f)
|
||||
output[2] = 1.0f;
|
||||
else {
|
||||
tmp = inputColor1[2] / tmp;
|
||||
if (tmp > 1.0f)
|
||||
output[2] = 1.0f;
|
||||
else
|
||||
output[2] = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
output[2] = 0.0f;
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixDodgeOperation_h
|
||||
#define _COM_MixDodgeOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixDodgeOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixDodgeOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Glareer Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixGlareOperation.h"
|
||||
|
||||
MixGlareOperation::MixGlareOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixGlareOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
float value;
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
value = inputValue[0];
|
||||
float mf = 2.f - 2.f * fabsf(value - 0.5f);
|
||||
|
||||
if (inputColor1[0] < 0.0f) inputColor1[0] = 0.0f;
|
||||
if (inputColor1[1] < 0.0f) inputColor1[1] = 0.0f;
|
||||
if (inputColor1[2] < 0.0f) inputColor1[2] = 0.0f;
|
||||
|
||||
output[0] = mf * max(inputColor1[0] + value * (inputColor2[0] - inputColor1[0]), 0.0f);
|
||||
output[1] = mf * max(inputColor1[1] + value * (inputColor2[1] - inputColor1[1]), 0.0f);
|
||||
output[2] = mf * max(inputColor1[2] + value * (inputColor2[2] - inputColor1[2]), 0.0f);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Glareer Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixGlareOperation_h
|
||||
#define _COM_MixGlareOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixGlareOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixGlareOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixHueOperation.h"
|
||||
|
||||
extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
MixHueOperation::MixHueOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixHueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float colH, colS, colV;
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
if (colS != 0.0f) {
|
||||
float rH, rS, rV;
|
||||
float tmpr, tmpg, tmpb;
|
||||
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
|
||||
hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb);
|
||||
output[0] = valuem * (inputColor1[0]) + value * tmpr;
|
||||
output[1] = valuem * (inputColor1[1]) + value * tmpg;
|
||||
output[2] = valuem * (inputColor1[2]) + value * tmpb;
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(output, inputColor1);
|
||||
}
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixHueOperation_h
|
||||
#define _COM_MixHueOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixHueOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixHueOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixLightenOperation.h"
|
||||
|
||||
MixLightenOperation::MixLightenOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixLightenOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float tmp;
|
||||
tmp = value * inputColor2[0];
|
||||
if (tmp > inputColor1[0]) output[0] = tmp;
|
||||
else output[0] = inputColor1[0];
|
||||
tmp = value * inputColor2[1];
|
||||
if (tmp > inputColor1[1]) output[1] = tmp;
|
||||
else output[1] = inputColor1[1];
|
||||
tmp = value * inputColor2[2];
|
||||
if (tmp > inputColor1[2]) output[2] = tmp;
|
||||
else output[2] = inputColor1[2];
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixLightenOperation_h
|
||||
#define _COM_MixLightenOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixLightenOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixLightenOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
#endif
|
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixLinearLightOperation.h"
|
||||
|
||||
MixLinearLightOperation::MixLinearLightOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixLinearLightOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
if (inputColor2[0] > 0.5f)
|
||||
output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0] - 0.5f));
|
||||
else
|
||||
output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0]) - 1.0f);
|
||||
if (inputColor2[1] > 0.5f)
|
||||
output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1] - 0.5f));
|
||||
else
|
||||
output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1]) - 1.0f);
|
||||
if (inputColor2[2] > 0.5f)
|
||||
output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2] - 0.5f));
|
||||
else
|
||||
output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f);
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixLinearLightOperation_h
|
||||
#define _COM_MixLinearLightOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixLinearLightOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixLinearLightOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixMultiplyOperation.h"
|
||||
|
||||
MixMultiplyOperation::MixMultiplyOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixMultiplyOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = inputColor1[0] * (valuem + value * inputColor2[0]);
|
||||
output[1] = inputColor1[1] * (valuem + value * inputColor2[1]);
|
||||
output[2] = inputColor1[2] * (valuem + value * inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixMultiplyOperation_h
|
||||
#define _COM_MixMultiplyOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixMultiplyOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixMultiplyOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
848
source/blender/compositor/operations/COM_MixOperation.cpp
Normal file
848
source/blender/compositor/operations/COM_MixOperation.cpp
Normal file
@@ -0,0 +1,848 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixOperation.h"
|
||||
|
||||
extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
/* ******** Mix Base Operation ******** */
|
||||
|
||||
MixBaseOperation::MixBaseOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addInputSocket(COM_DT_COLOR);
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->m_inputValueOperation = NULL;
|
||||
this->m_inputColor1Operation = NULL;
|
||||
this->m_inputColor2Operation = NULL;
|
||||
this->setUseValueAlphaMultiply(false);
|
||||
this->setUseClamp(false);
|
||||
}
|
||||
|
||||
void MixBaseOperation::initExecution()
|
||||
{
|
||||
this->m_inputValueOperation = this->getInputSocketReader(0);
|
||||
this->m_inputColor1Operation = this->getInputSocketReader(1);
|
||||
this->m_inputColor2Operation = this->getInputSocketReader(2);
|
||||
}
|
||||
|
||||
void MixBaseOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
|
||||
output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
|
||||
output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
}
|
||||
|
||||
void MixBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
|
||||
{
|
||||
InputSocket *socket;
|
||||
unsigned int tempPreferredResolution[2] = {0, 0};
|
||||
unsigned int tempResolution[2];
|
||||
|
||||
socket = this->getInputSocket(1);
|
||||
socket->determineResolution(tempResolution, tempPreferredResolution);
|
||||
if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
|
||||
this->setResolutionInputSocketIndex(1);
|
||||
}
|
||||
else {
|
||||
socket = this->getInputSocket(2);
|
||||
socket->determineResolution(tempResolution, tempPreferredResolution);
|
||||
if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) {
|
||||
this->setResolutionInputSocketIndex(2);
|
||||
}
|
||||
else {
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
}
|
||||
}
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
}
|
||||
|
||||
void MixBaseOperation::deinitExecution()
|
||||
{
|
||||
this->m_inputValueOperation = NULL;
|
||||
this->m_inputColor1Operation = NULL;
|
||||
this->m_inputColor2Operation = NULL;
|
||||
}
|
||||
|
||||
/* ******** Mix Add Operation ******** */
|
||||
|
||||
MixAddOperation::MixAddOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixAddOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
output[0] = inputColor1[0] + value * inputColor2[0];
|
||||
output[1] = inputColor1[1] + value * inputColor2[1];
|
||||
output[2] = inputColor1[2] + value * inputColor2[2];
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Blend Operation ******** */
|
||||
|
||||
MixBlendOperation::MixBlendOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixBlendOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
float value;
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
value = inputValue[0];
|
||||
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]);
|
||||
output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]);
|
||||
output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Burn Operation ******** */
|
||||
|
||||
MixBurnOperation::MixBurnOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixBurnOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
float tmp;
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
tmp = valuem + value * inputColor2[0];
|
||||
if (tmp <= 0.0f)
|
||||
output[0] = 0.0f;
|
||||
else {
|
||||
tmp = 1.0f - (1.0f - inputColor1[0]) / tmp;
|
||||
if (tmp < 0.0f)
|
||||
output[0] = 0.0f;
|
||||
else if (tmp > 1.0f)
|
||||
output[0] = 1.0f;
|
||||
else
|
||||
output[0] = tmp;
|
||||
}
|
||||
|
||||
tmp = valuem + value * inputColor2[1];
|
||||
if (tmp <= 0.0f)
|
||||
output[1] = 0.0f;
|
||||
else {
|
||||
tmp = 1.0f - (1.0f - inputColor1[1]) / tmp;
|
||||
if (tmp < 0.0f)
|
||||
output[1] = 0.0f;
|
||||
else if (tmp > 1.0f)
|
||||
output[1] = 1.0f;
|
||||
else
|
||||
output[1] = tmp;
|
||||
}
|
||||
|
||||
tmp = valuem + value * inputColor2[2];
|
||||
if (tmp <= 0.0f)
|
||||
output[2] = 0.0f;
|
||||
else {
|
||||
tmp = 1.0f - (1.0f - inputColor1[2]) / tmp;
|
||||
if (tmp < 0.0f)
|
||||
output[2] = 0.0f;
|
||||
else if (tmp > 1.0f)
|
||||
output[2] = 1.0f;
|
||||
else
|
||||
output[2] = tmp;
|
||||
}
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Color Operation ******** */
|
||||
|
||||
MixColorOperation::MixColorOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixColorOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float colH, colS, colV;
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
if (colS != 0.0f) {
|
||||
float rH, rS, rV;
|
||||
float tmpr, tmpg, tmpb;
|
||||
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
|
||||
hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb);
|
||||
output[0] = (valuem * inputColor1[0]) + (value * tmpr);
|
||||
output[1] = (valuem * inputColor1[1]) + (value * tmpg);
|
||||
output[2] = (valuem * inputColor1[2]) + (value * tmpb);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(output, inputColor1);
|
||||
}
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Darken Operation ******** */
|
||||
|
||||
MixDarkenOperation::MixDarkenOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixDarkenOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
float tmp;
|
||||
tmp = inputColor2[0] + ((1.0f - inputColor2[0]) * valuem);
|
||||
if (tmp < inputColor1[0]) output[0] = tmp;
|
||||
else output[0] = inputColor1[0];
|
||||
tmp = inputColor2[1] + ((1.0f - inputColor2[1]) * valuem);
|
||||
if (tmp < inputColor1[1]) output[1] = tmp;
|
||||
else output[1] = inputColor1[1];
|
||||
tmp = inputColor2[2] + ((1.0f - inputColor2[2]) * valuem);
|
||||
if (tmp < inputColor1[2]) output[2] = tmp;
|
||||
else output[2] = inputColor1[2];
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Difference Operation ******** */
|
||||
|
||||
MixDifferenceOperation::MixDifferenceOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixDifferenceOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = valuem * inputColor1[0] + value *fabsf(inputColor1[0] - inputColor2[0]);
|
||||
output[1] = valuem * inputColor1[1] + value *fabsf(inputColor1[1] - inputColor2[1]);
|
||||
output[2] = valuem * inputColor1[2] + value *fabsf(inputColor1[2] - inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Difference Operation ******** */
|
||||
|
||||
MixDivideOperation::MixDivideOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixDivideOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
if (inputColor2[0] != 0.0f)
|
||||
output[0] = valuem * (inputColor1[0]) + value * (inputColor1[0]) / inputColor2[0];
|
||||
else
|
||||
output[0] = 0.0f;
|
||||
if (inputColor2[1] != 0.0f)
|
||||
output[1] = valuem * (inputColor1[1]) + value * (inputColor1[1]) / inputColor2[1];
|
||||
else
|
||||
output[1] = 0.0f;
|
||||
if (inputColor2[2] != 0.0f)
|
||||
output[2] = valuem * (inputColor1[2]) + value * (inputColor1[2]) / inputColor2[2];
|
||||
else
|
||||
output[2] = 0.0f;
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Dodge Operation ******** */
|
||||
|
||||
MixDodgeOperation::MixDodgeOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixDodgeOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
float tmp;
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
|
||||
if (inputColor1[0] != 0.0f) {
|
||||
tmp = 1.0f - value * inputColor2[0];
|
||||
if (tmp <= 0.0f)
|
||||
output[0] = 1.0f;
|
||||
else {
|
||||
tmp = inputColor1[0] / tmp;
|
||||
if (tmp > 1.0f)
|
||||
output[0] = 1.0f;
|
||||
else
|
||||
output[0] = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
output[0] = 0.0f;
|
||||
|
||||
if (inputColor1[1] != 0.0f) {
|
||||
tmp = 1.0f - value * inputColor2[1];
|
||||
if (tmp <= 0.0f)
|
||||
output[1] = 1.0f;
|
||||
else {
|
||||
tmp = inputColor1[1] / tmp;
|
||||
if (tmp > 1.0f)
|
||||
output[1] = 1.0f;
|
||||
else
|
||||
output[1] = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
output[1] = 0.0f;
|
||||
|
||||
if (inputColor1[2] != 0.0f) {
|
||||
tmp = 1.0f - value * inputColor2[2];
|
||||
if (tmp <= 0.0f)
|
||||
output[2] = 1.0f;
|
||||
else {
|
||||
tmp = inputColor1[2] / tmp;
|
||||
if (tmp > 1.0f)
|
||||
output[2] = 1.0f;
|
||||
else
|
||||
output[2] = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
output[2] = 0.0f;
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Glare Operation ******** */
|
||||
|
||||
MixGlareOperation::MixGlareOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixGlareOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
float value;
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
value = inputValue[0];
|
||||
float mf = 2.f - 2.f * fabsf(value - 0.5f);
|
||||
|
||||
if (inputColor1[0] < 0.0f) inputColor1[0] = 0.0f;
|
||||
if (inputColor1[1] < 0.0f) inputColor1[1] = 0.0f;
|
||||
if (inputColor1[2] < 0.0f) inputColor1[2] = 0.0f;
|
||||
|
||||
output[0] = mf * max(inputColor1[0] + value * (inputColor2[0] - inputColor1[0]), 0.0f);
|
||||
output[1] = mf * max(inputColor1[1] + value * (inputColor2[1] - inputColor1[1]), 0.0f);
|
||||
output[2] = mf * max(inputColor1[2] + value * (inputColor2[2] - inputColor1[2]), 0.0f);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Hue Operation ******** */
|
||||
|
||||
MixHueOperation::MixHueOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixHueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float colH, colS, colV;
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
if (colS != 0.0f) {
|
||||
float rH, rS, rV;
|
||||
float tmpr, tmpg, tmpb;
|
||||
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
|
||||
hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb);
|
||||
output[0] = valuem * (inputColor1[0]) + value * tmpr;
|
||||
output[1] = valuem * (inputColor1[1]) + value * tmpg;
|
||||
output[2] = valuem * (inputColor1[2]) + value * tmpb;
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(output, inputColor1);
|
||||
}
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Lighten Operation ******** */
|
||||
|
||||
MixLightenOperation::MixLightenOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixLightenOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float tmp;
|
||||
tmp = value * inputColor2[0];
|
||||
if (tmp > inputColor1[0]) output[0] = tmp;
|
||||
else output[0] = inputColor1[0];
|
||||
tmp = value * inputColor2[1];
|
||||
if (tmp > inputColor1[1]) output[1] = tmp;
|
||||
else output[1] = inputColor1[1];
|
||||
tmp = value * inputColor2[2];
|
||||
if (tmp > inputColor1[2]) output[2] = tmp;
|
||||
else output[2] = inputColor1[2];
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Linear Light Operation ******** */
|
||||
|
||||
MixLinearLightOperation::MixLinearLightOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixLinearLightOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
if (inputColor2[0] > 0.5f)
|
||||
output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0] - 0.5f));
|
||||
else
|
||||
output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0]) - 1.0f);
|
||||
if (inputColor2[1] > 0.5f)
|
||||
output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1] - 0.5f));
|
||||
else
|
||||
output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1]) - 1.0f);
|
||||
if (inputColor2[2] > 0.5f)
|
||||
output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2] - 0.5f));
|
||||
else
|
||||
output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f);
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Multiply Operation ******** */
|
||||
|
||||
MixMultiplyOperation::MixMultiplyOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixMultiplyOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = inputColor1[0] * (valuem + value * inputColor2[0]);
|
||||
output[1] = inputColor1[1] * (valuem + value * inputColor2[1]);
|
||||
output[2] = inputColor1[2] * (valuem + value * inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Ovelray Operation ******** */
|
||||
|
||||
MixOverlayOperation::MixOverlayOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixOverlayOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
if (inputColor1[0] < 0.5f) {
|
||||
output[0] = inputColor1[0] * (valuem + 2.0f * value * inputColor2[0]);
|
||||
}
|
||||
else {
|
||||
output[0] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
|
||||
}
|
||||
if (inputColor1[1] < 0.5f) {
|
||||
output[1] = inputColor1[1] * (valuem + 2.0f * value * inputColor2[1]);
|
||||
}
|
||||
else {
|
||||
output[1] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
|
||||
}
|
||||
if (inputColor1[2] < 0.5f) {
|
||||
output[2] = inputColor1[2] * (valuem + 2.0f * value * inputColor2[2]);
|
||||
}
|
||||
else {
|
||||
output[2] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
|
||||
}
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Saturation Operation ******** */
|
||||
|
||||
MixSaturationOperation::MixSaturationOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixSaturationOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float rH, rS, rV;
|
||||
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
|
||||
if (rS != 0.0f) {
|
||||
float colH, colS, colV;
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
hsv_to_rgb(rH, (valuem * rS + value * colS), rV, &output[0], &output[1], &output[2]);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(output, inputColor1);
|
||||
}
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Screen Operation ******** */
|
||||
|
||||
MixScreenOperation::MixScreenOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixScreenOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
output[0] = 1.0f - (valuem + value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
|
||||
output[1] = 1.0f - (valuem + value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
|
||||
output[2] = 1.0f - (valuem + value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Soft Light Operation ******** */
|
||||
|
||||
MixSoftLightOperation::MixSoftLightOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixSoftLightOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) \
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
float scr, scg, scb;
|
||||
|
||||
/* first calculate non-fac based Screen mix */
|
||||
scr = 1.0f - (1.0f - inputColor2[0]) * (1.0f - inputColor1[0]);
|
||||
scg = 1.0f - (1.0f - inputColor2[1]) * (1.0f - inputColor1[1]);
|
||||
scb = 1.0f - (1.0f - inputColor2[2]) * (1.0f - inputColor1[2]);
|
||||
|
||||
output[0] = valuem * (inputColor1[0]) + value * (((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) + (inputColor1[0] * scr));
|
||||
output[1] = valuem * (inputColor1[1]) + value * (((1.0f - inputColor1[1]) * inputColor2[1] * (inputColor1[1])) + (inputColor1[1] * scg));
|
||||
output[2] = valuem * (inputColor1[2]) + value * (((1.0f - inputColor1[2]) * inputColor2[2] * (inputColor1[2])) + (inputColor1[2] * scb));
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Subtract Operation ******** */
|
||||
|
||||
MixSubtractOperation::MixSubtractOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixSubtractOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
output[0] = inputColor1[0] - value * (inputColor2[0]);
|
||||
output[1] = inputColor1[1] - value * (inputColor2[1]);
|
||||
output[2] = inputColor1[2] - value * (inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
||||
/* ******** Mix Value Operation ******** */
|
||||
|
||||
MixValueOperation::MixValueOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float rH, rS, rV;
|
||||
float colH, colS, colV;
|
||||
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
hsv_to_rgb(rH, rS, (valuem * rV + value * colV), &output[0], &output[1], &output[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
197
source/blender/compositor/operations/COM_MixOperation.h
Normal file
197
source/blender/compositor/operations/COM_MixOperation.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixBaseOperation_h
|
||||
#define _COM_MixBaseOperation_h
|
||||
#include "COM_NodeOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* All this programs converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
|
||||
class MixBaseOperation : public NodeOperation {
|
||||
protected:
|
||||
/**
|
||||
* Prefetched reference to the inputProgram
|
||||
*/
|
||||
SocketReader *m_inputValueOperation;
|
||||
SocketReader *m_inputColor1Operation;
|
||||
SocketReader *m_inputColor2Operation;
|
||||
bool m_valueAlphaMultiply;
|
||||
bool m_useClamp;
|
||||
|
||||
inline void clampIfNeeded(float color[4])
|
||||
{
|
||||
if (m_useClamp) {
|
||||
CLAMP(color[0], 0.0f, 1.0f);
|
||||
CLAMP(color[1], 0.0f, 1.0f);
|
||||
CLAMP(color[2], 0.0f, 1.0f);
|
||||
CLAMP(color[3], 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixBaseOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
|
||||
|
||||
|
||||
void setUseValueAlphaMultiply(const bool value) { this->m_valueAlphaMultiply = value; }
|
||||
bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; }
|
||||
void setUseClamp(bool value) { this->m_useClamp = value; }
|
||||
};
|
||||
|
||||
class MixAddOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixAddOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixBlendOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixBlendOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixBurnOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixBurnOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixColorOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixColorOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixDarkenOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixDarkenOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixDifferenceOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixDifferenceOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixDivideOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixDivideOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixDodgeOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixDodgeOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixGlareOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixGlareOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixHueOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixHueOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixLightenOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixLightenOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixLinearLightOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixLinearLightOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixMultiplyOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixMultiplyOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixOverlayOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixOverlayOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixSaturationOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixSaturationOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixScreenOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixScreenOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixSoftLightOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixSoftLightOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixSubtractOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixSubtractOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class MixValueOperation : public MixBaseOperation {
|
||||
public:
|
||||
MixValueOperation();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixOverlayOperation.h"
|
||||
|
||||
MixOverlayOperation::MixOverlayOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixOverlayOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
if (inputColor1[0] < 0.5f) {
|
||||
output[0] = inputColor1[0] * (valuem + 2.0f * value * inputColor2[0]);
|
||||
}
|
||||
else {
|
||||
output[0] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
|
||||
}
|
||||
if (inputColor1[1] < 0.5f) {
|
||||
output[1] = inputColor1[1] * (valuem + 2.0f * value * inputColor2[1]);
|
||||
}
|
||||
else {
|
||||
output[1] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
|
||||
}
|
||||
if (inputColor1[2] < 0.5f) {
|
||||
output[2] = inputColor1[2] * (valuem + 2.0f * value * inputColor2[2]);
|
||||
}
|
||||
else {
|
||||
output[2] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
|
||||
}
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixOverlayOperation_h
|
||||
#define _COM_MixOverlayOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixOverlayOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixOverlayOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixSaturationOperation.h"
|
||||
|
||||
extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
MixSaturationOperation::MixSaturationOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixSaturationOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float rH, rS, rV;
|
||||
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
|
||||
if (rS != 0.0f) {
|
||||
float colH, colS, colV;
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
hsv_to_rgb(rH, (valuem * rS + value * colS), rV, &output[0], &output[1], &output[2]);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(output, inputColor1);
|
||||
}
|
||||
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixSaturationOperation_h
|
||||
#define _COM_MixSaturationOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixSaturationOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixSaturationOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixScreenOperation.h"
|
||||
|
||||
MixScreenOperation::MixScreenOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixScreenOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
output[0] = 1.0f - (valuem + value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]);
|
||||
output[1] = 1.0f - (valuem + value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]);
|
||||
output[2] = 1.0f - (valuem + value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixScreenOperation_h
|
||||
#define _COM_MixScreenOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixScreenOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixScreenOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
#endif
|
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixSoftLightOperation.h"
|
||||
|
||||
MixSoftLightOperation::MixSoftLightOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixSoftLightOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) \
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
float scr, scg, scb;
|
||||
|
||||
/* first calculate non-fac based Screen mix */
|
||||
scr = 1.0f - (1.0f - inputColor2[0]) * (1.0f - inputColor1[0]);
|
||||
scg = 1.0f - (1.0f - inputColor2[1]) * (1.0f - inputColor1[1]);
|
||||
scb = 1.0f - (1.0f - inputColor2[2]) * (1.0f - inputColor1[2]);
|
||||
|
||||
output[0] = valuem * (inputColor1[0]) + value * (((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) + (inputColor1[0] * scr));
|
||||
output[1] = valuem * (inputColor1[1]) + value * (((1.0f - inputColor1[1]) * inputColor2[1] * (inputColor1[1])) + (inputColor1[1] * scg));
|
||||
output[2] = valuem * (inputColor1[2]) + value * (((1.0f - inputColor1[2]) * inputColor2[2] * (inputColor1[2])) + (inputColor1[2] * scb));
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixSoftLightOperation_h
|
||||
#define _COM_MixSoftLightOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixSoftLightOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixSoftLightOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixSubtractOperation.h"
|
||||
|
||||
MixSubtractOperation::MixSubtractOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixSubtractOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
output[0] = inputColor1[0] - value * (inputColor2[0]);
|
||||
output[1] = inputColor1[1] - value * (inputColor2[1]);
|
||||
output[2] = inputColor1[2] - value * (inputColor2[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixSubtractOperation_h
|
||||
#define _COM_MixSubtractOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixSubtractOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixSubtractOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
#endif
|
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_MixValueOperation.h"
|
||||
|
||||
extern "C" {
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
MixValueOperation::MixValueOperation() : MixBaseOperation()
|
||||
{
|
||||
/* pass */
|
||||
}
|
||||
|
||||
void MixValueOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
float inputColor1[4];
|
||||
float inputColor2[4];
|
||||
float inputValue[4];
|
||||
|
||||
this->m_inputValueOperation->read(inputValue, x, y, sampler);
|
||||
this->m_inputColor1Operation->read(inputColor1, x, y, sampler);
|
||||
this->m_inputColor2Operation->read(inputColor2, x, y, sampler);
|
||||
|
||||
float value = inputValue[0];
|
||||
if (this->useValueAlphaMultiply()) {
|
||||
value *= inputColor2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
|
||||
float rH, rS, rV;
|
||||
float colH, colS, colV;
|
||||
rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV);
|
||||
rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV);
|
||||
hsv_to_rgb(rH, rS, (valuem * rV + value * colV), &output[0], &output[1], &output[2]);
|
||||
output[3] = inputColor1[3];
|
||||
|
||||
clampIfNeeded(output);
|
||||
}
|
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_MixValueOperation_h
|
||||
#define _COM_MixValueOperation_h
|
||||
#include "COM_MixBaseOperation.h"
|
||||
|
||||
|
||||
/**
|
||||
* this program converts an input color to an output value.
|
||||
* it assumes we are in sRGB color space.
|
||||
*/
|
||||
class MixValueOperation : public MixBaseOperation {
|
||||
public:
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
MixValueOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
#endif
|
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersAOOperation.h"
|
||||
|
||||
RenderLayersAOOperation::RenderLayersAOOperation() : RenderLayersBaseProg(SCE_PASS_AO, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersAOOperation_h
|
||||
#define _COM_RenderLayersAOOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersAOOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersAOOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersAlphaProg.h"
|
||||
|
||||
RenderLayersAlphaProg::RenderLayersAlphaProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
void RenderLayersAlphaProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
int ix = x;
|
||||
int iy = y;
|
||||
float *inputBuffer = this->getInputBuffer();
|
||||
|
||||
if (inputBuffer == NULL || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || iy >= (int)this->getHeight() ) {
|
||||
output[0] = 0.0f;
|
||||
output[1] = 0.0f;
|
||||
output[2] = 0.0f;
|
||||
output[3] = 0.0f;
|
||||
}
|
||||
else {
|
||||
unsigned int offset = (iy * this->getWidth() + ix) * 4;
|
||||
output[0] = inputBuffer[offset + 3];
|
||||
output[1] = 0.0f;
|
||||
output[2] = 0.0f;
|
||||
output[3] = 0.0f;
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersAlphaProg_h
|
||||
#define _COM_RenderLayersAlphaProg_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersAlphaProg : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersAlphaProg();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
#include "RE_shader_ext.h"
|
||||
#include "RE_render_ext.h"
|
||||
}
|
||||
|
||||
RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize) : NodeOperation()
|
||||
{
|
||||
this->m_renderpass = renderpass;
|
||||
this->setScene(NULL);
|
||||
this->m_inputBuffer = NULL;
|
||||
this->m_elementsize = elementsize;
|
||||
this->m_rd = NULL;
|
||||
}
|
||||
|
||||
|
||||
void RenderLayersBaseProg::initExecution()
|
||||
{
|
||||
Scene *scene = this->getScene();
|
||||
Render *re = (scene) ? RE_GetRender(scene->id.name) : NULL;
|
||||
RenderResult *rr = NULL;
|
||||
|
||||
if (re)
|
||||
rr = RE_AcquireResultRead(re);
|
||||
|
||||
if (rr) {
|
||||
SceneRenderLayer *srl = (SceneRenderLayer *)BLI_findlink(&scene->r.layers, getLayerId());
|
||||
if (srl) {
|
||||
|
||||
RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
|
||||
if (rl && rl->rectf) {
|
||||
this->m_inputBuffer = RE_RenderLayerGetPass(rl, this->m_renderpass);
|
||||
|
||||
if (this->m_inputBuffer == NULL || this->m_renderpass == SCE_PASS_COMBINED) {
|
||||
this->m_inputBuffer = rl->rectf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (re) {
|
||||
RE_ReleaseResult(re);
|
||||
re = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
unsigned int offset;
|
||||
int ix, iy;
|
||||
int width = this->getWidth(), height = this->getHeight();
|
||||
|
||||
switch (sampler) {
|
||||
case COM_PS_NEAREST:
|
||||
ix = x;
|
||||
iy = y;
|
||||
offset = (iy * width + ix) * this->m_elementsize;
|
||||
|
||||
if (this->m_elementsize == 1)
|
||||
output[0] = this->m_inputBuffer[offset];
|
||||
else if (this->m_elementsize == 3)
|
||||
copy_v3_v3(output, &this->m_inputBuffer[offset]);
|
||||
else
|
||||
copy_v4_v4(output, &this->m_inputBuffer[offset]);
|
||||
|
||||
break;
|
||||
|
||||
case COM_PS_BILINEAR:
|
||||
BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
|
||||
break;
|
||||
|
||||
case COM_PS_BICUBIC:
|
||||
BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->m_elementsize == 1) {
|
||||
output[1] = 0.0f;
|
||||
output[2] = 0.0f;
|
||||
output[3] = 0.0f;
|
||||
}
|
||||
else if (this->m_elementsize == 3) {
|
||||
output[3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
#if 0
|
||||
const RenderData *rd = this->m_rd;
|
||||
|
||||
int dx = 0, dy = 0;
|
||||
|
||||
if (rd->mode & R_BORDER && rd->mode & R_CROP) {
|
||||
/* see comment in executeRegion describing coordinate mapping,
|
||||
* here it simply goes other way around
|
||||
*/
|
||||
int full_width = rd->xsch * rd->size / 100;
|
||||
int full_height = rd->ysch * rd->size / 100;
|
||||
|
||||
dx = rd->border.xmin * full_width - (full_width - this->getWidth()) / 2.0f;
|
||||
dy = rd->border.ymin * full_height - (full_height - this->getHeight()) / 2.0f;
|
||||
}
|
||||
|
||||
int ix = x - dx;
|
||||
int iy = y - dy;
|
||||
#else
|
||||
int ix = x;
|
||||
int iy = y;
|
||||
#endif
|
||||
|
||||
if (this->m_inputBuffer == NULL || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || iy >= (int)this->getHeight() ) {
|
||||
zero_v4(output);
|
||||
}
|
||||
else {
|
||||
doInterpolation(output, ix, iy, sampler);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::deinitExecution()
|
||||
{
|
||||
this->m_inputBuffer = NULL;
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
|
||||
{
|
||||
Scene *sce = this->getScene();
|
||||
Render *re = (sce) ? RE_GetRender(sce->id.name) : NULL;
|
||||
RenderResult *rr = NULL;
|
||||
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
|
||||
if (re)
|
||||
rr = RE_AcquireResultRead(re);
|
||||
|
||||
if (rr) {
|
||||
SceneRenderLayer *srl = (SceneRenderLayer *)BLI_findlink(&sce->r.layers, getLayerId());
|
||||
if (srl) {
|
||||
RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
|
||||
if (rl && rl->rectf) {
|
||||
resolution[0] = rl->rectx;
|
||||
resolution[1] = rl->recty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (re)
|
||||
RE_ReleaseResult(re);
|
||||
|
||||
}
|
||||
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersColorOperation.h"
|
||||
|
||||
RenderLayersColorOperation::RenderLayersColorOperation() : RenderLayersBaseProg(SCE_PASS_RGBA, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersColorOperation_h
|
||||
#define _COM_RenderLayersColorOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersColorOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersColorOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersCyclesOperation.h"
|
||||
|
||||
RenderLayersCyclesOperation::RenderLayersCyclesOperation(int pass) : RenderLayersBaseProg(pass, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersCyclesOperation_h
|
||||
#define _COM_RenderLayersCyclesOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersCyclesOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersCyclesOperation(int pass);
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersDepthProg.h"
|
||||
|
||||
RenderLayersDepthProg::RenderLayersDepthProg() : RenderLayersBaseProg(SCE_PASS_Z, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersDepthProg_h
|
||||
#define _COM_RenderLayersDepthProg_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersDepthProg : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersDepthProg();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersDiffuseOperation.h"
|
||||
|
||||
RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() : RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersDiffuseOperation_h
|
||||
#define _COM_RenderLayersDiffuseOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersDiffuseOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersDiffuseOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersEmitOperation.h"
|
||||
|
||||
RenderLayersEmitOperation::RenderLayersEmitOperation() : RenderLayersBaseProg(SCE_PASS_EMIT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersEmitOperation_h
|
||||
#define _COM_RenderLayersEmitOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersEmitOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersEmitOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersEnvironmentOperation.h"
|
||||
|
||||
RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() : RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersEnvironmentOperation_h
|
||||
#define _COM_RenderLayersEnvironmentOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersEnvironmentOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersEnvironmentOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersImageProg.h"
|
||||
|
||||
RenderLayersColorProg::RenderLayersColorProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersColorProg_h
|
||||
#define _COM_RenderLayersColorProg_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
/// @todo rename to image operation
|
||||
class RenderLayersColorProg : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersColorProg();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersIndirectOperation.h"
|
||||
|
||||
RenderLayersIndirectOperation::RenderLayersIndirectOperation() : RenderLayersBaseProg(SCE_PASS_INDIRECT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersIndirectOperation_h
|
||||
#define _COM_RenderLayersIndirectOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersIndirectOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersIndirectOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersMaterialIndexOperation.h"
|
||||
|
||||
RenderLayersMaterialIndexOperation::RenderLayersMaterialIndexOperation() : RenderLayersBaseProg(SCE_PASS_INDEXMA, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersMaterialIndexOperation_h
|
||||
#define _COM_RenderLayersMaterialIndexOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersMaterialIndexOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersMaterialIndexOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersMistOperation.h"
|
||||
|
||||
RenderLayersMistOperation::RenderLayersMistOperation() : RenderLayersBaseProg(SCE_PASS_MIST, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersMistOperation_h
|
||||
#define _COM_RenderLayersMistOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersMistOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersMistOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersNormalOperation.h"
|
||||
|
||||
RenderLayersNormalOperation::RenderLayersNormalOperation() : RenderLayersBaseProg(SCE_PASS_NORMAL, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersNormalOperation_h
|
||||
#define _COM_RenderLayersNormalOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersNormalOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersNormalOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersObjectIndexOperation.h"
|
||||
|
||||
RenderLayersObjectIndexOperation::RenderLayersObjectIndexOperation() : RenderLayersBaseProg(SCE_PASS_INDEXOB, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersObjectIndexOperation_h
|
||||
#define _COM_RenderLayersObjectIndexOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersObjectIndexOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersObjectIndexOperation();
|
||||
};
|
||||
|
||||
#endif
|
340
source/blender/compositor/operations/COM_RenderLayersProg.cpp
Normal file
340
source/blender/compositor/operations/COM_RenderLayersProg.cpp
Normal file
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersProg.h"
|
||||
|
||||
#include "BLI_listbase.h"
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
extern "C" {
|
||||
#include "RE_pipeline.h"
|
||||
#include "RE_shader_ext.h"
|
||||
#include "RE_render_ext.h"
|
||||
}
|
||||
|
||||
/* ******** Render Layers Base Prog ******** */
|
||||
|
||||
RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize) : NodeOperation()
|
||||
{
|
||||
this->m_renderpass = renderpass;
|
||||
this->setScene(NULL);
|
||||
this->m_inputBuffer = NULL;
|
||||
this->m_elementsize = elementsize;
|
||||
this->m_rd = NULL;
|
||||
}
|
||||
|
||||
|
||||
void RenderLayersBaseProg::initExecution()
|
||||
{
|
||||
Scene *scene = this->getScene();
|
||||
Render *re = (scene) ? RE_GetRender(scene->id.name) : NULL;
|
||||
RenderResult *rr = NULL;
|
||||
|
||||
if (re)
|
||||
rr = RE_AcquireResultRead(re);
|
||||
|
||||
if (rr) {
|
||||
SceneRenderLayer *srl = (SceneRenderLayer *)BLI_findlink(&scene->r.layers, getLayerId());
|
||||
if (srl) {
|
||||
|
||||
RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
|
||||
if (rl && rl->rectf) {
|
||||
this->m_inputBuffer = RE_RenderLayerGetPass(rl, this->m_renderpass);
|
||||
|
||||
if (this->m_inputBuffer == NULL || this->m_renderpass == SCE_PASS_COMBINED) {
|
||||
this->m_inputBuffer = rl->rectf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (re) {
|
||||
RE_ReleaseResult(re);
|
||||
re = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
unsigned int offset;
|
||||
int ix, iy;
|
||||
int width = this->getWidth(), height = this->getHeight();
|
||||
|
||||
switch (sampler) {
|
||||
case COM_PS_NEAREST:
|
||||
ix = x;
|
||||
iy = y;
|
||||
offset = (iy * width + ix) * this->m_elementsize;
|
||||
|
||||
if (this->m_elementsize == 1)
|
||||
output[0] = this->m_inputBuffer[offset];
|
||||
else if (this->m_elementsize == 3)
|
||||
copy_v3_v3(output, &this->m_inputBuffer[offset]);
|
||||
else
|
||||
copy_v4_v4(output, &this->m_inputBuffer[offset]);
|
||||
|
||||
break;
|
||||
|
||||
case COM_PS_BILINEAR:
|
||||
BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
|
||||
break;
|
||||
|
||||
case COM_PS_BICUBIC:
|
||||
BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y);
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->m_elementsize == 1) {
|
||||
output[1] = 0.0f;
|
||||
output[2] = 0.0f;
|
||||
output[3] = 0.0f;
|
||||
}
|
||||
else if (this->m_elementsize == 3) {
|
||||
output[3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
#if 0
|
||||
const RenderData *rd = this->m_rd;
|
||||
|
||||
int dx = 0, dy = 0;
|
||||
|
||||
if (rd->mode & R_BORDER && rd->mode & R_CROP) {
|
||||
/* see comment in executeRegion describing coordinate mapping,
|
||||
* here it simply goes other way around
|
||||
*/
|
||||
int full_width = rd->xsch * rd->size / 100;
|
||||
int full_height = rd->ysch * rd->size / 100;
|
||||
|
||||
dx = rd->border.xmin * full_width - (full_width - this->getWidth()) / 2.0f;
|
||||
dy = rd->border.ymin * full_height - (full_height - this->getHeight()) / 2.0f;
|
||||
}
|
||||
|
||||
int ix = x - dx;
|
||||
int iy = y - dy;
|
||||
#else
|
||||
int ix = x;
|
||||
int iy = y;
|
||||
#endif
|
||||
|
||||
if (this->m_inputBuffer == NULL || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || iy >= (int)this->getHeight() ) {
|
||||
zero_v4(output);
|
||||
}
|
||||
else {
|
||||
doInterpolation(output, ix, iy, sampler);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::deinitExecution()
|
||||
{
|
||||
this->m_inputBuffer = NULL;
|
||||
}
|
||||
|
||||
void RenderLayersBaseProg::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
|
||||
{
|
||||
Scene *sce = this->getScene();
|
||||
Render *re = (sce) ? RE_GetRender(sce->id.name) : NULL;
|
||||
RenderResult *rr = NULL;
|
||||
|
||||
resolution[0] = 0;
|
||||
resolution[1] = 0;
|
||||
|
||||
if (re)
|
||||
rr = RE_AcquireResultRead(re);
|
||||
|
||||
if (rr) {
|
||||
SceneRenderLayer *srl = (SceneRenderLayer *)BLI_findlink(&sce->r.layers, getLayerId());
|
||||
if (srl) {
|
||||
RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
|
||||
if (rl && rl->rectf) {
|
||||
resolution[0] = rl->rectx;
|
||||
resolution[1] = rl->recty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (re)
|
||||
RE_ReleaseResult(re);
|
||||
|
||||
}
|
||||
|
||||
/* ******** Render Layers AO Operation ******** */
|
||||
|
||||
RenderLayersAOOperation::RenderLayersAOOperation() : RenderLayersBaseProg(SCE_PASS_AO, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Alpha Operation ******** */
|
||||
|
||||
RenderLayersAlphaProg::RenderLayersAlphaProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
void RenderLayersAlphaProg::executePixel(float output[4], float x, float y, PixelSampler sampler)
|
||||
{
|
||||
int ix = x;
|
||||
int iy = y;
|
||||
float *inputBuffer = this->getInputBuffer();
|
||||
|
||||
if (inputBuffer == NULL || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || iy >= (int)this->getHeight() ) {
|
||||
output[0] = 0.0f;
|
||||
output[1] = 0.0f;
|
||||
output[2] = 0.0f;
|
||||
output[3] = 0.0f;
|
||||
}
|
||||
else {
|
||||
unsigned int offset = (iy * this->getWidth() + ix) * 4;
|
||||
output[0] = inputBuffer[offset + 3];
|
||||
output[1] = 0.0f;
|
||||
output[2] = 0.0f;
|
||||
output[3] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* ******** Render Layers Color Operation ******** */
|
||||
|
||||
RenderLayersColorOperation::RenderLayersColorOperation() : RenderLayersBaseProg(SCE_PASS_RGBA, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Cycles Operation ******** */
|
||||
|
||||
RenderLayersCyclesOperation::RenderLayersCyclesOperation(int pass) : RenderLayersBaseProg(pass, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Depth Operation ******** */
|
||||
|
||||
RenderLayersDepthProg::RenderLayersDepthProg() : RenderLayersBaseProg(SCE_PASS_Z, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Diffuse Operation ******** */
|
||||
|
||||
RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() : RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Emit Operation ******** */
|
||||
|
||||
RenderLayersEmitOperation::RenderLayersEmitOperation() : RenderLayersBaseProg(SCE_PASS_EMIT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Environment Operation ******** */
|
||||
|
||||
RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() : RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Image Operation ******** */
|
||||
|
||||
RenderLayersColorProg::RenderLayersColorProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Indirect Operation ******** */
|
||||
|
||||
RenderLayersIndirectOperation::RenderLayersIndirectOperation() : RenderLayersBaseProg(SCE_PASS_INDIRECT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Material Index Operation ******** */
|
||||
|
||||
RenderLayersMaterialIndexOperation::RenderLayersMaterialIndexOperation() : RenderLayersBaseProg(SCE_PASS_INDEXMA, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Mist Operation ******** */
|
||||
|
||||
RenderLayersMistOperation::RenderLayersMistOperation() : RenderLayersBaseProg(SCE_PASS_MIST, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Normal Operation ******** */
|
||||
|
||||
RenderLayersNormalOperation::RenderLayersNormalOperation() : RenderLayersBaseProg(SCE_PASS_NORMAL, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Object Index Operation ******** */
|
||||
|
||||
RenderLayersObjectIndexOperation::RenderLayersObjectIndexOperation() : RenderLayersBaseProg(SCE_PASS_INDEXOB, 1)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VALUE);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Reflection Operation ******** */
|
||||
|
||||
RenderLayersReflectionOperation::RenderLayersReflectionOperation() : RenderLayersBaseProg(SCE_PASS_REFLECT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Refraction Operation ******** */
|
||||
|
||||
RenderLayersRefractionOperation::RenderLayersRefractionOperation() : RenderLayersBaseProg(SCE_PASS_REFRACT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Shadow Operation ******** */
|
||||
|
||||
RenderLayersShadowOperation::RenderLayersShadowOperation() : RenderLayersBaseProg(SCE_PASS_SHADOW, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Specular Operation ******** */
|
||||
|
||||
RenderLayersSpecularOperation::RenderLayersSpecularOperation() : RenderLayersBaseProg(SCE_PASS_SPEC, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers Speed Operation ******** */
|
||||
|
||||
RenderLayersSpeedOperation::RenderLayersSpeedOperation() : RenderLayersBaseProg(SCE_PASS_VECTOR, 4)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
||||
|
||||
/* ******** Render Layers UV Operation ******** */
|
||||
|
||||
RenderLayersUVOperation::RenderLayersUVOperation() : RenderLayersBaseProg(SCE_PASS_UV, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_VECTOR);
|
||||
}
|
@@ -102,4 +102,107 @@ public:
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
};
|
||||
|
||||
class RenderLayersAOOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersAOOperation();
|
||||
};
|
||||
|
||||
class RenderLayersAlphaProg : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersAlphaProg();
|
||||
void executePixel(float output[4], float x, float y, PixelSampler sampler);
|
||||
|
||||
};
|
||||
|
||||
class RenderLayersColorOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersColorOperation();
|
||||
};
|
||||
|
||||
class RenderLayersCyclesOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersCyclesOperation(int pass);
|
||||
};
|
||||
|
||||
class RenderLayersDepthProg : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersDepthProg();
|
||||
};
|
||||
|
||||
class RenderLayersDiffuseOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersDiffuseOperation();
|
||||
};
|
||||
|
||||
class RenderLayersEmitOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersEmitOperation();
|
||||
};
|
||||
|
||||
class RenderLayersEnvironmentOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersEnvironmentOperation();
|
||||
};
|
||||
|
||||
/// @todo rename to image operation
|
||||
class RenderLayersColorProg : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersColorProg();
|
||||
};
|
||||
|
||||
class RenderLayersIndirectOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersIndirectOperation();
|
||||
};
|
||||
|
||||
class RenderLayersMaterialIndexOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersMaterialIndexOperation();
|
||||
};
|
||||
|
||||
class RenderLayersMistOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersMistOperation();
|
||||
};
|
||||
|
||||
class RenderLayersNormalOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersNormalOperation();
|
||||
};
|
||||
|
||||
class RenderLayersObjectIndexOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersObjectIndexOperation();
|
||||
};
|
||||
|
||||
class RenderLayersReflectionOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersReflectionOperation();
|
||||
};
|
||||
|
||||
class RenderLayersRefractionOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersRefractionOperation();
|
||||
};
|
||||
|
||||
class RenderLayersShadowOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersShadowOperation();
|
||||
};
|
||||
|
||||
class RenderLayersSpecularOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersSpecularOperation();
|
||||
};
|
||||
|
||||
class RenderLayersSpeedOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersSpeedOperation();
|
||||
};
|
||||
|
||||
class RenderLayersUVOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersUVOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersReflectionOperation.h"
|
||||
|
||||
RenderLayersReflectionOperation::RenderLayersReflectionOperation() : RenderLayersBaseProg(SCE_PASS_REFLECT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersReflectionOperation_h
|
||||
#define _COM_RenderLayersReflectionOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersReflectionOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersReflectionOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersRefractionOperation.h"
|
||||
|
||||
RenderLayersRefractionOperation::RenderLayersRefractionOperation() : RenderLayersBaseProg(SCE_PASS_REFRACT, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#ifndef _COM_RenderLayersRefractionOperation_h
|
||||
#define _COM_RenderLayersRefractionOperation_h
|
||||
|
||||
#include "COM_RenderLayersBaseProg.h"
|
||||
|
||||
class RenderLayersRefractionOperation : public RenderLayersBaseProg {
|
||||
public:
|
||||
RenderLayersRefractionOperation();
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contributor:
|
||||
* Jeroen Bakker
|
||||
* Monique Dewanchand
|
||||
*/
|
||||
|
||||
#include "COM_RenderLayersShadowOperation.h"
|
||||
|
||||
RenderLayersShadowOperation::RenderLayersShadowOperation() : RenderLayersBaseProg(SCE_PASS_SHADOW, 3)
|
||||
{
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user