diff options
author | hwc487 | 2012-05-02 17:00:12 -0700 |
---|---|---|
committer | hwc487 | 2012-05-02 17:00:12 -0700 |
commit | 8eac5582b72115969a9f915f4303535c22018033 (patch) | |
tree | b9ad1621fee37eb73824dab7de062ac4ec2abf77 /js/lib/rdge/materials/cloud-material.js | |
parent | f6983a69649b1c274ce6fe2d278a325994d092b6 (diff) | |
download | ninja-8eac5582b72115969a9f915f4303535c22018033.tar.gz |
Material editor
Diffstat (limited to 'js/lib/rdge/materials/cloud-material.js')
-rw-r--r-- | js/lib/rdge/materials/cloud-material.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/js/lib/rdge/materials/cloud-material.js b/js/lib/rdge/materials/cloud-material.js index 0cf428b0..b7670178 100644 --- a/js/lib/rdge/materials/cloud-material.js +++ b/js/lib/rdge/materials/cloud-material.js | |||
@@ -183,7 +183,8 @@ var CloudMaterial = function CloudMaterial() | |||
183 | if (material) | 183 | if (material) |
184 | { | 184 | { |
185 | var technique = material.shaderProgram['default']; | 185 | var technique = material.shaderProgram['default']; |
186 | var renderer = RDGE.globals.engine.getContext().renderer; | 186 | var saveContext = RDGE.globals.engine.getContext(); |
187 | var renderer = RDGE.globals.engine.getContext().renderer; | ||
187 | if (renderer && technique) | 188 | if (renderer && technique) |
188 | { | 189 | { |
189 | var texMapName = this._propValues[this._propNames[0]]; | 190 | var texMapName = this._propValues[this._propNames[0]]; |
@@ -215,6 +216,10 @@ var CloudMaterial = function CloudMaterial() | |||
215 | } | 216 | } |
216 | } | 217 | } |
217 | 218 | ||
219 | this.updateColor = function() | ||
220 | { | ||
221 | } | ||
222 | |||
218 | this.update = function( time ) | 223 | this.update = function( time ) |
219 | { | 224 | { |
220 | if (this._srcWorld) | 225 | if (this._srcWorld) |
@@ -264,6 +269,7 @@ var CloudMaterial = function CloudMaterial() | |||
264 | this.getWorld().stop(); | 269 | this.getWorld().stop(); |
265 | 270 | ||
266 | // build a world to do the rendering | 271 | // build a world to do the rendering |
272 | if (!GLWorld) GLWorld = require("js/lib/drawing/world").World; | ||
267 | this._srcWorld = new GLWorld( this._srcCanvas, true, true ); | 273 | this._srcWorld = new GLWorld( this._srcCanvas, true, true ); |
268 | var srcWorld = this._srcWorld; | 274 | var srcWorld = this._srcWorld; |
269 | if (!this._srcCanvas) throw new Error( "No source canvas in Cloud material" ); | 275 | if (!this._srcCanvas) throw new Error( "No source canvas in Cloud material" ); |
@@ -273,13 +279,13 @@ var CloudMaterial = function CloudMaterial() | |||
273 | var prim = this.buildGeometry( srcWorld, srcCanvas.width, srcCanvas.height ); | 279 | var prim = this.buildGeometry( srcWorld, srcCanvas.width, srcCanvas.height ); |
274 | 280 | ||
275 | // set up the shader | 281 | // set up the shader |
276 | var shader = new jshader(); | 282 | var shader = new RDGE.jshader(); |
277 | shader.def = cloudMaterialDef; | 283 | shader.def = cloudMaterialDef; |
278 | shader.init(); | 284 | shader.init(); |
279 | this._srcShader = shader; | 285 | this._srcShader = shader; |
280 | 286 | ||
281 | // set up the material node | 287 | // set up the material node |
282 | var materialNode = createMaterialNode("cloudMaterial" + "_" + srcWorld.generateUniqueNodeID()); | 288 | var materialNode = RDGE.createMaterialNode("cloudMaterial" + "_" + srcWorld.generateUniqueNodeID()); |
283 | materialNode.setShader(shader); | 289 | materialNode.setShader(shader); |
284 | this._srcMaterialNode = materialNode; | 290 | this._srcMaterialNode = materialNode; |
285 | 291 | ||
@@ -322,7 +328,6 @@ var CloudMaterial = function CloudMaterial() | |||
322 | this.buildGeometry = function(world, canvasWidth, canvasHeight) | 328 | this.buildGeometry = function(world, canvasWidth, canvasHeight) |
323 | { | 329 | { |
324 | var RectangleGeometry = require("js/lib/geom/rectangle").RectangleGeometry; | 330 | var RectangleGeometry = require("js/lib/geom/rectangle").RectangleGeometry; |
325 | |||
326 | RectangleGeometry.init(); | 331 | RectangleGeometry.init(); |
327 | 332 | ||
328 | // get the normalized device coordinates (NDC) for | 333 | // get the normalized device coordinates (NDC) for |