Merge branch 'master' into normalmap_example

This commit is contained in:
Ray
2025-08-07 17:17:12 +02:00
committed by GitHub
177 changed files with 17241 additions and 2567 deletions

View File

@@ -0,0 +1,28 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
// Input uniform values
uniform sampler2D depthTexture;
uniform bool flipY;
float nearPlane = 0.1;
float farPlane = 100.0;
void main()
{
// Handle potential Y-flipping
vec2 texCoord = fragTexCoord;
if (flipY)
texCoord.y = 1.0 - texCoord.y;
// Sample depth texture
float depth = texture2D(depthTexture, texCoord).r;
// Linearize depth
float linearDepth = (2.0*nearPlane)/(farPlane + nearPlane - depth*(farPlane - nearPlane));
// Output final color
gl_FragColor = vec4(vec3(linearDepth), 1.0);
}