From 323a688a6e680df1f3665134d79a66c75ffc7d02 Mon Sep 17 00:00:00 2001 From: Themaister Date: Mon, 13 May 2013 01:37:14 +0200 Subject: [PATCH] Avoid discard hack. Breaks Lightning model, but discard breaks most models which use alpha anyways. --- libretro.cpp | 5 +---- mesh.hpp | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libretro.cpp b/libretro.cpp index 667a16e..964dba6 100644 --- a/libretro.cpp +++ b/libretro.cpp @@ -287,9 +287,6 @@ static void init_mesh(const string& path) " vec4 colorDiffuseFull = texture2D(sDiffuse, vTex);\n" " vec4 colorAmbientFull = texture2D(sAmbient, vTex);\n" - " if (colorDiffuseFull.a < 0.5)\n" - " discard;\n" - " vec3 colorDiffuse = mix(uMTLDiffuse, colorDiffuseFull.rgb, vec3(colorDiffuseFull.a));\n" " vec3 colorAmbient = mix(uMTLAmbient, colorAmbientFull.rgb, vec3(colorAmbientFull.a));\n" @@ -303,7 +300,7 @@ static void init_mesh(const string& path) " float specularity = pow(clamp(dot(modelToFace, reflect(uLightDir, normal)), 0.0, 1.0), uMTLSpecularPower);\n" " vec3 specular = uMTLSpecular * specularity;\n" - " gl_FragColor = vec4(diffuse + ambient + specular, uMTLAlphaMod);\n" + " gl_FragColor = vec4(diffuse + ambient + specular, uMTLAlphaMod * colorDiffuseFull.a);\n" "}"; shared_ptr shader(new Shader(vertex_shader, fragment_shader)); diff --git a/mesh.hpp b/mesh.hpp index 78ee79b..266fedb 100644 --- a/mesh.hpp +++ b/mesh.hpp @@ -24,8 +24,8 @@ namespace GL struct Material { Material() : - ambient(1, 1, 1), - diffuse(1, 1, 1), + ambient(0, 0, 0), + diffuse(0, 0, 0), specular(0, 0, 0), specular_power(60.0), alpha_mod(1.0f)