From e888934c3612291ba13813add5cf40cf8ce0efcd Mon Sep 17 00:00:00 2001 From: DCxDemo Date: Mon, 25 Apr 2022 15:01:49 +0300 Subject: [PATCH] added simple-flip shader added simple-flip shader. options: flip screen horizontally and vertically --- data/shaders/simple-flip.glsl | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 data/shaders/simple-flip.glsl diff --git a/data/shaders/simple-flip.glsl b/data/shaders/simple-flip.glsl new file mode 100644 index 000000000..e1f94d525 --- /dev/null +++ b/data/shaders/simple-flip.glsl @@ -0,0 +1,41 @@ +/* +[configuration] + +[OptionRangeInteger] +GUIName = Flip Horizontally +OptionName = G_FLIP_HORZ +MinValue = 0 +MaxValue = 1 +StepAmount = 1 +DefaultValue = 1 + +[OptionRangeInteger] +GUIName = Flip Vertically +OptionName = G_FLIP_VERT +MinValue = 0 +MaxValue = 1 +StepAmount = 1 +DefaultValue = 0 + +[/configuration] +*/ + +void main() +{ + vec2 uv = GetCoordinates(); + vec2 ts = GetInvResolution(); + + vec2 pos = uv; + + if (GetOption(G_FLIP_HORZ) == 1) { + pos.x = 1.0 - pos.x; + } + + if (GetOption(G_FLIP_VERT) == 1) { + pos.y = 1.0 - pos.y; + } + + vec4 sum = SampleLocation(pos); + + SetOutput(saturate(sum)); +} \ No newline at end of file