aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-11 22:37:34 -0800
committerJose Antonio Marquez2012-02-11 22:37:34 -0800
commit9f2356c48b831d32d7278648656fe44b98bc4a1f (patch)
tree58459a2e2e45ff2f4ffa9042740040ee17d91dfb /js/helper-classes/RDGE/src/core
parent5eb38b8bd779c7fb6e59b966135f8d306378f034 (diff)
parente142611e22718b1f1d1696902ad9161ec5f33f98 (diff)
downloadninja-9f2356c48b831d32d7278648656fe44b98bc4a1f.tar.gz
Merge branch 'refs/heads/NinjaInternal' into FileIO
Conflicts: js/ninja.reel/ninja.html
Diffstat (limited to 'js/helper-classes/RDGE/src/core')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderer.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/renderer.js b/js/helper-classes/RDGE/src/core/script/renderer.js
index 517947df..a50b8a68 100755
--- a/js/helper-classes/RDGE/src/core/script/renderer.js
+++ b/js/helper-classes/RDGE/src/core/script/renderer.js
@@ -359,9 +359,11 @@ _renderer = function(canvas) {
359 * @param wrap - optional "CLAMP or "REPEAT", default is clamp 359 * @param wrap - optional "CLAMP or "REPEAT", default is clamp
360 * @param mips - optional true/false value to create mipmaps, the default is true 360 * @param mips - optional true/false value to create mipmaps, the default is true
361 */ 361 */
362 this.unloadedTextureCount = 0;
362 _texparams = function(wrap, mips) { this.wrap = wrap, this.mips = mips }; 363 _texparams = function(wrap, mips) { this.wrap = wrap, this.mips = mips };
363 this.createTexture = function(url, wrap, mips) { 364 this.createTexture = function(url, wrap, mips) {
364 var texture = this.ctx.createTexture(); 365 var texture = this.ctx.createTexture();
366 this.unloadedTextureCount++;
365 367
366 if (wrap === undefined) 368 if (wrap === undefined)
367 wrap = "CLAMP"; 369 wrap = "CLAMP";
@@ -369,7 +371,6 @@ _renderer = function(canvas) {
369 mips = true; 371 mips = true;
370 372
371 if (texture) { 373 if (texture) {
372 //console.log( "createTexture: " + url );
373 texture.image = new Image(); 374 texture.image = new Image();
374 texture.image.src = url; 375 texture.image.src = url;
375 texture.image.context = g_Engine.getContext(); 376 texture.image.context = g_Engine.getContext();
@@ -377,9 +378,20 @@ _renderer = function(canvas) {
377 texture.image.onload = function() { 378 texture.image.onload = function() {
378 var stateMan = this.context.ctxStateManager; 379 var stateMan = this.context.ctxStateManager;
379 stateMan.RDGEInitState.loadTexture(texture); 380 stateMan.RDGEInitState.loadTexture(texture);
380 //console.log( "loaded texture: " + texture.lookUpName ); 381 this.context.renderer.unloadedTextureCount--;
382 //console.log( "loaded texture: " + texture.lookUpName + ",to: " + this.context.renderer._world._worldCount + ", textures remaining to load: " + this.context.renderer.unloadedTextureCount );
381 if (texture.callback) texture.callback( texture ); 383 if (texture.callback) texture.callback( texture );
384 if (this.context.renderer.unloadedTextureCount < 0)
385 console.log( "more textures loaded then created..." );
382 }; 386 };
387 texture.image.onerror = function() {
388 this.context.renderer.unloadedTextureCount--;
389 if (texture.callback) texture.callback( texture );
390 //console.log( "Error loading texture: " + texture.image.src );
391 if (this.context.renderer.unloadedTextureCount < 0)
392 console.log( "more textures loaded then created..." );
393 }
394
383 } 395 }
384 return texture; 396 return texture;
385 } 397 }
@@ -552,8 +564,10 @@ _renderer = function(canvas) {
552 */ 564 */
553rdgeDefaultShaderDefintion = { 565rdgeDefaultShaderDefintion = {
554 'shaders': { 566 'shaders': {
555 'defaultVShader':"assets/shaders/test_vshader.glsl", 567 //'defaultVShader':"assets/shaders/test_vshader.glsl",
556 'defaultFShader':"assets/shaders/test_fshader.glsl" 568 //'defaultFShader':"assets/shaders/test_fshader.glsl"
569 'defaultVShader':"assets/shaders/Basic.vert.glsl",
570 'defaultFShader':"assets/shaders/Basic.frag.glsl"
557 }, 571 },
558 'techniques': { 572 'techniques': {
559 'defaultTechnique':[{ 573 'defaultTechnique':[{