diff options
author | hwc487 | 2012-03-26 11:31:23 -0700 |
---|---|---|
committer | hwc487 | 2012-03-26 11:31:23 -0700 |
commit | 2f66a9ab38f761b7796800bb37f8146f140db40b (patch) | |
tree | 50010b3fa2f12f811f85ea3dcdb47355e4dcf314 /js/lib/rdge/materials/material.js | |
parent | cca20db1f346fc9bf2ead64c83e479f5f5ebf2d2 (diff) | |
download | ninja-2f66a9ab38f761b7796800bb37f8146f140db40b.tar.gz |
WebGL & Canvas as data for texture maps.
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"; |