diff options
Diffstat (limited to 'js/lib/rdge/texture.js')
-rw-r--r-- | js/lib/rdge/texture.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/js/lib/rdge/texture.js b/js/lib/rdge/texture.js index d2f66efa..f1448195 100644 --- a/js/lib/rdge/texture.js +++ b/js/lib/rdge/texture.js | |||
@@ -6,6 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | var Material = require("js/lib/rdge/materials/material").Material; | 7 | var Material = require("js/lib/rdge/materials/material").Material; |
8 | 8 | ||
9 | var __textureCounter = 0; | ||
10 | |||
9 | /////////////////////////////////////////////////////////////////////// | 11 | /////////////////////////////////////////////////////////////////////// |
10 | // Class GLTexture | 12 | // Class GLTexture |
11 | // GL representation of a texture. | 13 | // GL representation of a texture. |
@@ -38,6 +40,9 @@ function Texture( dstWorld, texMapName, wrap, mips ) | |||
38 | // the destination world that will use the texture map | 40 | // the destination world that will use the texture map |
39 | this._dstWorld = dstWorld; | 41 | this._dstWorld = dstWorld; |
40 | 42 | ||
43 | this._texCount = __textureCounter; | ||
44 | __textureCounter++; | ||
45 | |||
41 | /////////////////////////////////////////////////////////////////////// | 46 | /////////////////////////////////////////////////////////////////////// |
42 | // Property Accessors | 47 | // Property Accessors |
43 | /////////////////////////////////////////////////////////////////////// | 48 | /////////////////////////////////////////////////////////////////////// |
@@ -89,7 +94,8 @@ function Texture( dstWorld, texMapName, wrap, mips ) | |||
89 | console.log( "texture callback, type: " + type ); | 94 | console.log( "texture callback, type: " + type ); |
90 | if (calleeData.srcWorld) | 95 | if (calleeData.srcWorld) |
91 | { | 96 | { |
92 | var srcWorld = calleeData.srcWorld; | 97 | var srcWorld = callbackObj.getSrcWorld(); |
98 | var dstWorld = callbackObj.getDstWorld(); | ||
93 | var notifier = srcWorld._notifier; | 99 | var notifier = srcWorld._notifier; |
94 | var texture = this.callbackObj; | 100 | var texture = this.callbackObj; |
95 | if (texture) | 101 | if (texture) |
@@ -103,9 +109,20 @@ function Texture( dstWorld, texMapName, wrap, mips ) | |||
103 | break; | 109 | break; |
104 | 110 | ||
105 | case notifier.OBJECT_CHANGE: | 111 | case notifier.OBJECT_CHANGE: |
106 | if (!texture.isAnimated()) | 112 | // this._isAnimated = srcWorld._hasAnimatedMaterials; |
107 | texture.rerender(); | 113 | // if (!srcWorld.hasAnimatedMaterials()) |
108 | texture.getDstWorld().restartRenderLoop(); | 114 | // srcWorld.restartRenderLoop(); |
115 | // else if (!dstWorld.hasAnimatedMaterials()) | ||
116 | // { | ||
117 | // dstWorld.refreshTextures(); | ||
118 | // dstWorld.restartRenderLoop(); | ||
119 | // } | ||
120 | break; | ||
121 | |||
122 | case notifier.FIRST_RENDER: | ||
123 | texture._isAnimated = srcWorld.hasAnimatedMaterials(); | ||
124 | dstWorld.refreshTextures(); | ||
125 | dstWorld.restartRenderLoop(); | ||
109 | break; | 126 | break; |
110 | 127 | ||
111 | default: | 128 | default: |