diff options
Diffstat (limited to 'js/lib/rdge/materials/material.js')
-rwxr-xr-x | js/lib/rdge/materials/material.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/js/lib/rdge/materials/material.js b/js/lib/rdge/materials/material.js index c1d13b15..157fa7db 100755 --- a/js/lib/rdge/materials/material.js +++ b/js/lib/rdge/materials/material.js | |||
@@ -252,6 +252,29 @@ var Material = function GLMaterial( world ) { | |||
252 | return tex; | 252 | return tex; |
253 | }; | 253 | }; |
254 | 254 | ||
255 | this.findWorld = function( id, elt ) | ||
256 | { | ||
257 | if (elt.id && elt.id === id) | ||
258 | { | ||
259 | if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld) | ||
260 | { | ||
261 | var world = elt.elementModel.shapeModel.GLWorld; | ||
262 | return world; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | if (elt.children) | ||
267 | { | ||
268 | var nKids = elt.children.length; | ||
269 | for (var i=0; i<nKids; i++) | ||
270 | { | ||
271 | var child = elt.children[i]; | ||
272 | var world = this.findWorld( id, child ); | ||
273 | if (world) return world; | ||
274 | } | ||
275 | } | ||
276 | } | ||
277 | |||
255 | this.export = function() { | 278 | this.export = function() { |
256 | // this function should be overridden by subclasses | 279 | // this function should be overridden by subclasses |
257 | var exportStr = "material: " + this.getShaderName() + "\n" + "endMaterial\n"; | 280 | var exportStr = "material: " + this.getShaderName() + "\n" + "endMaterial\n"; |