Fix T46408: Transform (bicubic) ID channel fails

This commit is contained in:
Campbell Barton 2015-10-08 10:16:54 +11:00
parent 27ff2be921
commit 8918e089a5
Notes: blender-bot 2023-02-14 09:02:41 +01:00
Referenced by issue #46408, Transform (bicubic) node not working on ID channel
1 changed files with 3 additions and 1 deletions

View File

@ -38,7 +38,9 @@ void IDMaskOperation::executePixelSampled(float output[4], float x, float y, Pix
float inputValue[4];
this->m_inputProgram->readSampled(inputValue, x, y, sampler);
const float a = (inputValue[0] == this->m_objectIndex) ? 1.0f : 0.0f;
/* 'round' since sampling may adjust value slightly.
* ID-mask input are originally integers too. */
const float a = (roundf(inputValue[0]) == this->m_objectIndex) ? 1.0f : 0.0f;
output[0] = a;
}