diff options
author | hwc487 | 2012-04-08 05:26:08 -0700 |
---|---|---|
committer | hwc487 | 2012-04-08 05:26:08 -0700 |
commit | 5b878fdfaa696c1a01afa191c1d65c0ccb006b65 (patch) | |
tree | ca9ae5497500a46edd00e0e61b8e49ae53242e4d /js/lib | |
parent | 416ce9d4954e0a7f4ee7b9afe43bf691fdb276f4 (diff) | |
download | ninja-5b878fdfaa696c1a01afa191c1d65c0ccb006b65.tar.gz |
Clouds
Diffstat (limited to 'js/lib')
-rwxr-xr-x | js/lib/rdge/materials/bump-metal-material.js | 2 | ||||
-rw-r--r-- | js/lib/rdge/materials/cloud-material.js | 21 | ||||
-rw-r--r-- | js/lib/rdge/materials/pulse-material.js | 6 | ||||
-rwxr-xr-x | js/lib/rdge/materials/uber-material.js | 4 | ||||
-rw-r--r-- | js/lib/rdge/texture.js | 25 |
5 files changed, 33 insertions, 25 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js index 0570e8ed..7e192a12 100755 --- a/js/lib/rdge/materials/bump-metal-material.js +++ b/js/lib/rdge/materials/bump-metal-material.js | |||
@@ -168,7 +168,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() { | |||
168 | if (glTex) | 168 | if (glTex) |
169 | { | 169 | { |
170 | if (glTex.isAnimated()) | 170 | if (glTex.isAnimated()) |
171 | glTex.rerender(); | 171 | glTex.render(); |
172 | 172 | ||
173 | var tex = glTex.getTexture(); | 173 | var tex = glTex.getTexture(); |
174 | if (tex) | 174 | if (tex) |
diff --git a/js/lib/rdge/materials/cloud-material.js b/js/lib/rdge/materials/cloud-material.js index 85088f91..f7f4c6bb 100644 --- a/js/lib/rdge/materials/cloud-material.js +++ b/js/lib/rdge/materials/cloud-material.js | |||
@@ -176,6 +176,27 @@ var CloudMaterial = function CloudMaterial() { | |||
176 | } | 176 | } |
177 | }; | 177 | }; |
178 | 178 | ||
179 | this.generateQuads = function() | ||
180 | { | ||
181 | var quads = []; | ||
182 | for ( i = 0; i < 8000; i++ ) | ||
183 | { | ||
184 | var quad = | ||
185 | { | ||
186 | } | ||
187 | x: Math.random() * 1000 - 500, | ||
188 | y = - Math.random() * Math.random() * 200 - 15, | ||
189 | z = i, | ||
190 | rotation.z = Math.random() * Math.PI, | ||
191 | scale = Math.random() * Math.random() * 1.5 + 0.5, | ||
192 | } | ||
193 | |||
194 | quads.push( quad ); | ||
195 | } | ||
196 | |||
197 | this._quads = quads; | ||
198 | }; | ||
199 | |||
179 | // JSON export | 200 | // JSON export |
180 | this.exportJSON = function() | 201 | this.exportJSON = function() |
181 | { | 202 | { |
diff --git a/js/lib/rdge/materials/pulse-material.js b/js/lib/rdge/materials/pulse-material.js index 0a7a5dd8..9cb500c8 100644 --- a/js/lib/rdge/materials/pulse-material.js +++ b/js/lib/rdge/materials/pulse-material.js | |||
@@ -139,7 +139,7 @@ var PulseMaterial = function PulseMaterial() | |||
139 | if (this._glTex) | 139 | if (this._glTex) |
140 | { | 140 | { |
141 | if (this._glTex.isAnimated()) | 141 | if (this._glTex.isAnimated()) |
142 | this._glTex.rerender(); | 142 | this._glTex.render(); |
143 | tex = this._glTex.getTexture(); | 143 | tex = this._glTex.getTexture(); |
144 | } | 144 | } |
145 | 145 | ||
@@ -157,7 +157,7 @@ var PulseMaterial = function PulseMaterial() | |||
157 | { | 157 | { |
158 | if (!this._glTex.isAnimated()) | 158 | if (!this._glTex.isAnimated()) |
159 | { | 159 | { |
160 | this._glTex.rerender(); | 160 | this._glTex.render(); |
161 | this.updateTexture(); | 161 | this.updateTexture(); |
162 | } | 162 | } |
163 | } | 163 | } |
@@ -177,7 +177,7 @@ var PulseMaterial = function PulseMaterial() | |||
177 | { | 177 | { |
178 | //this.updateTexture(); | 178 | //this.updateTexture(); |
179 | if (this._glTex.isAnimated()) | 179 | if (this._glTex.isAnimated()) |
180 | this._glTex.rerender(); | 180 | this._glTex.render(); |
181 | tex = this._glTex.getTexture(); | 181 | tex = this._glTex.getTexture(); |
182 | if (tex) | 182 | if (tex) |
183 | technique.u_tex0.set( tex ); | 183 | technique.u_tex0.set( tex ); |
diff --git a/js/lib/rdge/materials/uber-material.js b/js/lib/rdge/materials/uber-material.js index 71354216..4edb101f 100755 --- a/js/lib/rdge/materials/uber-material.js +++ b/js/lib/rdge/materials/uber-material.js | |||
@@ -300,7 +300,7 @@ var UberMaterial = function UberMaterial() { | |||
300 | { | 300 | { |
301 | if (!this._diffuseTexture.isAnimated()) | 301 | if (!this._diffuseTexture.isAnimated()) |
302 | { | 302 | { |
303 | this._diffuseTexture.rerender(); | 303 | this._diffuseTexture.render(); |
304 | var tex = this._diffuseTexture.getTexture(); | 304 | var tex = this._diffuseTexture.getTexture(); |
305 | technique.s_diffuseMap.set( tex ); | 305 | technique.s_diffuseMap.set( tex ); |
306 | } | 306 | } |
@@ -412,7 +412,7 @@ var UberMaterial = function UberMaterial() { | |||
412 | { | 412 | { |
413 | if (this._diffuseTexture && this._diffuseTexture.isAnimated()) | 413 | if (this._diffuseTexture && this._diffuseTexture.isAnimated()) |
414 | { | 414 | { |
415 | this._diffuseTexture.rerender(); | 415 | this._diffuseTexture.render(); |
416 | technique.s_diffuseMap.set( this._diffuseTexture.getTexture() ); | 416 | technique.s_diffuseMap.set( this._diffuseTexture.getTexture() ); |
417 | } | 417 | } |
418 | } | 418 | } |
diff --git a/js/lib/rdge/texture.js b/js/lib/rdge/texture.js index f1448195..94147852 100644 --- a/js/lib/rdge/texture.js +++ b/js/lib/rdge/texture.js | |||
@@ -109,14 +109,6 @@ function Texture( dstWorld, texMapName, wrap, mips ) | |||
109 | break; | 109 | break; |
110 | 110 | ||
111 | case notifier.OBJECT_CHANGE: | 111 | case notifier.OBJECT_CHANGE: |
112 | // this._isAnimated = srcWorld._hasAnimatedMaterials; | ||
113 | // if (!srcWorld.hasAnimatedMaterials()) | ||
114 | // srcWorld.restartRenderLoop(); | ||
115 | // else if (!dstWorld.hasAnimatedMaterials()) | ||
116 | // { | ||
117 | // dstWorld.refreshTextures(); | ||
118 | // dstWorld.restartRenderLoop(); | ||
119 | // } | ||
120 | break; | 112 | break; |
121 | 113 | ||
122 | case notifier.FIRST_RENDER: | 114 | case notifier.FIRST_RENDER: |
@@ -179,21 +171,16 @@ function Texture( dstWorld, texMapName, wrap, mips ) | |||
179 | var doc = srcCanvas.ownerDocument; | 171 | var doc = srcCanvas.ownerDocument; |
180 | this._renderCanvas = doc.createElement("canvas"); | 172 | this._renderCanvas = doc.createElement("canvas"); |
181 | 173 | ||
182 | // cache whether this is a 2D canvas or 3D canvas | 174 | this.render(); |
183 | // var srcCtx = srcCanvas.getContext("2d"); | ||
184 | // this._is3D = false; | ||
185 | // if (!srcCtx) this._is3D = true; | ||
186 | |||
187 | this.rerender(); | ||
188 | 175 | ||
189 | return tex; | 176 | return tex; |
190 | } | 177 | } |
191 | 178 | ||
192 | this.rerender = function() | 179 | this.render = function() |
193 | { | 180 | { |
194 | if (!this._srcCanvas) | 181 | if (!this._srcCanvas) |
195 | { | 182 | { |
196 | console.log( " no source canvas in GLTexture.rerender" ); | 183 | console.log( " no source canvas in GLTexture.render" ); |
197 | return; | 184 | return; |
198 | } | 185 | } |
199 | var srcCanvas = this._srcCanvas; | 186 | var srcCanvas = this._srcCanvas; |
@@ -201,7 +188,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) | |||
201 | var world = this.getDstWorld(); | 188 | var world = this.getDstWorld(); |
202 | if (!world) | 189 | if (!world) |
203 | { | 190 | { |
204 | console.log( "no world in GLTexture.rerender" ); | 191 | console.log( "no world in GLTexture.render" ); |
205 | return; | 192 | return; |
206 | } | 193 | } |
207 | var renderer = world.getRenderer(); | 194 | var renderer = world.getRenderer(); |
@@ -218,7 +205,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) | |||
218 | var renderCanvas = this._renderCanvas; | 205 | var renderCanvas = this._renderCanvas; |
219 | if (!renderCanvas) | 206 | if (!renderCanvas) |
220 | { | 207 | { |
221 | console.log( "no render canvas in GLTexture.rerender" ); | 208 | console.log( "no render canvas in GLTexture.render" ); |
222 | return; | 209 | return; |
223 | } | 210 | } |
224 | renderCanvas.width = width; | 211 | renderCanvas.width = width; |
@@ -229,7 +216,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) | |||
229 | var tex = this._texture; | 216 | var tex = this._texture; |
230 | if (!tex) | 217 | if (!tex) |
231 | { | 218 | { |
232 | console.log( "no texture in GLTexture.rerender" ); | 219 | console.log( "no texture in GLTexture.render" ); |
233 | return; | 220 | return; |
234 | } | 221 | } |
235 | 222 | ||