From 5b878fdfaa696c1a01afa191c1d65c0ccb006b65 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Sun, 8 Apr 2012 05:26:08 -0700 Subject: Clouds --- js/lib/rdge/materials/bump-metal-material.js | 2 +- js/lib/rdge/materials/cloud-material.js | 21 +++++++++++++++++++++ js/lib/rdge/materials/pulse-material.js | 6 +++--- js/lib/rdge/materials/uber-material.js | 4 ++-- js/lib/rdge/texture.js | 25 ++++++------------------- 5 files changed, 33 insertions(+), 25 deletions(-) (limited to 'js/lib') 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() { if (glTex) { if (glTex.isAnimated()) - glTex.rerender(); + glTex.render(); var tex = glTex.getTexture(); 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() { } }; + this.generateQuads = function() + { + var quads = []; + for ( i = 0; i < 8000; i++ ) + { + var quad = + { + } + x: Math.random() * 1000 - 500, + y = - Math.random() * Math.random() * 200 - 15, + z = i, + rotation.z = Math.random() * Math.PI, + scale = Math.random() * Math.random() * 1.5 + 0.5, + } + + quads.push( quad ); + } + + this._quads = quads; + }; + // JSON export this.exportJSON = function() { 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() if (this._glTex) { if (this._glTex.isAnimated()) - this._glTex.rerender(); + this._glTex.render(); tex = this._glTex.getTexture(); } @@ -157,7 +157,7 @@ var PulseMaterial = function PulseMaterial() { if (!this._glTex.isAnimated()) { - this._glTex.rerender(); + this._glTex.render(); this.updateTexture(); } } @@ -177,7 +177,7 @@ var PulseMaterial = function PulseMaterial() { //this.updateTexture(); if (this._glTex.isAnimated()) - this._glTex.rerender(); + this._glTex.render(); tex = this._glTex.getTexture(); if (tex) 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() { { if (!this._diffuseTexture.isAnimated()) { - this._diffuseTexture.rerender(); + this._diffuseTexture.render(); var tex = this._diffuseTexture.getTexture(); technique.s_diffuseMap.set( tex ); } @@ -412,7 +412,7 @@ var UberMaterial = function UberMaterial() { { if (this._diffuseTexture && this._diffuseTexture.isAnimated()) { - this._diffuseTexture.rerender(); + this._diffuseTexture.render(); technique.s_diffuseMap.set( this._diffuseTexture.getTexture() ); } } 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 ) break; case notifier.OBJECT_CHANGE: -// this._isAnimated = srcWorld._hasAnimatedMaterials; -// if (!srcWorld.hasAnimatedMaterials()) -// srcWorld.restartRenderLoop(); -// else if (!dstWorld.hasAnimatedMaterials()) -// { -// dstWorld.refreshTextures(); -// dstWorld.restartRenderLoop(); -// } break; case notifier.FIRST_RENDER: @@ -179,21 +171,16 @@ function Texture( dstWorld, texMapName, wrap, mips ) var doc = srcCanvas.ownerDocument; this._renderCanvas = doc.createElement("canvas"); - // cache whether this is a 2D canvas or 3D canvas -// var srcCtx = srcCanvas.getContext("2d"); -// this._is3D = false; -// if (!srcCtx) this._is3D = true; - - this.rerender(); + this.render(); return tex; } - this.rerender = function() + this.render = function() { if (!this._srcCanvas) { - console.log( " no source canvas in GLTexture.rerender" ); + console.log( " no source canvas in GLTexture.render" ); return; } var srcCanvas = this._srcCanvas; @@ -201,7 +188,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) var world = this.getDstWorld(); if (!world) { - console.log( "no world in GLTexture.rerender" ); + console.log( "no world in GLTexture.render" ); return; } var renderer = world.getRenderer(); @@ -218,7 +205,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) var renderCanvas = this._renderCanvas; if (!renderCanvas) { - console.log( "no render canvas in GLTexture.rerender" ); + console.log( "no render canvas in GLTexture.render" ); return; } renderCanvas.width = width; @@ -229,7 +216,7 @@ function Texture( dstWorld, texMapName, wrap, mips ) var tex = this._texture; if (!tex) { - console.log( "no texture in GLTexture.rerender" ); + console.log( "no texture in GLTexture.render" ); return; } -- cgit v1.2.3