diff options
Diffstat (limited to 'js/lib/rdge/materials')
-rwxr-xr-x | js/lib/rdge/materials/material.js | 7 | ||||
-rw-r--r-- | js/lib/rdge/materials/pulse-material.js | 14 | ||||
-rwxr-xr-x | js/lib/rdge/materials/uber-material.js | 24 |
3 files changed, 45 insertions, 0 deletions
diff --git a/js/lib/rdge/materials/material.js b/js/lib/rdge/materials/material.js index a81ca18f..bc4c8e6b 100755 --- a/js/lib/rdge/materials/material.js +++ b/js/lib/rdge/materials/material.js | |||
@@ -257,6 +257,13 @@ var Material = function GLMaterial( world ) { | |||
257 | return tex; | 257 | return tex; |
258 | }; | 258 | }; |
259 | 259 | ||
260 | this.updateTextures = function() | ||
261 | { | ||
262 | // this function is called whenever a world that generates textuers for | ||
263 | // the current world changes in some way. Sub-classes with textures | ||
264 | // should override this function. | ||
265 | } | ||
266 | |||
260 | this.export = function() { | 267 | this.export = function() { |
261 | // this function should be overridden by subclasses | 268 | // this function should be overridden by subclasses |
262 | var exportStr = "material: " + this.getShaderName() + "\n" + "endMaterial\n"; | 269 | var exportStr = "material: " + this.getShaderName() + "\n" + "endMaterial\n"; |
diff --git a/js/lib/rdge/materials/pulse-material.js b/js/lib/rdge/materials/pulse-material.js index 276f7de6..0a7a5dd8 100644 --- a/js/lib/rdge/materials/pulse-material.js +++ b/js/lib/rdge/materials/pulse-material.js | |||
@@ -150,6 +150,20 @@ var PulseMaterial = function PulseMaterial() | |||
150 | } | 150 | } |
151 | }; | 151 | }; |
152 | 152 | ||
153 | |||
154 | this.updateTextures = function() | ||
155 | { | ||
156 | if (this._glTex) | ||
157 | { | ||
158 | if (!this._glTex.isAnimated()) | ||
159 | { | ||
160 | this._glTex.rerender(); | ||
161 | this.updateTexture(); | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | |||
166 | |||
153 | this.update = function( time ) | 167 | this.update = function( time ) |
154 | { | 168 | { |
155 | var material = this._materialNode; | 169 | var material = this._materialNode; |
diff --git a/js/lib/rdge/materials/uber-material.js b/js/lib/rdge/materials/uber-material.js index ca244629..71354216 100755 --- a/js/lib/rdge/materials/uber-material.js +++ b/js/lib/rdge/materials/uber-material.js | |||
@@ -286,6 +286,30 @@ var UberMaterial = function UberMaterial() { | |||
286 | } | 286 | } |
287 | }; | 287 | }; |
288 | 288 | ||
289 | |||
290 | this.updateTextures = function() | ||
291 | { | ||
292 | var material = this._materialNode; | ||
293 | if (material) | ||
294 | { | ||
295 | var technique = material.shaderProgram.defaultTechnique; | ||
296 | var renderer = g_Engine.getContext().renderer; | ||
297 | if (renderer && technique) | ||
298 | { | ||
299 | if (this._diffuseTexture) | ||
300 | { | ||
301 | if (!this._diffuseTexture.isAnimated()) | ||
302 | { | ||
303 | this._diffuseTexture.rerender(); | ||
304 | var tex = this._diffuseTexture.getTexture(); | ||
305 | technique.s_diffuseMap.set( tex ); | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | |||
312 | |||
289 | this.updateSpecularMap = function() { | 313 | this.updateSpecularMap = function() { |
290 | var value = this._propValues[ "specularMap" ]; | 314 | var value = this._propValues[ "specularMap" ]; |
291 | this._specularMapOb.texture = value; | 315 | this._specularMapOb.texture = value; |