aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-23 17:06:41 -0700
committerValerio Virgillito2012-07-23 17:06:41 -0700
commita3f04ac0a68e428017dc51a1ba28c33f250adaf6 (patch)
treea1718ced92903b3638d702fef25aa25495d7f6c1 /js/helper-classes
parentfb6b9cb1f7ee29bb2e8d7178479717f650d0b7b5 (diff)
parente9d08c7af751d75af16371fcac06fd1af8a60fac (diff)
downloadninja-a3f04ac0a68e428017dc51a1ba28c33f250adaf6.tar.gz
Merge branch 'SevenDotOneCommits' of https://github.com/ericmueller/ninja
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/MeshManager.js22
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderer.js4
2 files changed, 24 insertions, 2 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/MeshManager.js b/js/helper-classes/RDGE/src/core/script/MeshManager.js
index 4ff95cc4..f0600793 100755
--- a/js/helper-classes/RDGE/src/core/script/MeshManager.js
+++ b/js/helper-classes/RDGE/src/core/script/MeshManager.js
@@ -201,11 +201,31 @@ RDGE.MeshManager.prototype.onLoaded = function (meshName) {
201}; 201};
202 202
203RDGE.MeshManager.prototype.exportJSON = function () { 203RDGE.MeshManager.prototype.exportJSON = function () {
204
204 for (var m in this.modelMap) { 205 for (var m in this.modelMap) {
205 this.modelMap[m].primitive.built = false; 206 this.modelMap[m].primitive.built = false;
206 } 207 }
207 208
208 return JSON.stringify(this.modelMap); 209 function replacer(key, value) {
210 if (key === "bufferStreams")
211 {
212 var nStreams = value.length;
213 for (iStream=0; iStream<nStreams; iStream++)
214 {
215 var arr = value[iStream];
216 var n = arr.length;
217 for (var i=0; i<n; i++)
218 {
219 var val = arr[i];
220 arr[i] = val.toFixed ? Number(val.toFixed(4)) : val;
221 }
222 }
223 }
224
225 return value;
226 }
227
228 return JSON.stringify(this.modelMap, replacer);
209}; 229};
210 230
211RDGE.MeshManager.prototype.importJSON = function (jsonMeshExport) { 231RDGE.MeshManager.prototype.importJSON = function (jsonMeshExport) {
diff --git a/js/helper-classes/RDGE/src/core/script/renderer.js b/js/helper-classes/RDGE/src/core/script/renderer.js
index 889cd62e..52158514 100755
--- a/js/helper-classes/RDGE/src/core/script/renderer.js
+++ b/js/helper-classes/RDGE/src/core/script/renderer.js
@@ -363,6 +363,8 @@ RDGE._renderer = function (canvas) {
363 if (mips === undefined) 363 if (mips === undefined)
364 mips = true; 364 mips = true;
365 365
366 //console.log( "createTexture " + url + ", unloadedCount: " + this.unloadedTextureCount + ", world " + RDGE.globals.engine.getContext().renderer._world._worldCount );
367
366 if (texture) { 368 if (texture) {
367 texture.image = new Image(); 369 texture.image = new Image();
368 texture.image.src = url; 370 texture.image.src = url;
@@ -380,7 +382,7 @@ RDGE._renderer = function (canvas) {
380 texture.image.onerror = function () { 382 texture.image.onerror = function () {
381 this.context.renderer.unloadedTextureCount--; 383 this.context.renderer.unloadedTextureCount--;
382 if (texture.callback) texture.callback(texture); 384 if (texture.callback) texture.callback(texture);
383 //console.log( "Error loading texture: " + texture.image.src ); 385 console.log( "Error loading texture: " + texture.image.src );
384 if (this.context.renderer.unloadedTextureCount < 0) 386 if (this.context.renderer.unloadedTextureCount < 0)
385 console.log("more textures loaded then created..."); 387 console.log("more textures loaded then created...");
386 }; 388 };