Move premultiplied alpha to shader
This commit is contained in:
parent
db98783f09
commit
1d65cd9ffc
@ -11,6 +11,7 @@ out vec4 FragColor;
|
||||
void main(void)
|
||||
{
|
||||
float billboard_alpha = mix(1.0, texture(tex, tc).a, billboard);
|
||||
vec4 color = texture(tex, tc);
|
||||
#if defined(Advanced_Lighting_Enabled)
|
||||
vec2 xy = gl_FragCoord.xy / u_screen;
|
||||
float FragZ = gl_FragCoord.z;
|
||||
@ -21,5 +22,6 @@ void main(void)
|
||||
#else
|
||||
float alpha = 1.0;
|
||||
#endif
|
||||
FragColor = texture(tex, tc) * billboard_alpha * pc * alpha;
|
||||
color = vec4(color.rgb * color.a, color.a);
|
||||
FragColor = color * billboard_alpha * pc * alpha;
|
||||
}
|
||||
|
@ -207,25 +207,6 @@ void STKTexture::formatConversion(uint8_t* data, unsigned int* format,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (isPremulAlpha() && !m_single_channel)
|
||||
{
|
||||
for (unsigned int i = 0; i < w * h; i++)
|
||||
{
|
||||
float alpha = data[4 * i + 3];
|
||||
if (alpha > 0.0f)
|
||||
{
|
||||
alpha /= 255.0f;
|
||||
|
||||
if (CVS->isDeferredEnabled())
|
||||
{
|
||||
alpha = pow(alpha, 1.0f / 2.2f);
|
||||
}
|
||||
}
|
||||
data[i * 4] = (uint8_t)(data[i * 4] * alpha);
|
||||
data[i * 4 + 1] = (uint8_t)(data[i * 4 + 1] * alpha);
|
||||
data[i * 4 + 2] = (uint8_t)(data[i * 4 + 2] * alpha);
|
||||
}
|
||||
}
|
||||
#endif // !SERVER_ONLY
|
||||
} // formatConversion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user