Optimize object shaders

This commit is contained in:
2015-05-04 14:01:55 +02:00
parent c11b0f7a09
commit 36fd30d063
2 changed files with 8 additions and 12 deletions

View File

@@ -8,6 +8,7 @@ layout(location = 4) uniform uint animFrame;
layout(location = 5) uniform vec3 IDcolor;
in vec2 fragTC;
flat in uint fragUseAnimTex;
layout(location = 0) out vec4 color;
@@ -15,13 +16,7 @@ layout(location = 1) out vec4 IDcolor_out;
layout(depth_unchanged) out float gl_FragDepth;
void main(void) {
vec2 texDx = dFdx(fragTC);
vec2 texDy = dFdy(fragTC);
if (fragUseAnimTex > 0u)
color = textureGrad(texAnim, vec3(fragTC, animFrame), texDx, texDy);
else
color = textureGrad(texBase, fragTC, texDx, texDy);
color = bool(fragUseAnimTex)?texture(texAnim, vec3(fragTC, animFrame)):texture(texBase, fragTC);
if (color.w < 0.5)
discard;

View File

@@ -10,6 +10,7 @@ layout(location = 1) in vec2 vertexTC;
layout(location = 2) in uint useAnimTex;
out vec2 fragTC;
flat out uint fragUseAnimTex;
void main(void) {