29 lines
642 B
GLSL
29 lines
642 B
GLSL
#version 450
|
|
|
|
layout(set = 3, binding = 0) uniform sampler2D camTexture;
|
|
|
|
#ifdef ENABLE_DEPTH_WRITE
|
|
layout(set = 2, binding = 1) uniform sampler2D depthMap;
|
|
#endif
|
|
|
|
layout(location = 0) in vec2 texCoords;
|
|
layout(location = 1) in float scale;
|
|
layout(location = 0) out vec4 fragColor;
|
|
|
|
layout(set = 1, binding = 0) uniform CameraData
|
|
{
|
|
mat4 viewProjection;
|
|
mat4 view;
|
|
mat4 projection;
|
|
vec4 camPos;
|
|
float near;
|
|
float far;
|
|
} cam;
|
|
|
|
void main()
|
|
{
|
|
fragColor = texture(camTexture, texCoords);
|
|
#ifdef ENABLE_DEPTH_WRITE
|
|
gl_FragDepth = (texture(depthMap, texCoords).r - cam.near) / (cam.far - cam.near);
|
|
#endif
|
|
} |