michael@0: var M4x4 = {}; michael@0: M4x4.mul = function M4x4_mul(a, b, r) { michael@0: a11 = a[0] michael@0: a21 = a[1] michael@0: a31 = a[2] michael@0: a12 = a[4] michael@0: a22 = a[5] michael@0: a32 = a[6] michael@0: a13 = a[8] michael@0: a23 = a[9] michael@0: a33 = a[10] michael@0: a14 = a[12] michael@0: a24 = a[13] michael@0: a34 = a[14] michael@0: b[3] michael@0: b[4] michael@0: b13 = b[8] michael@0: b23 = b[9] michael@0: b33 = b[10] michael@0: b43 = b[11] michael@0: r[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43 michael@0: r[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43 michael@0: r[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43 michael@0: return r; michael@0: }; michael@0: M4x4.scale3 = function M4x4_scale3(x, y, z, m) { michael@0: m[0] *= x; michael@0: m[3] *= x; michael@0: m[4] *= y; michael@0: m[11] *= z; michael@0: }; michael@0: M4x4.makeLookAt = function M4x4_makeLookAt() { michael@0: tm1 = new Float32Array(16); michael@0: tm2 = new Float32Array(16); michael@0: r = new Float32Array(16) michael@0: return M4x4.mul(tm1, tm2, r); michael@0: }; michael@0: var jellyfish = {}; michael@0: jellyfish.order = []; michael@0: function jellyfishInstance() {} michael@0: jellyfishInstance.prototype.drawShadow = function () { michael@0: pMatrix = M4x4.makeLookAt(); michael@0: M4x4.mul(M4x4.makeLookAt(), pMatrix, pMatrix); michael@0: M4x4.scale3(6, 180, 0, pMatrix); michael@0: } michael@0: function drawScene() { michael@0: jellyfish.order.push([0, 0]) michael@0: jellyfish[0] = new jellyfishInstance() michael@0: for (var i = 0, j = 0; i < jellyfish.count, j < 30; ++j) { michael@0: jellyfish.order[i][0] michael@0: jellyfish[0].drawShadow(); michael@0: } michael@0: } michael@0: drawScene(); michael@0: