mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-28 10:02:31 -06:00
rasterizer: Implement AddSigned combiner function for alpha channel.
This commit is contained in:
parent
1574c44586
commit
3b5ff61201
1 changed files with 7 additions and 0 deletions
|
@ -570,6 +570,13 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
|
|||
case Operation::Add:
|
||||
return std::min(255, input[0] + input[1]);
|
||||
|
||||
case Operation::AddSigned:
|
||||
{
|
||||
// TODO(bunnei): Verify that the color conversion from (float) 0.5f to (byte) 128 is correct
|
||||
auto result = static_cast<int>(input[0]) + static_cast<int>(input[1]) - 128;
|
||||
return static_cast<u8>(MathUtil::Clamp<int>(result, 0, 255));
|
||||
}
|
||||
|
||||
case Operation::Lerp:
|
||||
return (input[0] * input[2] + input[1] * (255 - input[2])) / 255;
|
||||
|
||||
|
|
Loading…
Reference in a new issue