aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge')
-rw-r--r--js/lib/rdge/texture.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/js/lib/rdge/texture.js b/js/lib/rdge/texture.js
index d67c65d2..83509f80 100644
--- a/js/lib/rdge/texture.js
+++ b/js/lib/rdge/texture.js
@@ -69,7 +69,7 @@ function Texture( dstWorld, texMapName, wrap, mips )
69 this._srcWorld = srcCanvas.elementModel.shapeModel.GLWorld; 69 this._srcWorld = srcCanvas.elementModel.shapeModel.GLWorld;
70 70
71 // add a notifier to the world 71 // add a notifier to the world
72 this._srcWorld.addListener( this, this.worldCallback, { myObj: 'anything' } ); 72 this._srcWorld.addListener( this, this.worldCallback, { srcWorld: this._srcWorld } );
73 73
74 // check if the source is animated 74 // check if the source is animated
75 if (srcCanvas.elementModel && srcCanvas.elementModel.shapeModel && srcCanvas.elementModel.shapeModel.GLWorld) 75 if (srcCanvas.elementModel && srcCanvas.elementModel.shapeModel && srcCanvas.elementModel.shapeModel.GLWorld)
@@ -87,6 +87,33 @@ function Texture( dstWorld, texMapName, wrap, mips )
87 this.worldCallback = function( type, callbackObj, calleeData, callerData ) 87 this.worldCallback = function( type, callbackObj, calleeData, callerData )
88 { 88 {
89 console.log( "texture callback, type: " + type ); 89 console.log( "texture callback, type: " + type );
90 if (calleeData.srcWorld)
91 {
92 var srcWorld = calleeData.srcWorld;
93 var notifier = srcWorld._notifier;
94 var texture = this.callbackObj;
95 if (texture)
96 {
97 switch (type)
98 {
99 case notifier.OBJECT_DELETE:
100 break;
101
102 case notifier.OBJECT_REINSTANTIATE:
103 break;
104
105 case notifier.OBJECT_CHANGE:
106 if (!texture.isAnimated())
107 texture.rerender();
108 texture.getDstWorld().restartRenderLoop();
109 break;
110
111 default:
112 throw new Exception( "unrecognized texture callback type: " + type );
113 break;
114 }
115 }
116 }
90 } 117 }
91 118
92 this.loadFromFile = function() 119 this.loadFromFile = function()