Skip to content

Commit 3003372

Browse files
committed
- a bit better alpha testing
1 parent 62e2063 commit 3003372

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

DriverLevelTool/driver_routines/textures.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ TVec4D<ubyte> rgb5a1_ToBGRA8(ushort color, bool originalTransparencyKey /*= true
1515
ubyte g = ((color >> 5) & 0x1F) * 8;
1616
ubyte b = ((color >> 10) & 0x1F) * 8;
1717

18-
ubyte a = (color >> 15);
18+
ubyte a = (color >> 15) * 255;
1919

2020
// restore source transparency key
2121
if (originalTransparencyKey && color == 0)
@@ -34,7 +34,7 @@ TVec4D<ubyte> rgb5a1_ToRGBA8(ushort color, bool originalTransparencyKey /*= true
3434
ubyte g = ((color >> 5) & 0x1F) * 8;
3535
ubyte b = ((color >> 10) & 0x1F) * 8;
3636

37-
ubyte a = (color >> 15);
37+
ubyte a = (color >> 15) * 255;
3838

3939
// restore source transparency key
4040
if (originalTransparencyKey && color == 0)

DriverLevelTool/viewer/viewer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
" void main() {\n"\
3535
" vec4 lighting;\n"\
3636
" vec4 color = texture2D(s_texture, v_texcoord.xy);\n"\
37-
" if(color.r + color.g + color.b + color.a == 0.0f) discard;\n"\
37+
" if(color.a <= 0.5f) discard;\n"\
3838
" lighting = vec4(color.rgb * u_ambientColor.rgb * u_ambientColor.a, color.a);\n"\
3939
" lighting.rgb += u_lightColor.rgb * u_lightColor.a * color.rgb * max(1.0 - dot(v_normal, u_lightDir), 0);\n"\
4040
" fragColor = lighting;\n"\

0 commit comments

Comments
 (0)