From 1fa8516bcd0fb0277c13a7081b5a51ce041d3496 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 12 Apr 2012 06:24:46 -0700 Subject: Cloud material --- js/lib/rdge/materials/cloud-material.js | 15 ++++++++++----- js/lib/rdge/materials/flat-material.js | 2 +- js/lib/rdge/texture.js | 13 ++++++++----- 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'js/lib/rdge') diff --git a/js/lib/rdge/materials/cloud-material.js b/js/lib/rdge/materials/cloud-material.js index f253718a..cec00696 100644 --- a/js/lib/rdge/materials/cloud-material.js +++ b/js/lib/rdge/materials/cloud-material.js @@ -31,7 +31,7 @@ var CloudMaterial = function CloudMaterial() { // parameter initial values this._time = 0.0; - this._surfaceAlpha = 0.5; + this._surfaceAlpha = 1.0; this._zmin = 0.1; this._zmax = 10.0; @@ -125,6 +125,7 @@ var CloudMaterial = function CloudMaterial() { // build a world to do the rendering this._srcWorld = new GLWorld( this._srcCanvas, true ); var srcWorld = this._srcWorld; + this._srcCanvas.__GLWorld = srcWorld; // build the geometry var prim = this.buildGeometry(); @@ -174,11 +175,15 @@ var CloudMaterial = function CloudMaterial() { if (renderer && technique) { var texMapName = this._propValues[this._propNames[0]]; var wrap = 'REPEAT', mips = true; - var tex = this.loadTexture( texMapName, wrap, mips ); - - if (tex) { - technique.u_tex0.set( tex ); + //var tex = this.loadTexture( texMapName, wrap, mips ); + if (this._glTex) + { + this._glTex.render(); + var tex = this._glTex.getTexture(); + if (tex) + technique.u_tex0.set( tex ); } + } } }; diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js index 5030cc88..ddea9d9e 100755 --- a/js/lib/rdge/materials/flat-material.js +++ b/js/lib/rdge/materials/flat-material.js @@ -26,7 +26,7 @@ var FlatMaterial = function FlatMaterial() { this.getShaderName = function() { return this._shaderName; }; this.isAnimated = function() { return false; }; - this.hasVertexDeformation = function() { return true; }; + this.hasVertexDeformation = function() { return false; }; this._hasVertexDeformation = true; this._vertexDeformationTolerance = 0.2; diff --git a/js/lib/rdge/texture.js b/js/lib/rdge/texture.js index 569bc364..b85ee076 100644 --- a/js/lib/rdge/texture.js +++ b/js/lib/rdge/texture.js @@ -75,16 +75,19 @@ function Texture( dstWorld, texMapName, wrap, mips ) if (srcCanvas) { this._srcCanvas = srcCanvas; - if (srcCanvas.elementModel && srcCanvas.elementModel.shapeModel && srcCanvas.elementModel.shapeModel.GLWorld) + var srcWorld + if (srcCanvas.elementModel && srcCanvas.elementModel.shapeModel && srcCanvas.elementModel.shapeModel.GLWorld) + srcWorld = srcCanvas.elementModel.shapeModel.GLWorld; + if (!srcWorld) srcWorld = srcCanvas.__GLWorld; + if (srcWorld) { - this._srcWorld = srcCanvas.elementModel.shapeModel.GLWorld; + this._srcWorld = srcWorld; // add a notifier to the world - this._srcWorld.addListener( this, this.worldCallback, { srcWorld: this._srcWorld } ); + srcWorld.addListener( this, this.worldCallback, { srcWorld: this._srcWorld } ); // check if the source is animated - if (srcCanvas.elementModel && srcCanvas.elementModel.shapeModel && srcCanvas.elementModel.shapeModel.GLWorld) - this._isAnimated = this._srcWorld._hasAnimatedMaterials; + this._isAnimated = srcWorld._hasAnimatedMaterials; } this.loadFromCanvas(); -- cgit v1.2.3