diff options
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r-- | source/blender/compositor/operations/COM_RenderLayersProg.cpp | 186 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_RenderLayersProg.h | 122 |
2 files changed, 25 insertions, 283 deletions
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp index 099208ce600..f2f1b211a97 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp @@ -34,17 +34,18 @@ extern "C" { /* ******** Render Layers Base Prog ******** */ -RenderLayersBaseProg::RenderLayersBaseProg(int renderpass, int elementsize) : NodeOperation() +RenderLayersProg::RenderLayersProg(const char *passName, DataType type, int elementsize) : NodeOperation(), m_passName(passName) { - this->m_renderpass = renderpass; this->setScene(NULL); this->m_inputBuffer = NULL; this->m_elementsize = elementsize; this->m_rd = NULL; + + this->addOutputSocket(type); } -void RenderLayersBaseProg::initExecution() +void RenderLayersProg::initExecution() { Scene *scene = this->getScene(); Render *re = (scene) ? RE_GetRender(scene->id.name) : NULL; @@ -59,10 +60,7 @@ void RenderLayersBaseProg::initExecution() RenderLayer *rl = RE_GetRenderLayer(rr, srl->name); if (rl) { - this->m_inputBuffer = RE_RenderLayerGetPass(rl, this->m_renderpass, this->m_viewName); - if (this->m_inputBuffer == NULL && this->m_renderpass == SCE_PASS_COMBINED) { - this->m_inputBuffer = RE_RenderLayerGetPass(rl, SCE_PASS_COMBINED, this->m_viewName); - } + this->m_inputBuffer = RE_RenderLayerGetPass(rl, this->m_passName.c_str(), this->m_viewName); } } } @@ -72,7 +70,7 @@ void RenderLayersBaseProg::initExecution() } } -void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, PixelSampler sampler) +void RenderLayersProg::doInterpolation(float output[4], float x, float y, PixelSampler sampler) { unsigned int offset; int width = this->getWidth(), height = this->getHeight(); @@ -111,7 +109,7 @@ void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, Pi } } -void RenderLayersBaseProg::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void RenderLayersProg::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { #if 0 const RenderData *rd = this->m_rd; @@ -173,12 +171,12 @@ void RenderLayersBaseProg::executePixelSampled(float output[4], float x, float y } } -void RenderLayersBaseProg::deinitExecution() +void RenderLayersProg::deinitExecution() { this->m_inputBuffer = NULL; } -void RenderLayersBaseProg::determineResolution(unsigned int resolution[2], unsigned int /*preferredResolution*/[2]) +void RenderLayersProg::determineResolution(unsigned int resolution[2], unsigned int /*preferredResolution*/[2]) { Scene *sce = this->getScene(); Render *re = (sce) ? RE_GetRender(sce->id.name) : NULL; @@ -207,13 +205,6 @@ void RenderLayersBaseProg::determineResolution(unsigned int resolution[2], unsig } /* ******** Render Layers AO Operation ******** */ - -RenderLayersAOOperation::RenderLayersAOOperation() : RenderLayersBaseProg(SCE_PASS_AO, 3) -{ - this->addOutputSocket(COM_DT_COLOR); -} - - void RenderLayersAOOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { float *inputBuffer = this->getInputBuffer(); @@ -227,12 +218,6 @@ void RenderLayersAOOperation::executePixelSampled(float output[4], float x, floa } /* ******** Render Layers Alpha Operation ******** */ - -RenderLayersAlphaProg::RenderLayersAlphaProg() : RenderLayersBaseProg(SCE_PASS_COMBINED, 4) -{ - this->addOutputSocket(COM_DT_VALUE); -} - void RenderLayersAlphaProg::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { float *inputBuffer = this->getInputBuffer(); @@ -247,27 +232,7 @@ void RenderLayersAlphaProg::executePixelSampled(float output[4], float x, float } } -/* ******** 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_VECTOR); -} - /* ******** Render Layers Depth Operation ******** */ - -RenderLayersDepthProg::RenderLayersDepthProg() : RenderLayersBaseProg(SCE_PASS_Z, 1) -{ - this->addOutputSocket(COM_DT_VALUE); -} - void RenderLayersDepthProg::executePixelSampled(float output[4], float x, float y, PixelSampler /*sampler*/) { int ix = x; @@ -281,135 +246,4 @@ void RenderLayersDepthProg::executePixelSampled(float output[4], float x, float unsigned int offset = (iy * this->getWidth() + ix); output[0] = inputBuffer[offset]; } -} - -/* ******** Render Layers Diffuse Operation ******** */ - -RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() : RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3) -{ - this->addOutputSocket(COM_DT_VECTOR); -} - -/* ******** Render Layers Emit Operation ******** */ - -RenderLayersEmitOperation::RenderLayersEmitOperation() : RenderLayersBaseProg(SCE_PASS_EMIT, 3) -{ - this->addOutputSocket(COM_DT_VECTOR); -} - -/* ******** Render Layers Environment Operation ******** */ - -RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() : RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3) -{ - this->addOutputSocket(COM_DT_VECTOR); -} - -/* ******** 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_VECTOR); -} - -/* ******** 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_VECTOR); -} - -/* ******** Render Layers Refraction Operation ******** */ - -RenderLayersRefractionOperation::RenderLayersRefractionOperation() : RenderLayersBaseProg(SCE_PASS_REFRACT, 3) -{ - this->addOutputSocket(COM_DT_VECTOR); -} - -/* ******** Render Layers Shadow Operation ******** */ - -RenderLayersShadowOperation::RenderLayersShadowOperation() : RenderLayersBaseProg(SCE_PASS_SHADOW, 3) -{ - this->addOutputSocket(COM_DT_VECTOR); -} - -/* ******** Render Layers Specular Operation ******** */ - -RenderLayersSpecularOperation::RenderLayersSpecularOperation() : RenderLayersBaseProg(SCE_PASS_SPEC, 3) -{ - this->addOutputSocket(COM_DT_VECTOR); -} - -/* ******** 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); -} - -/* ******** Debug Render Layers Cycles Operation ******** */ - -#ifdef WITH_CYCLES_DEBUG - -RenderLayersCyclesDebugOperation::RenderLayersCyclesDebugOperation( - int pass, - int debug_pass_type) - : RenderLayersBaseProg(pass, RE_debug_pass_num_channels_get(debug_pass_type)) -{ - switch (m_elementsize) { - case 1: - this->addOutputSocket(COM_DT_VALUE); - break; - case 3: - this->addOutputSocket(COM_DT_VECTOR); - break; - case 4: - this->addOutputSocket(COM_DT_COLOR); - break; - default: - BLI_assert(!"Unkown debug pass type element size."); - } -} - -#endif +}
\ No newline at end of file diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.h b/source/blender/compositor/operations/COM_RenderLayersProg.h index 89eb2a6954d..1be15906770 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.h +++ b/source/blender/compositor/operations/COM_RenderLayersProg.h @@ -40,7 +40,7 @@ extern "C" { * * @todo: rename to operation. */ -class RenderLayersBaseProg : public NodeOperation { +class RenderLayersProg : public NodeOperation { protected: /** * Reference to the scene object. @@ -65,7 +65,7 @@ protected: /** * renderpass where this operation needs to get its data from */ - int m_renderpass; + std::string m_passName; int m_elementsize; @@ -73,11 +73,6 @@ protected: * @brief render data used for active rendering */ const RenderData *m_rd; - - /** - * Constructor - */ - RenderLayersBaseProg(int renderpass, int elementsize); /** * Determine the output resolution. The resolution is retrieved from the Renderer @@ -92,6 +87,10 @@ protected: void doInterpolation(float output[4], float x, float y, PixelSampler sampler); public: /** + * Constructor + */ + RenderLayersProg(const char *passName, DataType type, int elementsize); + /** * setter for the scene field. Will be called from * @see RenderLayerNode to set the actual scene where * the data will be retrieved from. @@ -108,116 +107,25 @@ public: void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; -class RenderLayersAOOperation : public RenderLayersBaseProg { +class RenderLayersAOOperation : public RenderLayersProg { public: - RenderLayersAOOperation(); + RenderLayersAOOperation(const char *passName, DataType type, int elementsize) + : RenderLayersProg(passName, type, elementsize) {} void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; -class RenderLayersAlphaProg : public RenderLayersBaseProg { +class RenderLayersAlphaProg : public RenderLayersProg { public: - RenderLayersAlphaProg(); + RenderLayersAlphaProg(const char *passName, DataType type, int elementsize) + : RenderLayersProg(passName, type, elementsize) {} void executePixelSampled(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 { +class RenderLayersDepthProg : public RenderLayersProg { public: - RenderLayersDepthProg(); + RenderLayersDepthProg(const char *passName, DataType type, int elementsize) + : RenderLayersProg(passName, type, elementsize) {} void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; -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(); -}; - -#ifdef WITH_CYCLES_DEBUG -class RenderLayersCyclesDebugOperation : public RenderLayersBaseProg { -public: - RenderLayersCyclesDebugOperation(int pass, - int debug_pass_type); -}; -#endif - #endif |