Optimize object shaders
This commit is contained in:
@@ -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,16 +16,10 @@ 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);
|
||||
|
||||
if (color.w < 0.5)
|
||||
discard;
|
||||
|
||||
IDcolor_out = vec4(IDcolor, 1.0);
|
||||
color = bool(fragUseAnimTex)?texture(texAnim, vec3(fragTC, animFrame)):texture(texBase, fragTC);
|
||||
|
||||
if (color.w < 0.5)
|
||||
discard;
|
||||
|
||||
IDcolor_out = vec4(IDcolor, 1.0);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user