Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
410dd47
commit cc36204
Showing
10 changed files
with
1,574 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT. | ||
//THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED | ||
OF_PATH = ../../.. | ||
|
||
//THIS HAS ALL THE HEADER AND LIBS FOR OF CORE | ||
#include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig" | ||
|
||
OTHER_LDFLAGS = $(OF_CORE_LIBS) | ||
HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS) "../../../addons/ofxOpenCv/libs/opencv/include/" |
1,081 changes: 1,081 additions & 0 deletions
1,081
ScrambleSuit/ScrambleSuit.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
uniform sampler2DRect tex; | ||
uniform vec2 direction; | ||
uniform int k; | ||
|
||
void main() { | ||
vec2 st = gl_TexCoord[0].st; | ||
|
||
float curWeight = float(k + 1); | ||
float alpha = curWeight * texture2DRect(tex, st).a; | ||
float count = curWeight; | ||
for(int i = 0; i < k; i++) { | ||
vec2 cur = float(i) * direction; | ||
curWeight = float(k - i + 1); // linear dropoff blur | ||
alpha += curWeight * (texture2DRect(tex, st + cur).a + texture2DRect(tex, st - cur).a); | ||
count += curWeight * 2.; | ||
} | ||
|
||
alpha /= count; // normalize blur | ||
alpha = clamp((alpha * 2.) - 1., 0., 1.); // scale for inner edges only | ||
gl_FragColor = vec4(texture2DRect(tex, st).rgb, alpha); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
uniform sampler2DRect src, srcBlur, dstBlur; | ||
|
||
void main() { | ||
vec2 pos = gl_TexCoord[0].st; | ||
vec4 srcColor = texture2DRect(src, pos); | ||
vec4 srcColorBlur = texture2DRect(srcBlur, pos); | ||
vec4 dstColorBlur = texture2DRect(dstBlur, pos); | ||
if(srcColor.a == 1. && srcColorBlur.a == 1. && dstColorBlur.a == 1.) { | ||
vec3 offset = (dstColorBlur.rgb - srcColorBlur.rgb); | ||
gl_FragColor = vec4(srcColor.rgb + offset, 1.); | ||
} else { | ||
gl_FragColor = vec4(0.); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
uniform sampler2DRect tex, mask; | ||
uniform vec2 direction; | ||
uniform int k; | ||
|
||
void main() { | ||
vec2 pos = gl_TexCoord[0].st; | ||
vec4 baseMask = texture2DRect(mask, pos); | ||
if(baseMask.r == 1.) { | ||
float curWeight = float(k); | ||
vec4 sum = curWeight * texture2DRect(tex, pos); | ||
float weights = curWeight; | ||
for(int i = k; i > 0; i--) { | ||
vec2 curOffset = float(i) * direction; | ||
vec4 leftMask = texture2DRect(mask, pos - curOffset); | ||
vec4 rightMask = texture2DRect(mask, pos + curOffset); | ||
bool valid = leftMask.r == 1. && rightMask.r == 1.; | ||
if(valid) { | ||
curWeight = float(k - i + 1); // linear dropoff blur | ||
vec4 curTex = | ||
texture2DRect(tex, pos + curOffset) + | ||
texture2DRect(tex, pos - curOffset); | ||
sum += curWeight * curTex; | ||
weights += 2. * curWeight; | ||
} | ||
} | ||
gl_FragColor = sum / weights; | ||
} else { | ||
gl_FragColor = vec4(0.); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
uniform sampler2DRect points; | ||
uniform int count; | ||
const float zoom = 2.; | ||
const float sharpness = 20.; | ||
const float eps = 1.; | ||
|
||
uniform sampler2DRect tex0, tex1, tex2, tex3, tex4; | ||
|
||
vec2 getPoint(int i) { | ||
// need .5 offset to lookup the middle of the bin | ||
vec2 st = vec2(.5 + float(i), 0.); | ||
return texture2DRect(points, st).st; | ||
} | ||
|
||
void main(void) { | ||
vec2 st = gl_TexCoord[0].st; | ||
st = (st - .5) / zoom + .5; | ||
|
||
float d0 = length(getPoint(0) - st); | ||
float d1 = length(getPoint(1) - st); | ||
float d2 = length(getPoint(2) - st); | ||
float d3 = length(getPoint(3) - st); | ||
float d4 = length(getPoint(4) - st); | ||
|
||
d0 = pow(eps / d0, sharpness); | ||
d1 = pow(eps / d1, sharpness); | ||
d2 = pow(eps / d2, sharpness); | ||
d3 = pow(eps / d3, sharpness); | ||
d4 = pow(eps / d4, sharpness); | ||
|
||
vec2 facest = gl_TexCoord[0].st * 256.; | ||
gl_FragColor = | ||
d0 * texture2DRect(tex0, facest) + | ||
d1 * texture2DRect(tex1, facest) + | ||
d2 * texture2DRect(tex2, facest) + | ||
d3 * texture2DRect(tex3, facest) + | ||
d4 * texture2DRect(tex4, facest); | ||
|
||
float sum = d0 + d1 + d2 + d3 + d4; | ||
gl_FragColor /= sum; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.yourcompany.openFrameworks</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "testApp.h" | ||
#include "ofAppGlutWindow.h" | ||
|
||
int main() { | ||
ofAppGlutWindow window; | ||
ofSetupOpenGL(&window, 1280, 720, OF_WINDOW); | ||
ofRunApp(new testApp()); | ||
} |
Oops, something went wrong.