diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_RenderLayersProg.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_RenderLayersProg.cpp | 54 |
1 files changed, 23 insertions, 31 deletions
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp index 06f4f6d77cf..4c6d5c24781 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp @@ -104,22 +104,13 @@ void RenderLayersBaseProg::doInterpolation(float output[4], float x, float y, Pi } case COM_PS_BILINEAR: - BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y); + BLI_bilinear_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x - 0.5f, y - 0.5f); break; case COM_PS_BICUBIC: - BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x, y); + BLI_bicubic_interpolation_fl(this->m_inputBuffer, output, width, height, this->m_elementsize, x - 0.5f, y - 0.5f); 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::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) @@ -145,7 +136,17 @@ void RenderLayersBaseProg::executePixelSampled(float output[4], float x, float y #endif if (this->m_inputBuffer == NULL) { - zero_v4(output); + int elemsize = this->m_elementsize; + if (elemsize == 1) { + output[0] = 0.0f; + } + else if (elemsize == 3) { + zero_v3(output); + } + else { + BLI_assert(elemsize == 4); + zero_v4(output); + } } else { doInterpolation(output, x, y, sampler); @@ -204,15 +205,12 @@ void RenderLayersAlphaProg::executePixelSampled(float output[4], float x, float float *inputBuffer = this->getInputBuffer(); if (inputBuffer == NULL) { - zero_v4(output); + output[0] = 0.0f; } else { float temp[4]; doInterpolation(temp, x, y, sampler); output[0] = temp[3]; - output[1] = 0.0f; - output[2] = 0.0f; - output[3] = 0.0f; } } @@ -227,7 +225,7 @@ RenderLayersColorOperation::RenderLayersColorOperation() : RenderLayersBaseProg( RenderLayersCyclesOperation::RenderLayersCyclesOperation(int pass) : RenderLayersBaseProg(pass, 3) { - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); } /* ******** Render Layers Depth Operation ******** */ @@ -245,16 +243,10 @@ void RenderLayersDepthProg::executePixelSampled(float output[4], float x, float 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); output[0] = inputBuffer[offset]; - output[1] = 0.0f; - output[2] = 0.0f; - output[3] = 0.0f; } } @@ -262,21 +254,21 @@ void RenderLayersDepthProg::executePixelSampled(float output[4], float x, float RenderLayersDiffuseOperation::RenderLayersDiffuseOperation() : RenderLayersBaseProg(SCE_PASS_DIFFUSE, 3) { - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); } /* ******** Render Layers Emit Operation ******** */ RenderLayersEmitOperation::RenderLayersEmitOperation() : RenderLayersBaseProg(SCE_PASS_EMIT, 3) { - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); } /* ******** Render Layers Environment Operation ******** */ RenderLayersEnvironmentOperation::RenderLayersEnvironmentOperation() : RenderLayersBaseProg(SCE_PASS_ENVIRONMENT, 3) { - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); } /* ******** Render Layers Image Operation ******** */ @@ -290,7 +282,7 @@ RenderLayersColorProg::RenderLayersColorProg() : RenderLayersBaseProg(SCE_PASS_C RenderLayersIndirectOperation::RenderLayersIndirectOperation() : RenderLayersBaseProg(SCE_PASS_INDIRECT, 3) { - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); } /* ******** Render Layers Material Index Operation ******** */ @@ -325,28 +317,28 @@ RenderLayersObjectIndexOperation::RenderLayersObjectIndexOperation() : RenderLay RenderLayersReflectionOperation::RenderLayersReflectionOperation() : RenderLayersBaseProg(SCE_PASS_REFLECT, 3) { - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); } /* ******** Render Layers Refraction Operation ******** */ RenderLayersRefractionOperation::RenderLayersRefractionOperation() : RenderLayersBaseProg(SCE_PASS_REFRACT, 3) { - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); } /* ******** Render Layers Shadow Operation ******** */ RenderLayersShadowOperation::RenderLayersShadowOperation() : RenderLayersBaseProg(SCE_PASS_SHADOW, 3) { - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); } /* ******** Render Layers Specular Operation ******** */ RenderLayersSpecularOperation::RenderLayersSpecularOperation() : RenderLayersBaseProg(SCE_PASS_SPEC, 3) { - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VECTOR); } /* ******** Render Layers Speed Operation ******** */ |