From 9e812f35ffa751e9215c5427c0c44005bd357924 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 7 Mar 2012 17:18:38 -0800 Subject: Fixed a few problems with Plasma material. --- js/lib/rdge/runtime/RuntimeMaterial.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'js/lib/rdge/runtime/RuntimeMaterial.js') diff --git a/js/lib/rdge/runtime/RuntimeMaterial.js b/js/lib/rdge/runtime/RuntimeMaterial.js index 294c4787..1bbbc3b1 100644 --- a/js/lib/rdge/runtime/RuntimeMaterial.js +++ b/js/lib/rdge/runtime/RuntimeMaterial.js @@ -54,6 +54,10 @@ var RuntimeMaterial = function RuntimeMaterial( world ) { } + this.import = function( importStr ) + { + } + this.getPropertyFromString = function( prop, str ) { var index = str.indexOf( prop ); @@ -304,6 +308,35 @@ function RuntimeUberMaterial() { } +function RuntimePlasmaMaterial() +{ + // inherit the members of RuntimeMaterial + this.inheritedFrom = RuntimeMaterial; + this.inheritedFrom(); + + this.init = function( ) + { + this.update(); + } + + this.update = function( time ) + { + var material = this._materialNode; + if (material) + { + var technique = material.shaderProgram.default; + var renderer = g_Engine.getContext().renderer; + if (renderer && technique) + { + if (this._shader && this._shader.default) + this._shader.default.u_time.set( [this._time] ); + this._time += this._dTime; + if (this._time > 200.0) this._time = 0.0; + } + } + } +} + if (typeof exports === "object") { @@ -314,4 +347,5 @@ if (typeof exports === "object") exports.RuntimeLinearGradientMaterial = RuntimeLinearGradientMaterial; exports.RuntimeBumpMetalMaterial = RuntimeBumpMetalMaterial; exports.RuntimeUberMaterial = RuntimeUberMaterial; + exports.RuntimePlasmaMaterial = RuntimePlasmaMaterial; } -- cgit v1.2.3