Skip to content

Instantly share code, notes, and snippets.

@2bbb
Created August 25, 2014 17:36
Show Gist options
  • Select an option

  • Save 2bbb/565917d1d54db59f8740 to your computer and use it in GitHub Desktop.

Select an option

Save 2bbb/565917d1d54db59f8740 to your computer and use it in GitHub Desktop.
perfume world voxel gen.
var f = function(m) { return (Math.random() * m) | 0; },
vs = [],
n = 0;
for(var y = 0; y < 2000; y += 5) {
for(var _ = 0; _ < 2; _++) {
var t = Math.random() * Math.PI * 2,
r = f(15),
x = 40 + (r * Math.cos(t)) | 0,
z = 30 + (r * Math.sin(t)) | 0,
c = (f(64) + 192) * 256 + f(256);
vs.push({
id : n,
h : f(30) | 0 + 1,
w : 1,
d : 1,
x : x,
y : y,
z : z,
color : c
});
n++;
}
}
console.log(JSON.stringify(vs));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment