Created
November 14, 2011 01:53
-
-
Save notlion/1363063 to your computer and use it in GitHub Desktop.
Offset Generator for GLSL Sandbox
This file contains hidden or 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
var size = 9; | |
var size_half = Math.floor(size / 2); | |
var offs = []; | |
for(var y = size; --y >= 0;){ | |
for(var x = size; --x >= 0;){ | |
var ox = x - size_half; | |
var oy = y - size_half; | |
var dist = Math.sqrt(ox * ox + oy * oy); | |
if(!(ox === 0 && oy === 0) && dist < size_half){ | |
offs.push({ x: ox, y: oy, dist: dist }); | |
} | |
} | |
} | |
offs.forEach(function(off){ | |
console.log(" vel += getSpring(prev, pos + pixel * vec2(" + off.x + ", " + off.y + "), " + ((1 - off.dist / size_half) / offs.length) + " * power);"); | |
}); |
Gotcha gotcha I ended up running your gist in in the console to generate
the spring statements :)
On Sun, Nov 13, 2011 at 9:28 PM, Ryan Alexander < ***@***.*** > wrote:
Oh. This is meant to run in Node / Plask. `process.exit()` quits the app ;)
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1363063
Right on. I took out the process.exit()
to make it agnostic. Node / Plask just happened to be the easier tool to reach for this time.
For sure, for sure. Thanks for sharing Ryan!
On Sun, Nov 13, 2011 at 11:07 PM, Ryan Alexander < ***@***.*** > wrote:
Right on. I took out the `process.exit()` to make it agnostic. Node /
Plask just happened to be the easier tool to reach for this time.
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1363063
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh. This is meant to run in Node / Plask.
process.exit()
quits the app ;)