From bd63400471bc886b68e69cbd739e40ec272dd8c3 Mon Sep 17 00:00:00 2001 From: Ian Curtis Date: Fri, 17 Nov 2023 22:22:50 +0000 Subject: [PATCH] Optimise shader code (gm_matthew) --- Src/Graphics/New3D/R3DFrameBuffers.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Src/Graphics/New3D/R3DFrameBuffers.cpp b/Src/Graphics/New3D/R3DFrameBuffers.cpp index 5f145a2..7461b01 100644 --- a/Src/Graphics/New3D/R3DFrameBuffers.cpp +++ b/Src/Graphics/New3D/R3DFrameBuffers.cpp @@ -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) {