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);"); | |
}); |
jonobr1
commented
Nov 14, 2011
via email
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
##
http://jonobr1.com/
[email protected]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment