aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose Antonio Marquez Russo2012-03-15 06:28:14 -0700
committerJose Antonio Marquez Russo2012-03-15 06:28:14 -0700
commit67748b4fb19cd5fd210ca711c98d992371c4d2d3 (patch)
treeab86675822de48f16be1000e8c137ec7189fc3e4 /js
parent089534a80c64226bf7d124ab9147afce386fdb5c (diff)
parent57d4a82977a1f0e809511fe894886f88581d9615 (diff)
downloadninja-67748b4fb19cd5fd210ca711c98d992371c4d2d3.tar.gz
Merge pull request #34 from ericmueller/integration
Integration
Diffstat (limited to 'js')
-rwxr-xr-xjs/document/html-document.js14
-rwxr-xr-xjs/helper-classes/3D/vec-utils.js71
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/MeshManager.js2
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/run_state.js16
-rwxr-xr-xjs/lib/geom/geom-obj.js6
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js6
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js130
7 files changed, 207 insertions, 38 deletions
<
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 051490f5..d4db6e2f 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -207,9 +207,18 @@ exports.HTMLDocument = Montage.create(TextDocument, {
207 }, 207 },
208 set: function(value) { 208 set: function(value) {
209 var elt = this.documentRoot; 209 var elt = this.documentRoot;
210 if (elt) { 210 if (elt)
211 {
211 var nWorlds= value.length; 212 var nWorlds= value.length;
212 for (var i=0; i<nWorlds; i++) { 213 for (var i=0; i<nWorlds; i++)
214 {
215 /*
216 // Use this code to test the runtime version of WebGL
217 var cdm = new CanvasDataManager();
218 cdm.loadGLData(elt, value, null );
219 */
220
221 // /*
213 var importStr = value[i]; 222 var importStr = value[i];
214 var startIndex = importStr.indexOf( "id: " ); 223 var startIndex = importStr.indexOf( "id: " );
215 if (startIndex >= 0) { 224 if (startIndex >= 0) {
@@ -236,6 +245,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
236 } 245 }
237 } 246 }
238 } 247 }
248 // */
239 } 249 }
240 } 250 }
241 } 251 }
diff --git a/js/helper-classes/3D/vec-utils.js b/js/helper-classes/3D/vec-utils.js
index 3db95ab7..e6db4a8d 100755
--- a/js/helper-classes/3D/vec-utils.js
+++ b/js/helper-classes/3D/vec-utils.js
@@ -191,5 +191,74 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype,
191 191
192 return vec; 192 return vec;
193 } 193 }
194 } 194 },
195
196 matI :
197 {
198 value: function(dimen)
199 {
200 var mat = [];
201 for (var i=0; i<dimen*dimen; i++) mat.push(0);
202
203 var index = 0;
204 for (var i=0; i<dimen; i++)
205 {
206 mat[index] = 1.0;
207 index += dimen + 1;
208 }
209
210 return mat;
211 }
212 },
213
214 matTranslation:
215 {
216 value: function (vec)
217 {
218 var mat = Matrix.I(4);
219 glmat4.translate(mat, vec);
220 return mat;
221 }
222 },
223
224 matRotationX:
225 {
226 value: function( angle )
227 {
228 var mat = Matrix.I(4);
229 glmat4.rotateX(mat, angle);
230 return mat;
231 }
232 },
233
234 matRotationY:
235 {
236 value: function( angle )
237 {
238 var mat = Matrix.I(4);
239 glmat4.rotateY(mat, angle);
240 return mat;
241 }
242 },
243
244 matRotationZ:
245 {
246 value: function( angle )
247 {
248 var mat = Matrix.I(4);
249 glmat4.rotateZ(mat, angle);
250 return mat;
251 }
252 },
253
254 matRotation:
255 {
256 value: function(angle, axis)
257 {
258 var mat = Matrix.I(4);
259 glmat4.rotate(mat, angle, axis);
260 return mat;
261 }
262 },
263
195}); \ No newline at end of file 264}); \ No newline at end of file
diff --git a/js/helper-classes/RDGE/src/core/script/MeshManager.js b/js/helper-classes/RDGE/src/core/script/MeshManager.js
index 43813078..7dfc79d4 100755
--- a/js/helper-classes/RDGE/src/core/script/MeshManager.js
+++ b/js/helper-classes/RDGE/src/core/script/MeshManager.js
@@ -69,7 +69,7 @@ MeshManager.prototype.deleteMesh = function (name)
69 if (model) 69 if (model)
70 { 70 {
71 g_Engine.ctxMan.forEach(function(context) 71 g_Engine.ctxMan.forEach(function(context)
72 { 72 {
73 context.renderer.deletePrimitive(model.primitive); 73 context.renderer.deletePrimitive(model.primitive);
74 }); 74 });
75 75
diff --git a/js/helper-classes/RDGE/src/core/script/run_state.js b/js/helper-classes/RDGE/src/core/script/run_state.js
index acdb6797..a5981caa 100755
--- a/js/helper-classes/RDGE/src/core/script/run_state.js
+++ b/js/helper-classes/RDGE/src/core/script/run_state.js
@@ -30,9 +30,9 @@ RunState.prototype.Init = function()
30 this.userRunState.init(); 30 this.userRunState.init();
31 } 31 }
32 32
33 if (this.hasUserState && this.userRunState && this.userRunState.onRunState) 33 if (this.hasUserState && this.userRunState && this.userRunState.onRunState)
34 this.userRunState.onRunState(); 34 this.userRunState.onRunState();
35 35
36 36
37 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
38 38
@@ -97,11 +97,11 @@ RunState.prototype.ReInit = function()
97 if(!this.initialized) 97 if(!this.initialized)
98 { 98 {
99 this.Init(); 99 this.Init();
100 } 100 }
101 else 101 else
102 { 102 {
103 if (this.hasUserState && this.userRunState && this.userRunState.onRunState) 103 if (this.hasUserState && this.userRunState && this.userRunState.onRunState)
104 this.userRunState.onRunState(); 104 this.userRunState.onRunState();
105 } 105 }
106} 106}
107 107
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js
index f285f24a..a64980e0 100755
--- a/js/lib/geom/geom-obj.js
+++ b/js/lib/geom/geom-obj.js
@@ -325,9 +325,11 @@ var GeomObj = function GLGeomObj() {
325 if (mat) 325 if (mat)
326 mat.import( importStr ); 326 mat.import( importStr );
327 327
328 var endIndex = importStr.indexOf( "endMaterial\n" ); 328 // pull off the end of the material
329 var endMat = "endMaterial\n";
330 var endIndex = importStr.indexOf( endMat );
329 if (endIndex < 0) break; 331 if (endIndex < 0) break;
330 importStr = importStr.substr( endIndex ); 332 importStr = importStr.substr( endIndex + endMat.length );
331 } 333 }
332 } 334 }
333 335
diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js
index 97e4f646..fff0e68e 100755
--- a/js/lib/rdge/materials/flat-material.js
+++ b/js/lib/rdge/materials/flat-material.js
@@ -102,13 +102,7 @@ var FlatMaterial = function FlatMaterial() {
102 try 102 try
103 { 103 {
104 var color = eval( "[" + pu.nextValue( "color: " ) + "]" ); 104 var color = eval( "[" + pu.nextValue( "color: " ) + "]" );
105
106 this.setProperty( "color", color); 105 this.setProperty( "color", color);
107
108 var endKey = "endMaterial\n";
109 var index = importStr.indexOf( endKey );
110 index += endKey.length;
111 rtnStr = importStr.substr( index );
112 } 106 }
113 catch (e) 107 catch (e)
114 { 108 {
diff --git a/js/lib/rdge/materials/uber-material.js b/js/lib/rdge/materials/uber-material.js
index 655d8e2a..91f43754 100755
--- a/js/lib/rdge/materials/uber-material.js
+++ b/js/lib/rdge/materials/uber-material.js
@@ -4,6 +4,7 @@
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */ 5 </copyright> */
6 6
7var MaterialParser = require("js/lib/rdge/materials/material-parser").MaterialParser;
7var Material = require("js/lib/rdge/materials/material").Material; 8var Material = require("js/lib/rdge/materials/material").Material;
8 9
9var UberMaterial = function UberMaterial() { 10var UberMaterial = function UberMaterial() {
@@ -375,19 +376,111 @@ var UberMaterial = function UberMaterial() {
375 var endKey = "endMaterial\n"; 376 var endKey = "endMaterial\n";