From 58a8e56f8ee3624f7f8663ac9db9168658c8738d Mon Sep 17 00:00:00 2001 From: Starmapo Date: Wed, 6 Mar 2024 12:56:28 -0400 Subject: [PATCH] Removed legacy PostProcess demo (#332) - Removed `FlxG.bitmap.dumpCache` call in TexturePackerAtlas demo --- .vscode/settings.json | 1 - .../TexturePackerAtlas/source/MenuState.hx | 3 - Effects/PostProcess/PostProcess.hxproj | 75 ---------- Effects/PostProcess/Project.xml | 85 ----------- Effects/PostProcess/assets/images/logo.png | Bin 4002 -> 0 bytes Effects/PostProcess/assets/shaders/blur.frag | 47 ------ .../assets/shaders/deuteranopia.frag | 16 -- Effects/PostProcess/assets/shaders/grain.frag | 141 ------------------ .../PostProcess/assets/shaders/grayscale.frag | 13 -- Effects/PostProcess/assets/shaders/hq2x.frag | 25 ---- .../PostProcess/assets/shaders/invert.frag | 12 -- .../assets/shaders/protanopia.frag | 16 -- .../PostProcess/assets/shaders/scanline.frag | 17 --- .../PostProcess/assets/shaders/tiltshift.frag | 82 ---------- .../assets/shaders/tritanopia.frag | 16 -- Effects/PostProcess/source/Main.hx | 13 -- Effects/PostProcess/source/PlayState.hx | 54 ------- flixel-demos.code-workspace | 3 - 18 files changed, 619 deletions(-) delete mode 100644 Effects/PostProcess/PostProcess.hxproj delete mode 100644 Effects/PostProcess/Project.xml delete mode 100644 Effects/PostProcess/assets/images/logo.png delete mode 100644 Effects/PostProcess/assets/shaders/blur.frag delete mode 100644 Effects/PostProcess/assets/shaders/deuteranopia.frag delete mode 100644 Effects/PostProcess/assets/shaders/grain.frag delete mode 100644 Effects/PostProcess/assets/shaders/grayscale.frag delete mode 100644 Effects/PostProcess/assets/shaders/hq2x.frag delete mode 100644 Effects/PostProcess/assets/shaders/invert.frag delete mode 100644 Effects/PostProcess/assets/shaders/protanopia.frag delete mode 100644 Effects/PostProcess/assets/shaders/scanline.frag delete mode 100644 Effects/PostProcess/assets/shaders/tiltshift.frag delete mode 100644 Effects/PostProcess/assets/shaders/tritanopia.frag delete mode 100644 Effects/PostProcess/source/Main.hx delete mode 100644 Effects/PostProcess/source/PlayState.hx diff --git a/.vscode/settings.json b/.vscode/settings.json index bc601fbda..6c6ac02a6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -37,7 +37,6 @@ "Effects/FlxTween/source", "Effects/MosaicEffect/source", "Effects/Parallax/source", - "Effects/PostProcess/source", "Effects/Transitions/source", "Features/CollisionAndGrouping/source", "Features/Colors/source", diff --git a/Editors/TexturePackerAtlas/source/MenuState.hx b/Editors/TexturePackerAtlas/source/MenuState.hx index bf2e0e266..6b373a32b 100644 --- a/Editors/TexturePackerAtlas/source/MenuState.hx +++ b/Editors/TexturePackerAtlas/source/MenuState.hx @@ -123,8 +123,5 @@ class MenuState extends FlxState x11.animation.addByPrefix("spin", "", 3); x11.animation.play("spin"); add(x11); - - // Remove atlas bitmaps from memory (useful for targets with hardware acceleration: cpp only atm). - FlxG.bitmap.dumpCache(); } } diff --git a/Effects/PostProcess/PostProcess.hxproj b/Effects/PostProcess/PostProcess.hxproj deleted file mode 100644 index d864fb9a8..000000000 --- a/Effects/PostProcess/PostProcess.hxproj +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "$(CompilerPath)/haxelib" run lime build "$(OutputFile)" $(TargetBuild) -$(BuildConfig) -Dfdb - - - - - - - - \ No newline at end of file diff --git a/Effects/PostProcess/Project.xml b/Effects/PostProcess/Project.xml deleted file mode 100644 index f965e2824..000000000 --- a/Effects/PostProcess/Project.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Effects/PostProcess/assets/images/logo.png b/Effects/PostProcess/assets/images/logo.png deleted file mode 100644 index e939189a27b16f905844a6a6ac1dec96f7e0283b..0000000000000000000000000000000000000000 GIT bin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J6iOImLDHg7!ypZE)D2%K0Ng09&lT{ blur by one pixel - //2.0 -> blur by two pixels, etc. - float blur = radius / uResolution.x; - - //the direction of our blur - //(1.0, 0.0) -> x-axis blur - //(0.0, 1.0) -> y-axis blur - float hstep = dirx; - float vstep = diry; - - //apply blurring, using a 9-tap filter with predefined gaussian weights - - sum += texture2D(uImage0, vec2(tc.x - 4.0*blur*hstep, tc.y - 4.0*blur*vstep)) * 0.0162162162; - sum += texture2D(uImage0, vec2(tc.x - 3.0*blur*hstep, tc.y - 3.0*blur*vstep)) * 0.0540540541; - sum += texture2D(uImage0, vec2(tc.x - 2.0*blur*hstep, tc.y - 2.0*blur*vstep)) * 0.1216216216; - sum += texture2D(uImage0, vec2(tc.x - 1.0*blur*hstep, tc.y - 1.0*blur*vstep)) * 0.1945945946; - - sum += texture2D(uImage0, vec2(tc.x, tc.y)) * 0.2270270270; - - sum += texture2D(uImage0, vec2(tc.x + 1.0*blur*hstep, tc.y + 1.0*blur*vstep)) * 0.1945945946; - sum += texture2D(uImage0, vec2(tc.x + 2.0*blur*hstep, tc.y + 2.0*blur*vstep)) * 0.1216216216; - sum += texture2D(uImage0, vec2(tc.x + 3.0*blur*hstep, tc.y + 3.0*blur*vstep)) * 0.0540540541; - sum += texture2D(uImage0, vec2(tc.x + 4.0*blur*hstep, tc.y + 4.0*blur*vstep)) * 0.0162162162; - - //discard alpha for our simple demo, multiply by vertex color and return - gl_FragColor = vec4(sum.rgb, 1.0); -} diff --git a/Effects/PostProcess/assets/shaders/deuteranopia.frag b/Effects/PostProcess/assets/shaders/deuteranopia.frag deleted file mode 100644 index 3497e796e..000000000 --- a/Effects/PostProcess/assets/shaders/deuteranopia.frag +++ /dev/null @@ -1,16 +0,0 @@ -// -// Deuteranopia color blindness simulation -// Simple passthrough fragment shader -// -uniform sampler2D uImage0; -varying vec2 vTexCoord; - -const mat4 mDeuteranopia = mat4( 0.43 , 0.72 , -0.15 , 0.0 , - 0.34 , 0.57 , 0.09 , 0.0 , - -0.02 , 0.03 , 1.00 , 0.0 , - 0.0 , 0.0 , 0.0 , 1.0 ); - -void main() -{ - gl_FragColor = mDeuteranopia * texture2D(uImage0, vTexCoord); -} diff --git a/Effects/PostProcess/assets/shaders/grain.frag b/Effects/PostProcess/assets/shaders/grain.frag deleted file mode 100644 index 5f0163195..000000000 --- a/Effects/PostProcess/assets/shaders/grain.frag +++ /dev/null @@ -1,141 +0,0 @@ -/* -Film Grain post-process shader v1.1 -Martins Upitis (martinsh) devlog-martinsh.blogspot.com -2013 - --------------------------- -This work is licensed under a Creative Commons Attribution 3.0 Unported License. -So you are free to share, modify and adapt it for your needs, and even use it for commercial use. -I would also love to hear about a project you are using it. - -Have fun, -Martins --------------------------- - -Perlin noise shader by toneburst: -http://machinesdontcare.wordpress.com/2009/06/25/3d-perlin-noise-sphere-vertex-shader-sourcecode/ -*/ - -uniform sampler2D uImage0; //rendered scene sampler -uniform vec2 uResolution; //scene sampler resolution -uniform float uTime; - -varying vec2 vTexCoord; - -const float permTexUnit = 1.0/256.0; // Perm texture texel-size -const float permTexUnitHalf = 0.5/256.0; // Half perm texture texel-size - -float width = uResolution.x; -float height = uResolution.y; - -const float grainamount = 0.05; //grain amount -bool colored = false; //colored noise? -float coloramount = 0.6; -float grainsize = 1.6; //grain particle size (1.5 - 2.5) -float lumamount = 1.0; // - -//a random texture generator, but you can also use a pre-computed perturbation texture -vec4 rnm(in vec2 tc) -{ - float noise = sin(dot(tc + vec2(uTime,uTime),vec2(12.9898,78.233))) * 43758.5453; - - float noiseR = fract(noise)*2.0-1.0; - float noiseG = fract(noise*1.2154)*2.0-1.0; - float noiseB = fract(noise*1.3453)*2.0-1.0; - float noiseA = fract(noise*1.3647)*2.0-1.0; - - return vec4(noiseR,noiseG,noiseB,noiseA); -} - -float fade(in float t) { - return t*t*t*(t*(t*6.0-15.0)+10.0); -} - -float pnoise3D(in vec3 p) -{ - vec3 pi = permTexUnit*floor(p)+permTexUnitHalf; // Integer part, scaled so +1 moves permTexUnit texel - // and offset 1/2 texel to sample texel centers - vec3 pf = fract(p); // Fractional part for interpolation - - // Noise contributions from (x=0, y=0), z=0 and z=1 - float perm00 = rnm(pi.xy).a ; - vec3 grad000 = rnm(vec2(perm00, pi.z)).rgb * 4.0 - 1.0; - float n000 = dot(grad000, pf); - vec3 grad001 = rnm(vec2(perm00, pi.z + permTexUnit)).rgb * 4.0 - 1.0; - float n001 = dot(grad001, pf - vec3(0.0, 0.0, 1.0)); - - // Noise contributions from (x=0, y=1), z=0 and z=1 - float perm01 = rnm(pi.xy + vec2(0.0, permTexUnit)).a ; - vec3 grad010 = rnm(vec2(perm01, pi.z)).rgb * 4.0 - 1.0; - float n010 = dot(grad010, pf - vec3(0.0, 1.0, 0.0)); - vec3 grad011 = rnm(vec2(perm01, pi.z + permTexUnit)).rgb * 4.0 - 1.0; - float n011 = dot(grad011, pf - vec3(0.0, 1.0, 1.0)); - - // Noise contributions from (x=1, y=0), z=0 and z=1 - float perm10 = rnm(pi.xy + vec2(permTexUnit, 0.0)).a ; - vec3 grad100 = rnm(vec2(perm10, pi.z)).rgb * 4.0 - 1.0; - float n100 = dot(grad100, pf - vec3(1.0, 0.0, 0.0)); - vec3 grad101 = rnm(vec2(perm10, pi.z + permTexUnit)).rgb * 4.0 - 1.0; - float n101 = dot(grad101, pf - vec3(1.0, 0.0, 1.0)); - - // Noise contributions from (x=1, y=1), z=0 and z=1 - float perm11 = rnm(pi.xy + vec2(permTexUnit, permTexUnit)).a ; - vec3 grad110 = rnm(vec2(perm11, pi.z)).rgb * 4.0 - 1.0; - float n110 = dot(grad110, pf - vec3(1.0, 1.0, 0.0)); - vec3 grad111 = rnm(vec2(perm11, pi.z + permTexUnit)).rgb * 4.0 - 1.0; - float n111 = dot(grad111, pf - vec3(1.0, 1.0, 1.0)); - - // Blend contributions along x - vec4 n_x = mix(vec4(n000, n001, n010, n011), vec4(n100, n101, n110, n111), fade(pf.x)); - - // Blend contributions along y - vec2 n_xy = mix(n_x.xy, n_x.zw, fade(pf.y)); - - // Blend contributions along z - float n_xyz = mix(n_xy.x, n_xy.y, fade(pf.z)); - - // We're done, return the final noise value. - return n_xyz; -} - -//2d coordinate orientation thing -vec2 coordRot(in vec2 tc, in float angle) -{ - float aspect = width/height; - float rotX = ((tc.x*2.0-1.0)*aspect*cos(angle)) - ((tc.y*2.0-1.0)*sin(angle)); - float rotY = ((tc.y*2.0-1.0)*cos(angle)) + ((tc.x*2.0-1.0)*aspect*sin(angle)); - rotX = ((rotX/aspect)*0.5+0.5); - rotY = rotY*0.5+0.5; - return vec2(rotX,rotY); -} - -void main() -{ - vec2 texCoord = vTexCoord.st; - - vec3 rotOffset = vec3(1.425,3.892,5.835); //rotation offset values - vec2 rotCoordsR = coordRot(texCoord, uTime + rotOffset.x); - vec3 noise = vec3(pnoise3D(vec3(rotCoordsR*vec2(width/grainsize,height/grainsize),0.0))); - - if (colored) - { - vec2 rotCoordsG = coordRot(texCoord, uTime + rotOffset.y); - vec2 rotCoordsB = coordRot(texCoord, uTime + rotOffset.z); - noise.g = mix(noise.r,pnoise3D(vec3(rotCoordsG*vec2(width/grainsize,height/grainsize),1.0)),coloramount); - noise.b = mix(noise.r,pnoise3D(vec3(rotCoordsB*vec2(width/grainsize,height/grainsize),2.0)),coloramount); - } - - vec3 col = texture2D(uImage0, texCoord).rgb; - - //noisiness response curve based on scene luminance - vec3 lumcoeff = vec3(0.299,0.587,0.114); - float luminance = mix(0.0,dot(col, lumcoeff),lumamount); - float lum = smoothstep(0.2,0.0,luminance); - lum += luminance; - - - noise = mix(noise,vec3(0.0),pow(lum,4.0)); - col = col+noise*grainamount; - - gl_FragColor = vec4(col,1.0); -} diff --git a/Effects/PostProcess/assets/shaders/grayscale.frag b/Effects/PostProcess/assets/shaders/grayscale.frag deleted file mode 100644 index d8dffa86b..000000000 --- a/Effects/PostProcess/assets/shaders/grayscale.frag +++ /dev/null @@ -1,13 +0,0 @@ -#ifdef GL_ES - precision mediump float; -#endif - -varying vec2 vTexCoord; -uniform sampler2D uImage0; - -void main(void) -{ - vec4 color = texture2D(uImage0, vTexCoord); - float gray = dot(color.rgb, vec3(0.299, 0.587, 0.114)); - gl_FragColor = vec4(gray, gray, gray, 1.0); -} diff --git a/Effects/PostProcess/assets/shaders/hq2x.frag b/Effects/PostProcess/assets/shaders/hq2x.frag deleted file mode 100644 index 9f4854dd7..000000000 --- a/Effects/PostProcess/assets/shaders/hq2x.frag +++ /dev/null @@ -1,25 +0,0 @@ -uniform sampler2D uImage0; -uniform vec2 uResolution; - -varying vec2 vTexCoord; - -void main() -{ - float x = 1.0 / uResolution.x; - float y = 1.0 / uResolution.y; - - vec4 color1 = texture2D(uImage0, vTexCoord.st + vec2(-x, -y)); - vec4 color2 = texture2D(uImage0, vTexCoord.st + vec2(0.0, -y)); - vec4 color3 = texture2D(uImage0, vTexCoord.st + vec2(x, -y)); - - vec4 color4 = texture2D(uImage0, vTexCoord.st + vec2(-x, 0.0)); - vec4 color5 = texture2D(uImage0, vTexCoord.st + vec2(0.0, 0.0)); - vec4 color6 = texture2D(uImage0, vTexCoord.st + vec2(x, 0.0)); - - vec4 color7 = texture2D(uImage0, vTexCoord.st + vec2(-x, y)); - vec4 color8 = texture2D(uImage0, vTexCoord.st + vec2(0.0, y)); - vec4 color9 = texture2D(uImage0, vTexCoord.st + vec2(x, y)); - vec4 avg = color1 + color2 + color3 + color4 + color5 + color6 + color7 + color8 + color9; - - gl_FragColor = avg / 9.0; -} diff --git a/Effects/PostProcess/assets/shaders/invert.frag b/Effects/PostProcess/assets/shaders/invert.frag deleted file mode 100644 index 027fcec4b..000000000 --- a/Effects/PostProcess/assets/shaders/invert.frag +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef GL_ES - precision mediump float; -#endif - -varying vec2 vTexCoord; -uniform sampler2D uImage0; - -void main(void) -{ - vec4 color = texture2D(uImage0, vTexCoord); - gl_FragColor = vec4(vec3(1.0, 1.0, 1.0) - color.rgb, color.a); -} diff --git a/Effects/PostProcess/assets/shaders/protanopia.frag b/Effects/PostProcess/assets/shaders/protanopia.frag deleted file mode 100644 index 709ffe4f9..000000000 --- a/Effects/PostProcess/assets/shaders/protanopia.frag +++ /dev/null @@ -1,16 +0,0 @@ -// -// Protanopia color blindness simulation -// Simple passthrough fragment shader -// -uniform sampler2D uImage0; -varying vec2 vTexCoord; - -const mat4 mProtanopia = mat4( 0.20 , 0.99 , -0.19 , 0.0 , - 0.16 , 0.79 , 0.04 , 0.0 , - 0.01 , -0.01 , 1.00 , 0.0 , - 0.0 , 0.0 , 0.0 , 1.0 ); - -void main() -{ - gl_FragColor = mProtanopia * texture2D(uImage0, vTexCoord); -} diff --git a/Effects/PostProcess/assets/shaders/scanline.frag b/Effects/PostProcess/assets/shaders/scanline.frag deleted file mode 100644 index dbb52cfcf..000000000 --- a/Effects/PostProcess/assets/shaders/scanline.frag +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef GL_ES - precision mediump float; -#endif - -varying vec2 vTexCoord; -uniform vec2 uResolution; -uniform sampler2D uImage0; - -const float scale = 1.0; - -void main() -{ - if (mod(floor(vTexCoord.y * uResolution.y / scale), 2.0) == 0.0) - gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); - else - gl_FragColor = texture2D(uImage0, vTexCoord); -} diff --git a/Effects/PostProcess/assets/shaders/tiltshift.frag b/Effects/PostProcess/assets/shaders/tiltshift.frag deleted file mode 100644 index 350640b0c..000000000 --- a/Effects/PostProcess/assets/shaders/tiltshift.frag +++ /dev/null @@ -1,82 +0,0 @@ -// Modified version of a tilt shift shader from Martin Jonasson (http://grapefrukt.com/) -// Read http://notes.underscorediscovery.com/ for context on shaders and this file -// License : MIT - -uniform sampler2D uImage0; -varying vec2 vTexCoord; - - /* - Take note that blurring in a single pass (the two for loops below) is more expensive than separating - the x and the y blur into different passes. This was used where bleeding edge performance - was not crucial and is to illustrate a point. - - The reason two passes is cheaper? - texture2D is a fairly high cost call, sampling a texture. - - So, in a single pass, like below, there are 3 steps, per x and y. - - That means a total of 9 "taps", it touches the texture to sample 9 times. - - Now imagine we apply this to some geometry, that is equal to 16 pixels on screen (tiny) - (16 * 16) * 9 = 2304 samples taken, for width * height number of pixels, * 9 taps - Now, if you split them up, it becomes 3 for x, and 3 for y, a total of 6 taps - (16 * 16) * 6 = 1536 samples - - That's on a *tiny* sprite, let's scale that up to 128x128 sprite... - (128 * 128) * 9 = 147,456 - (128 * 128) * 6 = 98,304 - - That's 33.33..% cheaper for splitting them up. - That's with 3 steps, with higher steps (more taps per pass...) - - A really smooth, 6 steps, 6*6 = 36 taps for one pass, 12 taps for two pass - You will notice, the curve is not linear, at 12 steps it's 144 vs 24 taps - It becomes orders of magnitude slower to do single pass! - Therefore, you split them up into two passes, one for x, one for y. - */ - - //I am hardcoding the constants like a jerk - -const float bluramount = 1.0; -const float center = 1.0; -const float stepSize = 0.004; -const float steps = 3.0; - -const float minOffs = (float(steps-1.0)) / -2.0; -const float maxOffs = (float(steps-1.0)) / +2.0; - -void main() { - - float amount; - vec4 blurred; - - //Work out how much to blur based on the mid point - amount = pow((vTexCoord.y * center) * 2.0 - 1.0, 2.0) * bluramount; - - //This is the accumulation of color from the surrounding pixels in the texture - blurred = vec4(0.0, 0.0, 0.0, 1.0); - - //From minimum offset to maximum offset - for (float offsX = minOffs; offsX <= maxOffs; ++offsX) { - for (float offsY = minOffs; offsY <= maxOffs; ++offsY) { - - //copy the coord so we can mess with it - vec2 temp_tcoord = vTexCoord.xy; - - //work out which uv we want to sample now - temp_tcoord.x += offsX * amount * stepSize; - temp_tcoord.y += offsY * amount * stepSize; - - //accumulate the sample - blurred += texture2D(uImage0, temp_tcoord); - - } //for y - } //for x - - //because we are doing an average, we divide by the amount (x AND y, hence steps * steps) - blurred /= float(steps * steps); - - //return the final blurred color - gl_FragColor = blurred; - -} //main diff --git a/Effects/PostProcess/assets/shaders/tritanopia.frag b/Effects/PostProcess/assets/shaders/tritanopia.frag deleted file mode 100644 index 6ec38e492..000000000 --- a/Effects/PostProcess/assets/shaders/tritanopia.frag +++ /dev/null @@ -1,16 +0,0 @@ -// -// Tritanopia color blindness simulation -// Simple passthrough fragment shader -// -uniform sampler2D uImage0; -varying vec2 vTexCoord; - -const mat4 mTritanopia = mat4( 0.97 , 0.11 , -0.08 , 0.0 , - 0.02 , 0.82 , 0.16 , 0.0 , - -0.06 , 0.88 , 0.18 , 0.0 , - 0.0 , 0.0 , 0.0 , 1.0 ); - -void main() -{ - gl_FragColor = mTritanopia * texture2D(uImage0, vTexCoord); -} diff --git a/Effects/PostProcess/source/Main.hx b/Effects/PostProcess/source/Main.hx deleted file mode 100644 index 9ba757312..000000000 --- a/Effects/PostProcess/source/Main.hx +++ /dev/null @@ -1,13 +0,0 @@ -package; - -import flixel.FlxGame; -import openfl.display.Sprite; - -class Main extends Sprite -{ - public function new() - { - super(); - addChild(new FlxGame(640, 480, PlayState)); - } -} diff --git a/Effects/PostProcess/source/PlayState.hx b/Effects/PostProcess/source/PlayState.hx deleted file mode 100644 index 6d13f1cb8..000000000 --- a/Effects/PostProcess/source/PlayState.hx +++ /dev/null @@ -1,54 +0,0 @@ -package; - -import flixel.addons.display.FlxBackdrop; -import flixel.addons.ui.FlxUIAssets; -import flixel.addons.ui.FlxUICheckBox; -import flixel.effects.postprocess.PostProcess; -import flixel.FlxG; -import flixel.FlxState; - -class PlayState extends FlxState -{ - var shaderNames:Array = [ - "blur", "tiltshift", "deuteranopia", "grain", "grayscale", "hq2x", "invert", "protanopia", "scanline", "tritanopia" - ]; - - var fragmentShaders:Array = []; - - override public function create():Void - { - var backdrop = new FlxBackdrop("assets/images/logo.png"); - backdrop.velocity.set(150, 150); - add(backdrop); - - var x = 10; - var y = 10; - - for (i in 0...shaderNames.length) - { - fragmentShaders.push(new PostProcess("assets/shaders/" + shaderNames[i] + ".frag")); - - createCheckbox(x, y, shaderNames[i], fragmentShaders[i]); - y += 25; - } - - // some shaders have properties that can be manipulated at runtime - var blurShader = fragmentShaders[0]; - blurShader.setUniform("diry", 1); - blurShader.setUniform("dirx", 1); - blurShader.setUniform("radius", 1); - } - - function createCheckbox(x:Float, y:Float, name:String, shader:PostProcess) - { - var checkbox = new FlxUICheckBox(x, y, FlxUIAssets.IMG_CHECK_BOX, FlxUIAssets.IMG_CHECK_MARK, name); - checkbox.callback = function() - { - if (checkbox.checked) - FlxG.addPostProcess(shader); - else - FlxG.removePostProcess(shader); - } - add(checkbox); - } -} diff --git a/flixel-demos.code-workspace b/flixel-demos.code-workspace index f169fda84..64e40146f 100644 --- a/flixel-demos.code-workspace +++ b/flixel-demos.code-workspace @@ -84,9 +84,6 @@ { "path": "Effects/Parallax" }, - { - "path": "Effects/PostProcess" - }, { "path": "Effects/Transitions" },