diff options
author | hwc487 | 2012-02-03 15:18:45 -0800 |
---|---|---|
committer | hwc487 | 2012-02-03 15:18:45 -0800 |
commit | 3d5b5f7c5efb25b5e605d5d120b57f2dde33fd23 (patch) | |
tree | a2b2e55cf968221528408670b9da395ab2110d6d /js/helper-classes/RDGE/src/core | |
parent | 7dd20aec0a91731c2acaa0abfa66b754b6c82fe6 (diff) | |
download | ninja-3d5b5f7c5efb25b5e605d5d120b57f2dde33fd23.tar.gz |
Added a counter to the renderer that tracks the number of unloaded texture maps.
Started vertex deformations.
Diffstat (limited to 'js/helper-classes/RDGE/src/core')
-rw-r--r-- | js/helper-classes/RDGE/src/core/script/renderer.js | 13 |
1 files changed, 13 insertions, 0 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..04cb36a7 100644 --- 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"; |
@@ -379,7 +381,18 @@ _renderer = function(canvas) { | |||
379 | stateMan.RDGEInitState.loadTexture(texture); | 381 | stateMan.RDGEInitState.loadTexture(texture); |
380 | //console.log( "loaded texture: " + texture.lookUpName ); | 382 | //console.log( "loaded texture: " + texture.lookUpName ); |
381 | if (texture.callback) texture.callback( texture ); | 383 | if (texture.callback) texture.callback( texture ); |
384 | this.context.renderer.unloadedTextureCount--; | ||
385 | if (this.context.renderer.unloadedTextureCount < 0) | ||
386 | console.log( "more textures loaded then created..." ); | ||
382 | }; | 387 | }; |
388 | texture.image.onerror = function() { | ||
389 | this.context.renderer.unloadedTextureCount--; | ||
390 | if (texture.callback) texture.callback( texture ); | ||
391 | console.log( "Error loading texture: " + texture.image.src ); | ||
392 | if (this.context.renderer.unloadedTextureCount < 0) | ||
393 | console.log( "more textures loaded then created..." ); | ||
394 | } | ||
395 | |||
383 | } | 396 | } |
384 | return texture; | 397 | return texture; |
385 | } | 398 | } |