diff options
author | hwc487 | 2012-04-12 06:24:46 -0700 |
---|---|---|
committer | hwc487 | 2012-04-12 06:24:46 -0700 |
commit | 1fa8516bcd0fb0277c13a7081b5a51ce041d3496 (patch) | |
tree | 11f80ddc57a6cc47d7a57ff8091b5cb435d6d253 /js | |
parent | b5aa082842f798d1eec582428468a322bd5a017f (diff) | |
download | ninja-1fa8516bcd0fb0277c13a7081b5a51ce041d3496.tar.gz |
Cloud material
Diffstat (limited to 'js')
-rw-r--r-- | js/lib/rdge/materials/cloud-material.js | 15 | ||||
-rwxr-xr-x | js/lib/rdge/materials/flat-material.js | 2 | ||||
-rw-r--r-- | js/lib/rdge/texture.js | 13 |
3 files changed, 19 insertions, 11 deletions
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() { | |||
31 | 31 | ||
32 | // parameter initial values | 32 | // parameter initial values |
33 | this._time = 0.0; | 33 | this._time = 0.0; |
34 | this._surfaceAlpha = 0.5; | 34 | this._surfaceAlpha = 1.0; |
35 | this._zmin = 0.1; | 35 | this._zmin = 0.1; |
36 | this._zmax = 10.0; | 36 | this._zmax = 10.0; |
37 | 37 | ||
@@ -125,6 +125,7 @@ var CloudMaterial = function CloudMaterial() { | |||
125 | // build a world to do the rendering | 125 | // build a world to do the rendering |
126 | this._srcWorld = new GLWorld( this._srcCanvas, true ); | 126 | this._srcWorld = new GLWorld( this._srcCanvas, true ); |
127 | var srcWorld = this._srcWorld; | 127 | var srcWorld = this._srcWorld; |
128 | this._srcCanvas.__GLWorld = srcWorld; | ||
128 | 129 | ||
129 | // build the geometry | 130 | // build the geometry |
130 | var prim = this.buildGeometry(); | 131 | var prim = this.buildGeometry(); |
@@ -174,11 +175,15 @@ var CloudMaterial = function CloudMaterial() { | |||
174 | if (renderer && technique) { | 175 | if (renderer && technique) { |
175 | var texMapName = this._propValues[this._propNames[0]]; | 176 | var texMapName = this._propValues[this._propNames[0]]; |
176 | var wrap = 'REPEAT', mips = true; | 177 | var wrap = 'REPEAT', mips = true; |
177 | var tex = this.loadTexture( texMapName, wrap, mips ); | 178 | //var tex = this.loadTexture( texMapName, wrap, mips ); |
178 | 179 | if (this._glTex) | |
179 | if (tex) { | 180 | { |
180 | technique.u_tex0.set( tex ); | 181 | this._glTex.render(); |
182 | var tex = this._glTex.getTexture(); | ||
183 | if (tex) | ||
184 | technique.u_tex0.set( tex ); | ||
181 | } | 185 | } |
186 | |||
182 | } | 187 | } |
183 | } | 188 | } |
184 | }; | 189 | }; |
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() { | |||
26 | this.getShaderName = function() { return this._shaderName; }; | 26 | this.getShaderName = function() { return this._shaderName; }; |
27 | 27 | ||
28 | this.isAnimated = function() { return false; }; | 28 | this.isAnimated = function() { return false; }; |
29 | this.hasVertexDeformation = function() { return true; }; | 29 | this.hasVertexDeformation = function() { return false; }; |
30 | this._hasVertexDeformation = true; | 30 | this._hasVertexDeformation = true; |
31 | this._vertexDeformationTolerance = 0.2; | 31 | this._vertexDeformationTolerance = 0.2; |
32 | 32 | ||
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 ) | |||
75 | if (srcCanvas) | 75 | if (srcCanvas) |
76 | { | 76 | { |
77 | this._srcCanvas = srcCanvas; | 77 | this._srcCanvas = srcCanvas; |
78 | if (srcCanvas.elementModel && srcCanvas.elementModel.shapeModel && srcCanvas.elementModel.shapeModel.GLWorld) | 78 | var srcWorld |
79 | if (srcCanvas.elementModel && srcCanvas.elementModel.shapeModel && srcCanvas.elementModel.shapeModel.GLWorld) | ||
80 | srcWorld = srcCanvas.elementModel.shapeModel.GLWorld; | ||
81 | if (!srcWorld) srcWorld = srcCanvas.__GLWorld; | ||
82 | if (srcWorld) | ||
79 | { | 83 | { |
80 | this._srcWorld = srcCanvas.elementModel.shapeModel.GLWorld; | 84 | this._srcWorld = srcWorld; |
81 | 85 | ||
82 | // add a notifier to the world | 86 | // add a notifier to the world |
83 | this._srcWorld.addListener( this, this.worldCallback, { srcWorld: this._srcWorld } ); | 87 | srcWorld.addListener( this, this.worldCallback, { srcWorld: this._srcWorld } ); |
84 | 88 | ||
85 | // check if the source is animated | 89 | // check if the source is animated |
86 | if (srcCanvas.elementModel && srcCanvas.elementModel.shapeModel && srcCanvas.elementModel.shapeModel.GLWorld) | 90 | this._isAnimated = srcWorld._hasAnimatedMaterials; |
87 | this._isAnimated = this._srcWorld._hasAnimatedMaterials; | ||
88 | } | 91 | } |
89 | 92 | ||
90 | this.loadFromCanvas(); | 93 | this.loadFromCanvas(); |