Replaced the deprecated debug marker sample with debug utils

This commit is contained in:
Sascha Willems 2023-12-22 12:04:50 +01:00
parent 17e2abb036
commit 3a15ec4eb9
31 changed files with 251 additions and 255 deletions

View file

@ -0,0 +1,10 @@
#version 450
layout (location = 0) in vec3 inColor;
layout (location = 0) out vec4 outFragColor;
void main()
{
outFragColor.rgb = inColor;
}

Binary file not shown.

View file

@ -0,0 +1,25 @@
#version 450
layout (location = 0) in vec4 inPos;
layout (location = 3) in vec3 inColor;
layout (binding = 0) uniform UBO
{
mat4 projection;
mat4 model;
} ubo;
layout (location = 0) out vec3 outColor;
out gl_PerVertex
{
vec4 gl_Position;
};
void main()
{
{
outColor = inColor;
}
gl_Position = ubo.projection * ubo.model * inPos;
}

Binary file not shown.

View file

@ -0,0 +1,39 @@
#version 450
layout (binding = 1) uniform sampler2D samplerColor;
layout (location = 0) in vec2 inUV;
layout (location = 0) out vec4 outFragColor;
void main()
{
// Single pass gauss blur
const vec2 texOffset = vec2(0.01, 0.01);
vec2 tc0 = inUV + vec2(-texOffset.s, -texOffset.t);
vec2 tc1 = inUV + vec2( 0.0, -texOffset.t);
vec2 tc2 = inUV + vec2(+texOffset.s, -texOffset.t);
vec2 tc3 = inUV + vec2(-texOffset.s, 0.0);
vec2 tc4 = inUV + vec2( 0.0, 0.0);
vec2 tc5 = inUV + vec2(+texOffset.s, 0.0);
vec2 tc6 = inUV + vec2(-texOffset.s, +texOffset.t);
vec2 tc7 = inUV + vec2( 0.0, +texOffset.t);
vec2 tc8 = inUV + vec2(+texOffset.s, +texOffset.t);
vec4 col0 = texture(samplerColor, tc0);
vec4 col1 = texture(samplerColor, tc1);
vec4 col2 = texture(samplerColor, tc2);
vec4 col3 = texture(samplerColor, tc3);
vec4 col4 = texture(samplerColor, tc4);
vec4 col5 = texture(samplerColor, tc5);
vec4 col6 = texture(samplerColor, tc6);
vec4 col7 = texture(samplerColor, tc7);
vec4 col8 = texture(samplerColor, tc8);
vec4 sum = (1.0 * col0 + 2.0 * col1 + 1.0 * col2 +
2.0 * col3 + 4.0 * col4 + 2.0 * col5 +
1.0 * col6 + 2.0 * col7 + 1.0 * col8) / 16.0;
outFragColor = vec4(sum.rgb, 1.0);
}

Binary file not shown.

View file

@ -0,0 +1,14 @@
#version 450
layout (location = 0) out vec2 outUV;
out gl_PerVertex
{
vec4 gl_Position;
};
void main()
{
outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
gl_Position = vec4(outUV * vec2(2.0f, 2.0f) + vec2(-1.0f, -1.0f), 0.0f, 1.0f);
}

Binary file not shown.

View file

@ -0,0 +1,36 @@
#version 450
layout (binding = 1) uniform sampler2D samplerColorMap;
layout (location = 0) in vec3 inNormal;
layout (location = 1) in vec3 inColor;
layout (location = 2) in vec2 inUV;
layout (location = 3) in vec3 inViewVec;
layout (location = 4) in vec3 inLightVec;
layout (location = 0) out vec4 outFragColor;
void main()
{
// Desaturate color
vec3 color = vec3(mix(inColor, vec3(dot(vec3(0.2126,0.7152,0.0722), inColor)), 0.65));
// High ambient colors because mesh materials are pretty dark
vec3 ambient = color * vec3(1.0);
vec3 N = normalize(inNormal);
vec3 L = normalize(inLightVec);
vec3 V = normalize(inViewVec);
vec3 R = reflect(-L, N);
vec3 diffuse = max(dot(N, L), 0.0) * color;
vec3 specular = pow(max(dot(R, V), 0.0), 16.0) * vec3(0.75);
outFragColor = vec4(ambient + diffuse * 1.75 + specular, 1.0);
float intensity = dot(N,L);
float shade = 1.0;
shade = intensity < 0.5 ? 0.75 : shade;
shade = intensity < 0.35 ? 0.6 : shade;
shade = intensity < 0.25 ? 0.5 : shade;
shade = intensity < 0.1 ? 0.25 : shade;
outFragColor.rgb = inColor * 3.0 * shade;
}

Binary file not shown.

View file

@ -0,0 +1,38 @@
#version 450
layout (location = 0) in vec3 inPos;
layout (location = 1) in vec3 inNormal;
layout (location = 2) in vec2 inUV;
layout (location = 3) in vec3 inColor;
layout (binding = 0) uniform UBO
{
mat4 projection;
mat4 model;
vec4 lightPos;
} ubo;
layout (location = 0) out vec3 outNormal;
layout (location = 1) out vec3 outColor;
layout (location = 2) out vec2 outUV;
layout (location = 3) out vec3 outViewVec;
layout (location = 4) out vec3 outLightVec;
out gl_PerVertex
{
vec4 gl_Position;
};
void main()
{
outNormal = inNormal;
outColor = inColor;
outUV = inUV;
gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
vec4 pos = ubo.model * vec4(inPos, 1.0);
outNormal = mat3(ubo.model) * inNormal;
vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz;
outLightVec = lPos - pos.xyz;
outViewVec = -pos.xyz;
}

Binary file not shown.