simple-flip.glsl (600B)
1 /* 2 [configuration] 3 4 [OptionRangeInteger] 5 GUIName = Flip Horizontally 6 OptionName = G_FLIP_HORZ 7 MinValue = 0 8 MaxValue = 1 9 StepAmount = 1 10 DefaultValue = 1 11 12 [OptionRangeInteger] 13 GUIName = Flip Vertically 14 OptionName = G_FLIP_VERT 15 MinValue = 0 16 MaxValue = 1 17 StepAmount = 1 18 DefaultValue = 0 19 20 [/configuration] 21 */ 22 23 void main() 24 { 25 vec2 uv = GetCoordinates(); 26 vec2 ts = GetInvResolution(); 27 28 vec2 pos = uv; 29 30 if (GetOption(G_FLIP_HORZ) == 1) { 31 pos.x = 1.0 - pos.x; 32 } 33 34 if (GetOption(G_FLIP_VERT) == 1) { 35 pos.y = 1.0 - pos.y; 36 } 37 38 vec4 sum = SampleLocation(pos); 39 40 SetOutput(saturate(sum)); 41 }