Renamed shaders for consistency
This commit is contained in:
parent
f711c98bd6
commit
3148206758
6 changed files with 2 additions and 2 deletions
28
examples/shaders/resources/shaders/glsl100/depth_render.fs
Normal file
28
examples/shaders/resources/shaders/glsl100/depth_render.fs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#version 100
|
||||
|
||||
// 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);
|
||||
}
|
||||
18
examples/shaders/resources/shaders/glsl100/depth_write.fs
Normal file
18
examples/shaders/resources/shaders/glsl100/depth_write.fs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#version 100
|
||||
|
||||
#extension GL_EXT_frag_depth : enable
|
||||
precision mediump float;
|
||||
|
||||
varying vec2 fragTexCoord;
|
||||
varying vec4 fragColor;
|
||||
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 texelColor = texture2D(texture0, fragTexCoord);
|
||||
|
||||
gl_FragColor = texelColor*colDiffuse*fragColor;
|
||||
gl_FragDepthEXT = 1.0 - gl_FragCoord.z;
|
||||
}
|
||||
28
examples/shaders/resources/shaders/glsl120/depth_render.fs
Normal file
28
examples/shaders/resources/shaders/glsl120/depth_render.fs
Normal 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);
|
||||
}
|
||||
17
examples/shaders/resources/shaders/glsl120/depth_write.fs
Normal file
17
examples/shaders/resources/shaders/glsl120/depth_write.fs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#version 120
|
||||
|
||||
#extension GL_EXT_frag_depth : enable
|
||||
|
||||
varying vec2 fragTexCoord;
|
||||
varying vec4 fragColor;
|
||||
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 texelColor = texture2D(texture0, fragTexCoord);
|
||||
|
||||
gl_FragColor = texelColor*colDiffuse*fragColor;
|
||||
gl_FragDepthEXT = 1.0 - gl_FragCoord.z;
|
||||
}
|
||||
30
examples/shaders/resources/shaders/glsl330/depth_render.fs
Normal file
30
examples/shaders/resources/shaders/glsl330/depth_render.fs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D depthTexture;
|
||||
uniform bool flipY;
|
||||
|
||||
const float nearPlane = 0.1;
|
||||
const float farPlane = 100.0;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Handle potential Y-flipping
|
||||
vec2 texCoord = fragTexCoord;
|
||||
if (flipY) texCoord.y = 1.0 - texCoord.y;
|
||||
|
||||
// Sample depth
|
||||
float depth = texture(depthTexture, texCoord).r;
|
||||
|
||||
// Linearize depth value
|
||||
float linearDepth = (2.0*nearPlane)/(farPlane + nearPlane - depth*(farPlane - nearPlane));
|
||||
|
||||
// Output final color
|
||||
finalColor = vec4(vec3(linearDepth), 1.0);
|
||||
}
|
||||
20
examples/shaders/resources/shaders/glsl330/depth_write.fs
Normal file
20
examples/shaders/resources/shaders/glsl330/depth_write.fs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#version 330
|
||||
|
||||
// Input vertex attributes (from vertex shader)
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform sampler2D texture0;
|
||||
uniform vec4 colDiffuse;
|
||||
|
||||
// Output fragment color
|
||||
out vec4 finalColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 texelColor = texture(texture0, fragTexCoord);
|
||||
|
||||
finalColor = texelColor*colDiffuse*fragColor;
|
||||
gl_FragDepth = 1.0 - finalColor.z;
|
||||
}
|
||||
Loading…
Reference in a new issue