|
|
@ -91,6 +91,13 @@
|
|
91
|
91
|
});
|
|
92
|
92
|
}
|
|
93
|
93
|
|
|
|
94
|
var rand = function(lo, hi) {
|
|
|
95
|
var both = hi !== undefined,
|
|
|
96
|
l = both ? lo : 0,
|
|
|
97
|
h = both ? hi : lo;
|
|
|
98
|
return l + Math.round(Math.random() * (h - l));
|
|
|
99
|
}
|
|
|
100
|
|
|
94
|
101
|
var rgbFromCss = function(color) {
|
|
95
|
102
|
var el = document.createElement('div');
|
|
96
|
103
|
el.style.color = color;
|
|
|
@ -268,6 +275,26 @@
|
|
268
|
275
|
trixl.generate.many(1000, -100, 100);
|
|
269
|
276
|
}
|
|
270
|
277
|
|
|
|
278
|
trixl.generate.tower = function(pos, width, height, color) {
|
|
|
279
|
range(height).map(function() {
|
|
|
280
|
trixl.world.set([
|
|
|
281
|
rand(pos[0], pos[0] + width),
|
|
|
282
|
rand(pos[1], pos[1] + height),
|
|
|
283
|
rand(pos[2], pos[2] + width)
|
|
|
284
|
], {color: color || [Math.random(), Math.random(), Math.random(), 1]});
|
|
|
285
|
});
|
|
|
286
|
}
|
|
|
287
|
|
|
|
288
|
trixl.generate.city = function(n, width, height) {
|
|
|
289
|
range(n).map(function() {
|
|
|
290
|
var pos = [rand(width), 0, rand(width)];
|
|
|
291
|
var w = rand(5, 20);
|
|
|
292
|
var h = rand(height);
|
|
|
293
|
|
|
|
294
|
trixl.generate.tower(pos, w, h);
|
|
|
295
|
});
|
|
|
296
|
}
|
|
|
297
|
|
|
271
|
298
|
trixl.geometry = {};
|
|
272
|
299
|
|
|
273
|
300
|
trixl.geometry.circle = function(pos, radius, color) {
|