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
// http://mrl.nyu.edu/~perlin/noise/ | |
(function(){ | |
window.perlin = function(x, y, z){ | |
var floorX = Math.floor(x), floorY = Math.floor(y), floorZ = Math.floor(z); | |
var X = floorX & 255, Y = floorY & 255, Z = floorZ & 255; | |
x -= floorX; | |
y -= floorY; |
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
var stringToByteArray = (function(){ | |
var func = function (str) { | |
var b = [], i, unicode; | |
for(i = 0; i < str.length; i++) { | |
unicode = str.charCodeAt(i); | |
// 0x00000000 - 0x0000007f -> 0xxxxxxx | |
if (unicode <= 0x7f) { | |
b.push(unicode); | |
// 0x00000080 - 0x000007ff -> 110xxxxx 10xxxxxx | |
} else if (unicode <= 0x7ff) { |