From b264680159dd70ed027256941e5e1c35f3e2a4c6 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Thu, 15 Nov 2018 22:56:26 +1100 Subject: [PATCH] added and tweaked effects --- .gitignore | 3 ++- .qmake.stash | 31 ----------------------------- effects/bulge.frag | 2 +- effects/posterize.frag | 19 ++++++++++++++++++ effects/posterize.xml | 10 ++++++++++ effects/ripple.frag | 34 +++++++++++++++++++++++++++++++ effects/ripple.xml | 23 +++++++++++++++++++++ effects/sphere.frag | 45 ++++++++++++++++++++++++++++++++++++++++++ effects/sphere.xml | 20 +++++++++++++++++++ effects/wave.frag | 2 +- project/undo.cpp | 2 ++ 11 files changed, 157 insertions(+), 34 deletions(-) delete mode 100644 .qmake.stash create mode 100644 effects/posterize.frag create mode 100644 effects/posterize.xml create mode 100644 effects/ripple.frag create mode 100644 effects/ripple.xml create mode 100644 effects/sphere.frag create mode 100644 effects/sphere.xml diff --git a/.gitignore b/.gitignore index 6fb4aac8e..0c3654b81 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pro.user* -Makefile +Makefile +.qmake.stash diff --git a/.qmake.stash b/.qmake.stash deleted file mode 100644 index b901879db..000000000 --- a/.qmake.stash +++ /dev/null @@ -1,31 +0,0 @@ -QMAKE_XCODE_DEVELOPER_PATH = /Applications/Xcode.app/Contents/Developer -QMAKE_XCODE_VERSION = 6.2 -QMAKE_MAC_SDK.macosx.path = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -QMAKE_MAC_SDK.macosx.platform_path = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform -QMAKE_MAC_SDK.macosx.version = 10.10 -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_CXX = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_FIX_RPATH = \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool \ - -id -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_AR = \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar \ - cq -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_RANLIB = \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib \ - -s -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_LINK = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_LINK_SHLIB = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -QMAKE_MAC_SDK.macosx.platform_name = macosx -QMAKE_MAC_SDK.macosx.Path = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -QMAKE_MAC_SDK.macosx.PlatformPath = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform -QMAKE_MAC_SDK.macosx.SDKVersion = 10.10 -QMAKE_MAC_SDK.macx-clang.macosx.QMAKE_ACTOOL = /Applications/Xcode.app/Contents/Developer/usr/bin/actool -QMAKE_DEFAULT_INCDIRS = \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.0/include \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include \ - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include -QMAKE_DEFAULT_LIBDIRS = \ - /lib \ - /usr/lib diff --git a/effects/bulge.frag b/effects/bulge.frag index ef950d2df..316002bb6 100644 --- a/effects/bulge.frag +++ b/effects/bulge.frag @@ -26,6 +26,6 @@ void main(void) { if (uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0) { gl_FragColor = texture2D(tex0, uv); } else { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + discard; } } \ No newline at end of file diff --git a/effects/posterize.frag b/effects/posterize.frag new file mode 100644 index 000000000..a3144450b --- /dev/null +++ b/effects/posterize.frag @@ -0,0 +1,19 @@ +#version 110 + +uniform sampler2D sceneTex; // 0 +uniform float gamma_cent; // 0.6 +uniform float numColors; // 8.0 + +varying vec2 vTexCoord; + +void main() { + float gamma = gamma_cent*0.01; + vec4 color = texture2D(sceneTex, vTexCoord); + vec3 c = color.rgb; + c = pow(c, vec3(gamma, gamma, gamma)); + c = c * numColors; + c = floor(c); + c = c / numColors; + c = pow(c, vec3(1.0/gamma)); + gl_FragColor = vec4(c, color.a); +} \ No newline at end of file diff --git a/effects/posterize.xml b/effects/posterize.xml new file mode 100644 index 000000000..ac08598a5 --- /dev/null +++ b/effects/posterize.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/effects/ripple.frag b/effects/ripple.frag new file mode 100644 index 000000000..03c91a5ce --- /dev/null +++ b/effects/ripple.frag @@ -0,0 +1,34 @@ +#version 110 + +varying vec2 vTexCoord; + +uniform float speed; +uniform float intensity; +uniform float frequency; +uniform float xoff; +uniform float yoff; +uniform bool reverse; +uniform bool stretch; + +uniform vec2 resolution; // Screen resolution +uniform float time; // time in seconds +uniform sampler2D tex0; // scene buffer + +void main(void) { + vec2 texCoord = vTexCoord; + vec2 center = vec2(1.0); + + if (!stretch) { + texCoord.x *= (resolution.x/resolution.y); + center.x += (resolution.x/resolution.y)/2.0; + } + + center += vec2(xoff, yoff)*0.01; + + float real_time = (reverse) ? -time : time; + + vec2 p = 2.0 * texCoord - center; + float len = length(p); + vec2 uv = vTexCoord + (p/len)*cos((frequency*0.01)*(len*12.0-real_time*(speed*0.05)))*(intensity*0.0005); + gl_FragColor = texture2D(tex0,uv); +} \ No newline at end of file diff --git a/effects/ripple.xml b/effects/ripple.xml new file mode 100644 index 000000000..3e7aede75 --- /dev/null +++ b/effects/ripple.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/effects/sphere.frag b/effects/sphere.frag new file mode 100644 index 000000000..2445b37a4 --- /dev/null +++ b/effects/sphere.frag @@ -0,0 +1,45 @@ +#version 110 + +varying vec2 vTexCoord; + +uniform vec2 resolution; // Screen resolution +uniform sampler2D tex0; // scene buffer + +uniform float xoff; +uniform float yoff; +uniform float scale; +uniform bool tile; +uniform bool hide_edges; +uniform bool stretch; + +void main(void) { + vec2 texCoord = vTexCoord; + + vec2 offset = vec2(1.0); + + if (!stretch) { + if (resolution.x > resolution.y) { + offset.x = (resolution.x/resolution.y); + texCoord.x *= offset.x; + } else { + offset.y = (resolution.y/resolution.x); + texCoord.y *= offset.y; + } + } + + vec2 p = 2.0 * texCoord - offset; + vec2 adj_tc = 2.0 * vTexCoord - 1.0; + float r = dot(p,p); + if (r > 1.0) discard; + float f = (1.0-sqrt(1.0-r))/(r); + vec2 uv; + uv.x = (adj_tc.x*(1.5-scale*0.01))*f+0.5-(xoff*0.01); + uv.y = (adj_tc.y*(1.5-scale*0.01))*f+0.5-(yoff*0.01); + if (tile) { + uv.x = mod(uv.x, 1.0); + uv.y = mod(uv.y, 1.0); + } else if (hide_edges && (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)) { + discard; + } + gl_FragColor = vec4(texture2D(tex0,uv)); +} \ No newline at end of file diff --git a/effects/sphere.xml b/effects/sphere.xml new file mode 100644 index 000000000..4bcd06c26 --- /dev/null +++ b/effects/sphere.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/effects/wave.frag b/effects/wave.frag index 75a6b1dca..40594bece 100644 --- a/effects/wave.frag +++ b/effects/wave.frag @@ -19,7 +19,7 @@ void main(void) { } if (y < 0.0 || y > 1.0 || x < 0.0 || x > 1.0) { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + discard; } else { vec4 textureColor = texture2D(myTexture, vec2(x, y)); gl_FragColor = vec4( diff --git a/project/undo.cpp b/project/undo.cpp index 47b3b33c2..780bac2d7 100644 --- a/project/undo.cpp +++ b/project/undo.cpp @@ -116,8 +116,10 @@ void DeleteClipAction::redo() { // remove ref to clip ref = seq->clips.at(index); if (ref->open) { + dout << "closing clip before deleting"; close_clip(ref); if (ref->multithreaded) ref->cacher->wait(); + dout << "FINISHED closing clip before deleting"; } seq->clips[index] = NULL;