Optimize object shaders
This commit is contained in:
@@ -8,6 +8,7 @@ layout(location = 4) uniform uint animFrame;
|
|||||||
layout(location = 5) uniform vec3 IDcolor;
|
layout(location = 5) uniform vec3 IDcolor;
|
||||||
|
|
||||||
in vec2 fragTC;
|
in vec2 fragTC;
|
||||||
|
|
||||||
flat in uint fragUseAnimTex;
|
flat in uint fragUseAnimTex;
|
||||||
|
|
||||||
layout(location = 0) out vec4 color;
|
layout(location = 0) out vec4 color;
|
||||||
@@ -15,16 +16,10 @@ layout(location = 1) out vec4 IDcolor_out;
|
|||||||
layout(depth_unchanged) out float gl_FragDepth;
|
layout(depth_unchanged) out float gl_FragDepth;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec2 texDx = dFdx(fragTC);
|
color = bool(fragUseAnimTex)?texture(texAnim, vec3(fragTC, animFrame)):texture(texBase, fragTC);
|
||||||
vec2 texDy = dFdy(fragTC);
|
|
||||||
|
if (color.w < 0.5)
|
||||||
if (fragUseAnimTex > 0u)
|
discard;
|
||||||
color = textureGrad(texAnim, vec3(fragTC, animFrame), texDx, texDy);
|
|
||||||
else
|
IDcolor_out = vec4(IDcolor, 1.0);
|
||||||
color = textureGrad(texBase, fragTC, texDx, texDy);
|
|
||||||
|
|
||||||
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;
|
layout(location = 2) in uint useAnimTex;
|
||||||
|
|
||||||
out vec2 fragTC;
|
out vec2 fragTC;
|
||||||
|
|
||||||
flat out uint fragUseAnimTex;
|
flat out uint fragUseAnimTex;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
|||||||
Reference in New Issue
Block a user