소스 검색

Added depth drawing shader

NOTE: It requires a depth texture as input, it should be configured on
rlgl, by default RenderTexture (fbo) uses Depth Renderbuffer instead of
Depth Texture. Check rlglLoadRenderTexture()
pull/109/head
raysan5 9 년 전
부모
커밋
cde2c1aa6d
1개의 변경된 파일27개의 추가작업 그리고 0개의 파일을 삭제
  1. +27
    -0
      examples/resources/shaders/glsl330/depth.fs

+ 27
- 0
examples/resources/shaders/glsl330/depth.fs 파일 보기

@ -0,0 +1,27 @@
#version 330
// Input vertex attributes (from vertex shader)
in vec2 fragTexCoord;
in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; // Depth texture
uniform vec4 fragTintColor;
// Output fragment color
out vec4 finalColor;
// NOTE: Add here your custom variables
void main()
{
float zNear = 0.01; // camera z near
float zFar = 10.0; // camera z far
float z = texture(texture0, fragTexCoord).x;
// Linearize depth value
float depth = (2.0*zNear)/(zFar + zNear - z*(zFar - zNear));
// Calculate final fragment color
finalColor = vec4(depth, depth, depth, 1.0f);
}

불러오는 중...
취소
저장