diff options
author | hwc487 | 2012-04-06 05:18:48 -0700 |
---|---|---|
committer | hwc487 | 2012-04-06 05:18:48 -0700 |
commit | 416ce9d4954e0a7f4ee7b9afe43bf691fdb276f4 (patch) | |
tree | fbf073f1f371f90e76a36619cb44136c8de83b37 /js/lib/drawing | |
parent | b6a8f72f670a8edee35554a4ca3a0618c526d651 (diff) | |
download | ninja-416ce9d4954e0a7f4ee7b9afe43bf691fdb276f4.tar.gz |
texture notifications
Diffstat (limited to 'js/lib/drawing')
-rwxr-xr-x | js/lib/drawing/world.js | 26 |
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 | |||
832 | World.prototype.findTransformNodeByMaterial = function( materialNode, trNode ) { | 832 | World.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 | ||
929 | World.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 | |||
929 | World.prototype.import = function( importStr ) { | 952 | World.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 |