Have a basic outlining thing with stencils but required a bit of hacking to make it work in Scene::render.

This commit is contained in:
Zed A. Shaw 2026-08-28 15:48:28 -04:00
parent 993f148710
commit dc973009fd
13 changed files with 101 additions and 43 deletions

View file

@ -55,6 +55,10 @@ uniform DirLight dirLights[MAX_LIGHTS];
uniform int spotLightCount = 0;
uniform SpotLight spotLights[MAX_LIGHTS];
float near = 0.1;
float far = 100.0;
vec3 CalcDirLight(DirLight light, vec3 normal, vec3 viewDir)
{
vec3 mat_tex = vec3(texture(material.diffuse, TexCoords));
@ -137,6 +141,13 @@ vec3 CalcSpotLight(SpotLight light, vec3 normal, vec3 fragPos, vec3 viewDir)
return ambient + diffuse + specular;
}
float LinearizeDepth(float depth)
{
float ndc = depth * 2.0 - 1.0;
return (2.0 * near * far) / (far + near - ndc * (far - near));
}
void main()
{
vec3 norm = normalize(Normal);
@ -159,4 +170,7 @@ void main()
}
FragColor = vec4(result, 1.0);
// float depth = LinearizeDepth(gl_FragCoord.z) / far;
// FragColor = vec4(vec3(depth), 1.0);
}

View file

@ -0,0 +1,6 @@
#version 330 core
out vec4 FragColor;
void main() {
FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}