Avoid discard hack.

Breaks Lightning model, but discard breaks most models which use alpha
anyways.
This commit is contained in:
Themaister 2013-05-13 01:37:14 +02:00
parent 21b2259c17
commit 323a688a6e
2 changed files with 3 additions and 6 deletions

View File

@ -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> shader(new Shader(vertex_shader, fragment_shader));

View File

@ -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)