aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/glUtils.js
diff options
context:
space:
mode:
authorJonathan Duran2012-03-06 11:38:39 -0800
committerJonathan Duran2012-03-06 11:38:39 -0800
commit342fb451bd251358068a0dcb10e9dc218b79a176 (patch)
treeaa0195d581c3934fb6dc09981506b3c070002806 /js/helper-classes/3D/glUtils.js
parent2815adfd7c19b3dff89dc3e1bda9af8d30dca8d6 (diff)
downloadninja-342fb451bd251358068a0dcb10e9dc218b79a176.tar.gz
Squashed commit of the following:
commit 1cd89d4d06e3a8f2c221628b19cf26a2c69f5d3f Author: Jose Antonio Marquez <kgq387@motorola.com> Date: Tue Mar 6 11:24:25 2012 -0800 Fixing WebGL not available bug commit 84332ab81c1b445195f1d9be8bbeae0725c8e758 Author: Valerio Virgillito <valerio@motorola.com> Date: Tue Mar 6 10:58:25 2012 -0800 Squashed commit of preload-fix into Master - Requiring all the previously pre-loaded files - RDGE, Codemirror and gl-matrix are not included via a script tag. Signed-off-by: Valerio Virgillito <valerio@motorola.com> commit 13f52cf0c74f53a919fa864f86669e8155f82961 Merge: dced508 abc04f3 Author: Valerio Virgillito <valerio@motorola.com> Date: Fri Mar 2 15:46:11 2012 -0800 Merge pull request #93 from imix23ways/Timeline Timeline: Critical bug fixes commit dced508bb19a7bcd467ff1b86b5df5bbec4be794 Merge: 0aeb400 cc772ef Author: Valerio Virgillito <valerio@motorola.com> Date: Fri Mar 2 15:45:35 2012 -0800 Merge pull request #92 from mqg734/WebGLFixes Selection Tool Fixes for elements flying off into space when they overlap commit 0aeb400070762cf01d83cf9f9ee25a5595098b7f Merge: ff0a956 aabb48a Author: Valerio Virgillito <valerio@motorola.com> Date: Fri Mar 2 14:05:21 2012 -0800 Merge pull request #94 from ericguzman/PresetsPanel Presets Panel - Fix single-click activation, and transition cut-off bug. commit cc772ef3333ed419d269a2bda7aea5b0150a7bd9 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Fri Mar 2 11:34:58 2012 -0800 Fixing flying off into space bug for translate tool too. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit abc04f3d50311ed1c21067344bc7e448686f8c5c Author: Jonathan Duran <jduran@motorola.com> Date: Fri Mar 2 11:26:25 2012 -0800 Timeline Fix timing function Signed-off-by: Jonathan Duran <jduran@motorola.com> commit aabb48a1c8d34bc968f4c6b0ffee4e31c1d5d286 Author: Eric Guzman <ericg@motorola.com> Date: Fri Mar 2 11:22:44 2012 -0800 Presets Panel - Fix single-click activation, and transition cut-off bug. Use double-click as the activation event for transition presets. Also fixed the bug when applying a style preset before the transition preset, which disabled transitions after the first one. commit f3207f39ea9d8c1c34246217a23d3a689671903d Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Fri Mar 2 11:21:29 2012 -0800 Don't draw transform handles if the stage is the target element. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 5425be91e7125c22955b4459a62412ff574e49a8 Author: Jonathan Duran <jduran@motorola.com> Date: Fri Mar 2 11:11:48 2012 -0800 Timeline: Fix for animation iteration count Add default webkit css properties to allow animations with integer iteration counts. Signed-off-by: Jonathan Duran <jduran@motorola.com> commit 1760bac1da9218315ad1bacdcf3a157495a049e8 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Fri Mar 2 10:48:41 2012 -0800 Fix for jumping issue when moving items that have any 3d on them. We can't translate 3d moves into 2d space due to perspective, so we must update the matrix3d values instead of the top-left values if items have 3d. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 2c04935f0ccb1cb7c98371fc10b43155f2d956c4 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Thu Mar 1 22:20:06 2012 -0800 Fix for elements flying off into space when moving elements that overlap. This was happening because our hit record's element and the browser's element from point did not match. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 50058746779f714ed9b0287f49e56c9f0d35593e Merge: 500426d ff0a956 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Thu Mar 1 21:49:44 2012 -0800 Merge branch 'refs/heads/ninja-internal' into WebGLFixes commit 500426dea0ca95a6b45be8ea8d132cfdb4d2c940 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Thu Mar 1 10:11:39 2012 -0800 Fixed logic error when resizing with the top-left transform handles. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit 7980d9bde2b43aa5a494ddf6f1db5c4959a57b91 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Thu Mar 1 10:04:15 2012 -0800 Re-fixing IKNinja-940 - Can't select objects when in side/top view. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> commit f04cc0146d8f7573628678613a99c270116768e4 Author: Nivesh Rajbhandari <mqg734@motorola.com> Date: Wed Feb 29 16:45:40 2012 -0800 Last-used material (instead of FlatMaterial) is applied to shape when turning on use WebGL checkbox in the PI. Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com> Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/helper-classes/3D/glUtils.js')
-rwxr-xr-xjs/helper-classes/3D/glUtils.js319
1 files changed, 0 insertions, 319 deletions
diff --git a/js/helper-classes/3D/glUtils.js b/js/helper-classes/3D/glUtils.js
deleted file mode 100755
index f6d075f8..00000000
--- a/js/helper-classes/3D/glUtils.js
+++ /dev/null
@@ -1,319 +0,0 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7// Constructor function
8function Vector() {}
9Vector.create = function(elements)
10{
11 var rtn;
12 if (elements)
13 rtn = elements.slice( 0 );
14 else
15 rtn = [];
16
17 return rtn;
18};
19
20Vector.dup = function(srcPt)
21{
22 return srcPt.slice(0);
23}
24
25
26
27function Matrix() {}
28
29Matrix.create = function( rowArray )
30{
31 var mat = Matrix.I(4);
32 var index = 0;
33 for(var j=0; j<4; j++)
34 {
35 for (var i=0; i<4; i++)
36 {
37 mat[index] = rowArray[i][j];
38 index++;
39 }
40 }
41
42 return mat;
43}
44Matrix.I = function(dimen)
45{
46 var mat = [];
47 for (var i=0; i<dimen*dimen; i++) mat.push(0);
48
49 var index = 0;
50 for (var i=0; i<dimen; i++)
51 {
52 mat[index] = 1.0;
53 index += dimen + 1;
54 }
55
56 return mat;
57}
58
59Matrix.Translation = function (vec)
60{
61 var mat = Matrix.I(4);
62 glmat4.translate(mat, vec);
63 return mat;
64}
65
66Matrix.RotationX = function( angle )
67{
68 var mat = Matrix.I(4);
69 glmat4.rotateX(mat, angle);
70 return mat;
71}
72
73Matrix.RotationY = function( angle )
74{
75 var mat = Matrix.I(4);
76 glmat4.rotateY(mat, angle);
77 return mat;
78}
79
80Matrix.RotationZ = function( angle )
81{
82 var mat = Matrix.I(4);
83 glmat4.rotateZ(mat, angle);
84 return mat;
85}
86
87Matrix.Rotation = function(angle, axis)
88{
89 var mat = Matrix.I(4);
90 glmat4.rotate(mat, angle, axis);
91 return mat;
92}
93Matrix.flatten = function (mat)
94{
95 var result = [];
96 if (this.elements.length == 0)
97 return [];
98
99 for (var i=0; i<16; i++) result.push(mat[i]);
100// for (var j = 0; j < this.elements[0].length; j++)
101// for (var i = 0; i < this.elements.length; i++)
102// result.push(this.elements[i][j]);
103
104 return result;
105}
106
107/*
108Matrix.ensure4x4 = function()
109{
110 if (this.elements.length == 4 &&
111 this.elements[0].length == 4)
112 return this;
113
114 if (this.elements.length > 4 ||
115 this.elements[0].length > 4)
116 return null;
117
118 for (var i = 0; i < this.elements.length; i++) {
119 for (var j = this.elements[i].length; j < 4; j++) {
120 if (i == j)
121 this.elements[i].push(1);
122 else
123 this.elements[i].push(0);
124 }
125 }
126
127 for (var i = this.elements.length; i < 4; i++) {
128 if (i == 0)
129 this.elements.push([1, 0, 0, 0]);
130 else if (i == 1)
131 this.elements.push([0, 1, 0, 0]);
132 else if (i == 2)
133 this.elements.push([0, 0, 1, 0]);
134 else if (i == 3)
135 this.elements.push([0, 0, 0, 1]);
136 }
137
138 return this;
139};
140
141Matrix.prototype.make3x3 = function()
142{
143 if (this.elements.length != 4 ||
144 this.elements[0].length != 4)
145 return null;
146
147 return Matrix.create([[this.elements[0][0], this.elements[0][1], this.elements[0][2]],
148 [this.elements[1][0], this.elements[1][1], this.elements[1][2]],
149 [this.elements[2][0], this.elements[2][1], this.elements[2][2]]]);
150};
151*/
152
153/*
154/////////////////////////////////////////////////////////////////////////////////////////////
155// SMatrix
156
157SMatrix.Translation = function (vec)
158{
159 var mat = SMatrix.I(4);
160 mat.elements[0][3] = vec[0];
161 mat.elements[1][3] = vec[1];
162 mat.elements[2][3] = vec[2];
163 return mat;
164}
165
166SMatrix.RotationX = function( angle )
167{
168 var mat = SMatrix.I(4);
169 mat.rotateX(angle);
170 return mat;
171}
172
173SMatrix.RotationY = function( angle )
174{
175 var mat = SMatrix.I(4);
176 mat.rotateX(angle);
177 return mat;
178}
179
180SMatrix.RotationZ = function( angle )
181{
182 var mat = SMatrix.I(4);
183 mat.rotateZ(angle);
184 return mat;
185}
186
187SMatrix.MatrixtoSMatrix = function( mat )
188{
189 var smat = SMatrix.I(4);
190 var index = 0;
191 for (var j=0; j<4; j++)
192 {
193 for (var i=0; i<4; i++)
194 {
195 smat.elements[i][j] = mat[index];
196 index++;
197 }
198 }
199
200 return smat;
201}
202
203SMatrix.MatEqSMat = function( mat, sMat )
204{
205 var index = 0;
206 for (var j=0; j<4; j++)
207 {
208 for (var i=0; i<4; i++)
209 {
210 var m = mat[index];
211 var s = smat.elements[i][j];
212 if ( MathUtils.fpCmp(m,s) != 0)
213 throw new Error( "mat != smat" );
214 index++;
215 }
216 }
217}
218
219// Matrix
220/////////////////////////////////////////////////////////////////////////////////////////////
221*/
222
223Vector.prototype.flatten = function ()
224{