mirror of
https://github.com/overte-org/overte.git
synced 2025-07-14 00:31:28 +02:00
41 lines
1.3 KiB
Text
41 lines
1.3 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;
|
|
|
|
// The position of the pixel fragment in Eye space then in world space
|
|
vec3 eyePos = evalUnjitteredEyePositionFromZdb(stereoSide.x, Zdb, texcoordPos);
|
|
vec3 worldPos = (getViewInverse() * vec4(eyePos, 1.0)).xyz;
|
|
|
|
vec3 prevEyePos = (getPreviousView() * vec4(worldPos, 1.0)).xyz;
|
|
vec4 prevClipPos = (getUnjitteredProjection(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);
|
|
}
|