|
|
@ -396,15 +396,11 @@
|
|
396
|
396
|
|
|
397
|
397
|
var aspect = trixl.window.w / trixl.window.h;
|
|
398
|
398
|
var transform = function(pos) {
|
|
399
|
|
return mat4.multiplyMany(
|
|
400
|
|
matrix.translate(-0.5, -0.5, -0.5),
|
|
401
|
|
matrix.rotateZ(angle.z / 10),
|
|
402
|
|
//matrix.rotateY(angle.y / 10),
|
|
403
|
|
matrix.rotateX(angle.x / 10),
|
|
404
|
|
matrix.translate(pos[0] + offset.x, pos[1] + offset.y, pos[2] + offset.z),
|
|
405
|
|
view,
|
|
406
|
|
matrix.perspective(Math.PI / 3, aspect)
|
|
407
|
|
);
|
|
|
399
|
var m = mat4.create();
|
|
|
400
|
mat4.translate(m, m, [-0.5 + pos[0], -0.5 + pos[1], -0.5 + pos[2]]);
|
|
|
401
|
mat4.multiply(m, view, m);
|
|
|
402
|
mat4.multiply(m, matrix.perspective(Math.PI / 3, aspect), m);
|
|
|
403
|
return m;
|
|
408
|
404
|
}
|
|
409
|
405
|
|
|
410
|
406
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
|
@ -426,14 +422,6 @@
|
|
426
|
422
|
});
|
|
427
|
423
|
|
|
428
|
424
|
gl.uniform4f(program.color, -1, -1, -1, 0);
|
|
429
|
|
|
|
430
|
|
//angle.x += Math.PI / 10;
|
|
431
|
|
//angle.y += Math.PI / 10;
|
|
432
|
|
//angle.z += Math.PI / 10;
|
|
433
|
|
|
|
434
|
|
//offset.x = Math.sin(angle.x * 0.1);
|
|
435
|
|
//offset.y = Math.sin(angle.y * 0.1);
|
|
436
|
|
//offset.z = Math.cos(angle.z * 0.1) * 2;
|
|
437
|
425
|
}
|
|
438
|
426
|
|
|
439
|
427
|
trixl.step = function(t) {
|