Optimise shader code (gm_matthew)

This commit is contained in:
Ian Curtis 2023-11-17 22:22:50 +00:00
parent 44fb32f2a9
commit bd63400471

View file

@ -277,10 +277,7 @@ void R3DFrameBuffers::AllocShaderTrans()
// if both transparency layers overlap, the result is opaque
if (colTrans1.a * colTrans2.a > 0.0) {
// are the two lines functionally identical? Need to check.
//vec3 mixCol = mix(colTrans1.rgb, colTrans2.rgb, (colTrans2.a + (1.0 - colTrans1.a)) / 2.0);
vec3 mixCol = (((colTrans1.rgb * colTrans1.a) + (colTrans2.rgb * (1.0-colTrans1.a))) + ((colTrans2.rgb * colTrans2.a) + (colTrans1 .rgb * (1.0-colTrans2.a)))) / 2.0;
vec3 mixCol = mix(colTrans1.rgb, colTrans2.rgb, (colTrans2.a + (1.0 - colTrans1.a)) / 2.0);
fragColor = vec4(mixCol, 1.0);
}
else if (colTrans1.a > 0.0) {