aboutsummaryrefslogtreecommitdiff
path: root/js/lib/drawing
diff options
context:
space:
mode:
authorhwc4872012-04-06 05:18:48 -0700
committerhwc4872012-04-06 05:18:48 -0700
commit416ce9d4954e0a7f4ee7b9afe43bf691fdb276f4 (patch)
treefbf073f1f371f90e76a36619cb44136c8de83b37 /js/lib/drawing
parentb6a8f72f670a8edee35554a4ca3a0618c526d651 (diff)
downloadninja-416ce9d4954e0a7f4ee7b9afe43bf691fdb276f4.tar.gz
texture notifications
Diffstat (limited to 'js/lib/drawing')
-rwxr-xr-xjs/lib/drawing/world.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 402563e9..da8a26ad 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -239,6 +239,7 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
239 this.myScene.render(); 239 this.myScene.render();
240 240
241 if (this._firstRender) { 241 if (this._firstRender) {
242 this._notifier.sendNotification( this._notifier.FIRST_RENDER );
242 if (this._canvas.task) { 243 if (this._canvas.task) {
243 this._firstRender = false; 244 this._firstRender = false;
244 245
@@ -828,7 +829,6 @@ World.prototype.exportObjectsJSON = function( obj, parentObj )
828} 829}
829 830
830 831
831
832World.prototype.findTransformNodeByMaterial = function( materialNode, trNode ) { 832World.prototype.findTransformNodeByMaterial = function( materialNode, trNode ) {
833 //if (trNode == null) trNode = this._ctrNode; 833 //if (trNode == null) trNode = this._ctrNode;
834 if (trNode == null) trNode = this._rootNode; 834 if (trNode == null) trNode = this._rootNode;
@@ -926,6 +926,29 @@ World.prototype.importObjectJSON = function( jObj, parentGeomObj )
926 return obj; 926 return obj;
927}; 927};
928 928
929World.prototype.refreshTextures = function( obj )
930{
931 if (obj == null) obj = this._geomRoot;
932 if (!obj) return;
933 if (obj._materialArray)
934 {
935 var nMats = obj._materialArray.length;
936 for (var i=0; i<nMats; i++)
937 {
938 var mat = obj._materialArray[i];
939 if (mat)
940 mat.updateTextures();
941 }
942 }
943
944 if (obj.getChild()) {
945 this.refreshTextures( obj.getChild () );
946 }
947
948 if (obj.getNext())
949 this.refreshTextures( obj.getNext() );
950};
951
929World.prototype.import = function( importStr ) { 952World.prototype.import = function( importStr ) {
930 // import the worldattributes - not currently used 953 // import the worldattributes - not currently used
931 954
@@ -1054,6 +1077,7 @@ function Notifier()
1054 this.OBJECT_DELETE = 1; 1077 this.OBJECT_DELETE = 1;
1055 this.OBJECT_REINSTANTIATE = 2; // the object has come back after a deletion - as in undo 1078 this.OBJECT_REINSTANTIATE = 2; // the object has come back after a deletion - as in undo
1056 this.OBJECT_CHANGE = 3; 1079 this.OBJECT_CHANGE = 3;
1080 this.FIRST_RENDER = 4;
1057 1081
1058 1082
1059 // the array of listener objects 1083 // the array of listener objects