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/helper-classes/RDGE/src/core/script/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/helper-classes/RDGE/src/core/script/math')
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/math/mat4.js | 1538 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/math/quat.js | 500 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/math/vec2.js | 432 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/math/vec3.js | 748 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/math/vec4.js | 566 |
5 files changed, 1892 insertions, 1892 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/math/mat4.js b/js/helper-classes/RDGE/src/core/script/math/mat4.js index 32c7111c..d4d8e89d 100755 --- a/js/helper-classes/RDGE/src/core/script/math/mat4.js +++ b/js/helper-classes/RDGE/src/core/script/math/mat4.js | |||
@@ -1,769 +1,769 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility, Inc |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | 4 | BSD License. |
5 | 5 | ||
6 | Redistribution and use in source and binary forms, with or without | 6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met: | 7 | modification, are permitted provided that the following conditions are met: |
8 | 8 | ||
9 | - Redistributions of source code must retain the above copyright notice, | 9 | - Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. | 10 | this list of conditions and the following disclaimer. |
11 | - Redistributions in binary form must reproduce the above copyright | 11 | - Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the | 12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. | 13 | documentation and/or other materials provided with the distribution. |
14 | - Neither the name of Motorola Mobility nor the names of its contributors | 14 | - Neither the name of Motorola Mobility nor the names of its contributors |
15 | may be used to endorse or promote products derived from this software | 15 | may be used to endorse or promote products derived from this software |
16 | without specific prior written permission. | 16 | without specific prior written permission. |
17 | 17 | ||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | POSSIBILITY OF SUCH DAMAGE. | 28 | POSSIBILITY OF SUCH DAMAGE. |
29 | </copyright> */ | 29 | </copyright> */ |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * This library contains functions for operating on 4x4 matrices. Any JS array | 32 | * This library contains functions for operating on 4x4 matrices. Any JS array |
33 | * containing at least 16 numeric components can represent a 4x4 matrix. | 33 | * containing at least 16 numeric components can represent a 4x4 matrix. |
34 | * | 34 | * |
35 | * For example, all of these are valid matrix construction methods: | 35 | * For example, all of these are valid matrix construction methods: |
36 | * ... | 36 | * ... |
37 | * var a = mat4.identity(); | 37 | * var a = mat4.identity(); |
38 | * var b = mat4.perspective(90, aspectRatio, 0.1, 100.00); | 38 | * var b = mat4.perspective(90, aspectRatio, 0.1, 100.00); |
39 | * var c = mat4.lookAt( [0, 0, 0], [1, 0, 0], [ 0, 1, 0 ] ); | 39 | * var c = mat4.lookAt( [0, 0, 0], [1, 0, 0], [ 0, 1, 0 ] ); |
40 | * var d = mat4.basis( [1, 0, 0], [0, 1, 0], [ 0, 0, 1 ] ); | 40 | * var d = mat4.basis( [1, 0, 0], [0, 1, 0], [ 0, 0, 1 ] ); |
41 | * | 41 | * |
42 | * This library is implemented assuming components are arranged | 42 | * This library is implemented assuming components are arranged |
43 | * contiguously in memory as such: | 43 | * contiguously in memory as such: |
44 | * M = [ x0, x1, x2, x3, | 44 | * M = [ x0, x1, x2, x3, |
45 | * y0, y1, y2, y3, | 45 | * y0, y1, y2, y3, |
46 | * z0, z1, z2, z3, | 46 | * z0, z1, z2, z3, |
47 | * w0, w1, w2, w3 ]; | 47 | * w0, w1, w2, w3 ]; |
48 | * The translation components of a transformation matrix would be stored in | 48 | * The translation components of a transformation matrix would be stored in |
49 | * w0, w1, w2, or at indices 12, 13, and 14 of the array, as is consistent | 49 | * w0, w1, w2, or at indices 12, 13, and 14 of the array, as is consistent |
50 | * with OpenGL. | 50 | * with OpenGL. |
51 | */ | 51 | */ |
52 | // RDGE namespaces | 52 | // RDGE namespaces |
53 | var RDGE = RDGE || {}; | 53 | var RDGE = RDGE || {}; |
54 | RDGE.mat4 = {}; | 54 | RDGE.mat4 = {}; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * RDGE.mat4.string | 57 | * RDGE.mat4.string |
58 | */ | 58 | */ |
59 | RDGE.mat4.string = function (m) { | 59 | RDGE.mat4.string = function (m) { |
60 | var out = "{ "; | 60 | var out = "{ "; |
61 | out += m[0] + ", " + m[1] + ", " + m[2] + ", " + m[3] + ", "; | 61 | out += m[0] + ", " + m[1] + ", " + m[2] + ", " + m[3] + ", "; |
62 | out += m[4] + ", " + m[5] + ", " + m[6] + ", " + m[7] + ", "; | 62 | out += m[4] + ", " + m[5] + ", " + m[6] + ", " + m[7] + ", "; |
63 | out += m[8] + ", " + m[9] + ", " + m[10] + ", " + m[11] + ", "; | 63 | out += m[8] + ", " + m[9] + ", " + m[10] + ", " + m[11] + ", "; |
64 | out += m[12] + ", " + m[13] + ", " + m[14] + ", " + m[15] + " }"; | 64 | out += m[12] + ", " + m[13] + ", " + m[14] + ", " + m[15] + " }"; |
65 | return out; | 65 | return out; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | RDGE.mat4.toCSSString = function (m, conversionConstant) { | 68 | RDGE.mat4.toCSSString = function (m, conversionConstant) { |
69 | var cc = 10.0; | 69 | var cc = 10.0; |
70 | 70 | ||
71 | if (conversionConstant) | 71 | if (conversionConstant) |
72 | cc = conversionConstant; | 72 | cc = conversionConstant; |
73 | 73 | ||
74 | var out = "matrix3d("; | 74 | var out = "matrix3d("; |
75 | out += m[0].toFixed(10) + ", " + m[1].toFixed(10) + ", " + m[2].toFixed(10) + ", " + m[3].toFixed(10) + ", "; | 75 | out += m[0].toFixed(10) + ", " + m[1].toFixed(10) + ", " + m[2].toFixed(10) + ", " + m[3].toFixed(10) + ", "; |
76 | out += m[4].toFixed(10) + ", " + m[5].toFixed(10) + ", " + m[6].toFixed(10) + ", " + m[7].toFixed(10) + ", "; | 76 | out += m[4].toFixed(10) + ", " + m[5].toFixed(10) + ", " + m[6].toFixed(10) + ", " + m[7].toFixed(10) + ", "; |
77 | out += m[8].toFixed(10) + ", " + m[9].toFixed(10) + ", " + m[10].toFixed(10) + ", " + m[11].toFixed(10) + ", "; | 77 | out += m[8].toFixed(10) + ", " + m[9].toFixed(10) + ", " + m[10].toFixed(10) + ", " + m[11].toFixed(10) + ", "; |
78 | out += m[12].toFixed(10) * cc + ", " + (600 - m[13].toFixed(10) * cc) + ", " + m[14].toFixed(10) * cc + ", " + m[15].toFixed(10) + ")"; | 78 | out += m[12].toFixed(10) * cc + ", " + (600 - m[13].toFixed(10) * cc) + ", " + m[14].toFixed(10) * cc + ", " + m[15].toFixed(10) + ")"; |
79 | return out; | 79 | return out; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | /** | 82 | /** |
83 | * RDGE.mat4.verify | 83 | * RDGE.mat4.verify |
84 | * This function is provided for debugging purposes only. It is not recommended | 84 | * This function is provided for debugging purposes only. It is not recommended |
85 | * to be used in performance critical areas of the code. | 85 | * to be used in performance critical areas of the code. |
86 | */ | 86 | */ |
87 | RDGE.mat4.verify = function (m) { | 87 | RDGE.mat4.verify = function (m) { |
88 | if (m == undefined || m.length == undefined || m.length < 16) { | 88 | if (m == undefined || m.length == undefined || m.length < 16) { |
89 | return false; | 89 | return false; |
90 | } | 90 | } |
91 | var i = 16; | 91 | var i = 16; |
92 | while (i--) { | 92 | while (i--) { |
93 | if (typeof (m[i]) != "number") { | 93 | if (typeof (m[i]) != "number") { |
94 | return false; | 94 | return false; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | return true; | 97 | return true; |
98 | }; | 98 | }; |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * RDGE.mat4.copy | 101 | * RDGE.mat4.copy |
102 | */ | 102 | */ |
103 | RDGE.mat4.copy = function (m) { | 103 | RDGE.mat4.copy = function (m) { |
104 | return [m[0], m[1], m[2], m[3], | 104 | return [m[0], m[1], m[2], m[3], |
105 | m[4], m[5], m[6], m[7], | 105 | m[4], m[5], m[6], m[7], |
106 | m[8], m[9], m[10], m[11], | 106 | m[8], m[9], m[10], m[11], |
107 | m[12], m[13], m[14], m[15]]; | 107 | m[12], m[13], m[14], m[15]]; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * RDGE.mat4.inplace_copy | 111 | * RDGE.mat4.inplace_copy |
112 | */ | 112 | */ |
113 | RDGE.mat4.inplace_copy = function (dst, src) { | 113 | RDGE.mat4.inplace_copy = function (dst, src) { |
114 | dst[0] = src[0]; | 114 | dst[0] = src[0]; |
115 | dst[1] = src[1]; | 115 | dst[1] = src[1]; |
116 | dst[2] = src[2]; |