diff options
Diffstat (limited to '3rdparty/bgfx/examples/43-denoise/shared_functions.sh')
-rw-r--r-- | 3rdparty/bgfx/examples/43-denoise/shared_functions.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/3rdparty/bgfx/examples/43-denoise/shared_functions.sh b/3rdparty/bgfx/examples/43-denoise/shared_functions.sh new file mode 100644 index 00000000000..21793ae3678 --- /dev/null +++ b/3rdparty/bgfx/examples/43-denoise/shared_functions.sh @@ -0,0 +1,25 @@ +/* +* Copyright 2021 elven cache. All rights reserved. +* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE +*/ + +#ifndef SHARED_FUNCTIONS_SH +#define SHARED_FUNCTIONS_SH + +vec2 GetTexCoordPreviousNoJitter(vec2 texCoord, vec2 velocity) +{ + vec2 texCoordPrev = texCoord - velocity; + return texCoordPrev; +} + +vec2 GetTexCoordPrevious(vec2 texCoord, vec2 velocity) +{ + vec2 texCoordPrev = texCoord - velocity; + + vec2 jitterDelta = (u_jitterCurr-u_jitterPrev); + texCoordPrev += jitterDelta * u_viewTexel.xy; + + return texCoordPrev; +} + +#endif // SHARED_FUNCTIONS_SH |