Shader debug improvements for bcres
This commit is contained in:
parent
3b445272db
commit
f7910096e3
Binary file not shown.
@ -1,6 +1,5 @@
|
||||
#version 330
|
||||
in vec3 normal;
|
||||
in vec4 color;
|
||||
in vec3 position;
|
||||
|
||||
|
||||
@ -8,6 +7,8 @@ in vec2 f_texcoord0;
|
||||
in vec2 f_texcoord1;
|
||||
in vec2 f_texcoord2;
|
||||
in vec2 f_texcoord3;
|
||||
in vec4 vertexColor;
|
||||
in vec3 tangent;
|
||||
|
||||
in vec3 boneWeightsColored;
|
||||
|
||||
@ -24,6 +25,7 @@ uniform mat4 modelview;
|
||||
uniform int HasDiffuse;
|
||||
|
||||
uniform sampler2D DiffuseMap;
|
||||
uniform sampler2D UVTestPattern;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
@ -36,7 +38,7 @@ void main()
|
||||
|
||||
if (renderVertColor == 1)
|
||||
{
|
||||
FragColor = color;
|
||||
FragColor = vertexColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -45,6 +47,8 @@ void main()
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 N = normal;
|
||||
|
||||
// Diffuse lighting.
|
||||
float halfLambert = dot(difLightDirection, normal) * 0.5 + 0.5;
|
||||
|
||||
@ -55,12 +59,40 @@ void main()
|
||||
FragColor.rgb += diffuseMapColor.rgb;
|
||||
|
||||
if (renderVertColor == 1)
|
||||
FragColor *= min(color, vec4(1));
|
||||
FragColor *= min(vertexColor, vec4(1));
|
||||
|
||||
FragColor.rgb *= min(boneWeightsColored, vec3(1));
|
||||
|
||||
vec2 displayTexCoord = f_texcoord0;
|
||||
|
||||
vec3 displayNormal = (normal.xyz * 0.5) + 0.5;
|
||||
if (renderType == 1) // normals color
|
||||
FragColor = vec4(displayNormal.rgb,1);
|
||||
else if (renderType == 2) // Lighting
|
||||
{
|
||||
float halfLambert = dot(difLightDirection, N) * 0.5 + 0.5;
|
||||
FragColor = vec4(vec3(halfLambert), 1);
|
||||
}
|
||||
else if (renderType == 3) //DiffuseColor
|
||||
FragColor = vec4(texture(DiffuseMap, displayTexCoord).rgb, 1);
|
||||
else if (renderType == 5) // vertexColor
|
||||
FragColor = vertexColor;
|
||||
else if (renderType == 7) // uv coords
|
||||
FragColor = vec4(displayTexCoord.x, displayTexCoord.y, 1, 1);
|
||||
else if (renderType == 8) // uv test pattern
|
||||
{
|
||||
FragColor = vec4(texture(UVTestPattern, displayTexCoord).rgb, 1);
|
||||
}
|
||||
else if (renderType == 9) //Display tangents
|
||||
{
|
||||
vec3 displayTangent = (tangent * 0.5) + 0.5;
|
||||
if (dot(tangent, vec3(1)) == 0)
|
||||
displayTangent = vec3(0);
|
||||
|
||||
FragColor = vec4(displayTangent,1);
|
||||
}
|
||||
else if (renderType == 12)
|
||||
{
|
||||
FragColor.rgb = boneWeightsColored;
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,9 @@ out vec2 f_texcoord2;
|
||||
out vec2 f_texcoord3;
|
||||
|
||||
out vec3 normal;
|
||||
out vec4 color;
|
||||
out vec4 vertexColor;
|
||||
out vec3 position;
|
||||
out vec3 tangent;
|
||||
|
||||
out vec3 boneWeightsColored;
|
||||
|
||||
@ -112,11 +113,12 @@ void main()
|
||||
vec4 position = mtxCam * mtxMdl * vec4(objPos.xyz, 1.0);
|
||||
|
||||
normal = vNormal;
|
||||
color = vColor;
|
||||
vertexColor = vColor;
|
||||
position = objPos;
|
||||
f_texcoord0 = vUV0;
|
||||
f_texcoord1 = vUV1;
|
||||
f_texcoord2 = vUV2;
|
||||
tangent = vTangent;
|
||||
|
||||
gl_Position = mtxCam * mtxMdl * vec4(vPosition.xyz, 1.0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user