diff options
author | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
commit | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch) | |
tree | 3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/lib/math | |
parent | c0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff) | |
parent | 40c6eb2c06b34f65a74d59ef9687251952858bab (diff) | |
download | ninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz |
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts:
js/components/gradientpicker.reel/gradientpicker.js
js/components/tools-properties/text-properties.reel/text-properties.js
js/document/views/base.js
js/document/views/design.js
js/helper-classes/3D/StageLine.js
js/helper-classes/3D/draw-utils.js
js/lib/drawing/world.js
js/lib/geom/circle.js
js/lib/geom/line.js
js/lib/geom/rectangle.js
js/lib/geom/shape-primitive.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/flag-material.js
js/lib/rdge/materials/fly-material.js
js/lib/rdge/materials/julia-material.js
js/lib/rdge/materials/keleidoscope-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/water-material.js
js/panels/Materials/materials-library-panel.reel/materials-library-panel.html
js/panels/Materials/materials-library-panel.reel/materials-library-panel.js
js/panels/Materials/materials-popup.reel/materials-popup.html
js/panels/Materials/materials-popup.reel/materials-popup.js
js/tools/LineTool.js
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/lib/math')
-rwxr-xr-x | js/lib/math/matrix.js | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/js/lib/math/matrix.js b/js/lib/math/matrix.js index 067f83e2..fe32709e 100755 --- a/js/lib/math/matrix.js +++ b/js/lib/math/matrix.js | |||
@@ -33,56 +33,56 @@ var Matrix = function Matrix() { | |||
33 | }; | 33 | }; |
34 | 34 | ||
35 | Matrix.create = function( rowArray ) { | 35 | Matrix.create = function( rowArray ) { |
36 | var mat = Matrix.I(4); | 36 | var mat = Matrix.I(4); |
37 | var index = 0; | 37 | var index = 0; |
38 | for(var j=0; j<4; j++) { | 38 | for(var j=0; j<4; j++) { |
39 | for (var i=0; i<4; i++) { | 39 | for (var i=0; i<4; i++) { |
40 | mat[index] = rowArray[i][j]; | 40 | mat[index] = rowArray[i][j]; |
41 | index++; | 41 | index++; |
42 | } | 42 | } |
43 | } | 43 | } |
44 | 44 | ||
45 | return mat; | 45 | return mat; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | Matrix.I = function(dimen) { | 48 | Matrix.I = function(dimen) { |
49 | var mat = []; | 49 | var mat = []; |
50 | 50 | ||
51 | for (var i = 0; i<dimen*dimen; i++) { | 51 | for (var i = 0; i<dimen*dimen; i++) { |
52 | mat.push(0); | 52 | mat.push(0); |
53 | } | 53 | } |
54 | 54 | ||
55 | var index = 0; | 55 | var index = 0; |
56 | for (var j = 0; j<dimen; j++) { | 56 | for (var j = 0; j<dimen; j++) { |
57 | mat[index] = 1.0; | 57 | mat[index] = 1.0; |
58 | index += dimen + 1; | 58 | index += dimen + 1; |
59 | } | 59 | } |
60 | 60 | ||
61 | return mat; | 61 | return mat; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | Matrix.Translation = function (vec) { | 64 | Matrix.Translation = function (vec) { |
65 | var mat = Matrix.I(4); | 65 | var mat = Matrix.I(4); |
66 | glmat4.translate(mat, vec); | 66 | glmat4.translate(mat, vec); |
67 | return mat; | 67 | return mat; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | Matrix.RotationX = function( angle ) { | 70 | Matrix.RotationX = function( angle ) { |
71 | var mat = Matrix.I(4); | 71 | var mat = Matrix.I(4); |
72 | glmat4.rotateX(mat, angle); | 72 | glmat4.rotateX(mat, angle); |
73 | return mat; | 73 | return mat; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | Matrix.RotationY = function( angle ) { | 76 | Matrix.RotationY = function( angle ) { |
77 | var mat = Matrix.I(4); | 77 | var mat = Matrix.I(4); |
78 | glmat4.rotateY(mat, angle); | 78 | glmat4.rotateY(mat, angle); |
79 | return mat; | 79 | return mat; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | Matrix.RotationZ = function( angle ) { | 82 | Matrix.RotationZ = function( angle ) { |
83 | var mat = Matrix.I(4); | 83 | var mat = Matrix.I(4); |
84 | glmat4.rotateZ(mat, angle); | 84 | glmat4.rotateZ(mat, angle); |
85 | return mat; | 85 | return mat; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | Matrix.Rotation = function(angle, axis) { | 88 | Matrix.Rotation = function(angle, axis) { |
@@ -94,8 +94,8 @@ Matrix.Rotation = function(angle, axis) { | |||
94 | Matrix.Scale = function( scaleVec ) { | 94 | Matrix.Scale = function( scaleVec ) { |
95 | var mat = Matrix.I(4); | 95 | var mat = Matrix.I(4); |
96 | mat[ 0] = scaleVec[0]; | 96 | mat[ 0] = scaleVec[0]; |
97 | mat[ 5] = scaleVec[1]; | 97 | mat[ 5] = scaleVec[1]; |
98 | mat[10] = scaleVec[2]; | 98 | mat[10] = scaleVec[2]; |
99 | 99 | ||
100 | return mat; | 100 | return mat; |
101 | }; | 101 | }; |
@@ -106,7 +106,7 @@ Matrix.flatten = function (mat) { | |||
106 | return []; | 106 | return []; |
107 | } | 107 | } |
108 | 108 | ||
109 | for (var i=0; i<16; i++) { | 109 | for (var i=0; i<16; i++) { |
110 | result.push(mat[i]); | 110 | result.push(mat[i]); |
111 | } | 111 | } |
112 | 112 | ||