mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
46 lines
1.6 KiB
Text
46 lines
1.6 KiB
Text
<@include gpu/Config.slh@>
|
|
<$VERSION_HEADER$>
|
|
// Generated on <$_SCRIBE_DATE$>
|
|
//
|
|
// Created by Sam Gateau on 6/3/16.
|
|
// Copyright 2016 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
<@include DeferredTransform.slh@>
|
|
<$declareDeferredFrameTransform()$>
|
|
|
|
in vec2 varTexCoord0;
|
|
out vec4 outFragColor;
|
|
|
|
uniform sampler2D depthMap;
|
|
|
|
|
|
void main(void) {
|
|
// Pixel being shaded
|
|
ivec2 pixelPos;
|
|
vec2 texcoordPos;
|
|
ivec4 stereoSide;
|
|
ivec2 framePixelPos = getPixelPosTexcoordPosAndSide(gl_FragCoord.xy, pixelPos, texcoordPos, stereoSide);
|
|
|
|
float Zdb = texelFetch(depthMap, ivec2(gl_FragCoord.xy), 0).x;
|
|
float Zeye = evalZeyeFromZdb(Zdb);
|
|
/* if (Zeye <= -getPosLinearDepthFar()) {
|
|
outFragColor = vec4(0.5, 0.5, 0.0, 0.0);
|
|
return;
|
|
}*/
|
|
|
|
// The position of the pixel fragment in Eye space then in world space
|
|
vec3 eyePos = evalEyePositionFromZeye(stereoSide.x, Zeye, texcoordPos);
|
|
vec3 worldPos = (frameTransform._viewInverse * cameraCorrection._correction * vec4(eyePos, 1.0)).xyz;
|
|
|
|
vec3 prevEyePos = (cameraCorrection._prevCorrectionInverse * frameTransform._prevView * vec4(worldPos, 1.0)).xyz;
|
|
vec4 prevClipPos = (frameTransform._projection[stereoSide.x] * vec4(prevEyePos, 1.0));
|
|
vec2 prevUV = 0.5 * (prevClipPos.xy / prevClipPos.w) + vec2(0.5);
|
|
|
|
//vec2 imageSize = getWidthHeight(0);
|
|
vec2 imageSize = vec2(1.0, 1.0);
|
|
outFragColor = vec4( ((texcoordPos - prevUV) * imageSize), 0.0, 0.0);
|
|
}
|