diff options
Diffstat (limited to 'js/lib/rdge/runtime')
-rw-r--r-- | js/lib/rdge/runtime/RuntimeGeomObj.js | 4 | ||||
-rw-r--r-- | js/lib/rdge/runtime/RuntimeMaterial.js | 34 |
2 files changed, 37 insertions, 1 deletions
diff --git a/js/lib/rdge/runtime/RuntimeGeomObj.js b/js/lib/rdge/runtime/RuntimeGeomObj.js index 5b212dce..93d4d9a1 100644 --- a/js/lib/rdge/runtime/RuntimeGeomObj.js +++ b/js/lib/rdge/runtime/RuntimeGeomObj.js | |||
@@ -11,7 +11,8 @@ var RuntimeFlatMaterial = RuntimeMaterial.RuntimeFlatMaterial, | |||
11 | RuntimeLinearGradientMaterial = RuntimeMaterial.RuntimeLinearGradientMaterial, | 11 | RuntimeLinearGradientMaterial = RuntimeMaterial.RuntimeLinearGradientMaterial, |
12 | RuntimeBumpMetalMaterial = RuntimeMaterial.RuntimeBumpMetalMaterial, | 12 | RuntimeBumpMetalMaterial = RuntimeMaterial.RuntimeBumpMetalMaterial, |
13 | RuntimeUberMaterial = RuntimeMaterial.RuntimeUberMaterial, | 13 | RuntimeUberMaterial = RuntimeMaterial.RuntimeUberMaterial, |
14 | RuntimePulseMaterial = RuntimeMaterial.RuntimePulseMaterial; | 14 | RuntimePulseMaterial = RuntimeMaterial.RuntimePulseMaterial, |
15 | RuntimePlasmaMaterial = RuntimeMaterial.RuntimePlasmaMaterial; | ||
15 | 16 | ||
16 | 17 | ||
17 | 18 | ||
@@ -94,6 +95,7 @@ var RuntimeGeomObj = function RuntimeGeomObj() | |||
94 | case "linearGradient": mat = new RuntimeLinearGradientMaterial(); break; | 95 | case "linearGradient": mat = new RuntimeLinearGradientMaterial(); break; |
95 | case "bumpMetal": mat = new RuntimeBumpMetalMaterial(); break; | 96 | case "bumpMetal": mat = new RuntimeBumpMetalMaterial(); break; |
96 | case "uber": mat = new RuntimeUberMaterial(); break; | 97 | case "uber": mat = new RuntimeUberMaterial(); break; |
98 | case "plasma": mat = new RuntimePlasmaMaterial(); break; | ||
97 | 99 | ||
98 | case "deform": | 100 | case "deform": |
99 | case "water": | 101 | case "water": |
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 ) | |||
54 | { | 54 | { |
55 | } | 55 | } |
56 | 56 | ||
57 | this.import = function( importStr ) | ||
58 | { | ||
59 | } | ||
60 | |||
57 | this.getPropertyFromString = function( prop, str ) | 61 | this.getPropertyFromString = function( prop, str ) |
58 | { | 62 | { |
59 | var index = str.indexOf( prop ); | 63 | var index = str.indexOf( prop ); |
@@ -304,6 +308,35 @@ function RuntimeUberMaterial() | |||
304 | { | 308 | { |
305 | } | 309 | } |
306 | 310 | ||
311 | function RuntimePlasmaMaterial() | ||
312 | { | ||
313 | // inherit the members of RuntimeMaterial | ||
314 | this.inheritedFrom = RuntimeMaterial; | ||
315 | this.inheritedFrom(); | ||
316 | |||
317 | this.init = function( ) | ||
318 | { | ||
319 | this.update(); | ||
320 | } | ||
321 | |||
322 | this.update = function( time ) | ||
323 | { | ||
324 | var material = this._materialNode; | ||
325 | if (material) | ||
326 | { | ||
327 | var technique = material.shaderProgram.default; | ||
328 | var renderer = g_Engine.getContext().renderer; | ||
329 | if (renderer && technique) | ||
330 | { | ||
331 | if (this._shader && this._shader.default) | ||
332 | this._shader.default.u_time.set( [this._time] ); | ||
333 | this._time += this._dTime; | ||
334 | if (this._time > 200.0) this._time = 0.0; | ||
335 | } | ||
336 | } | ||
337 | } | ||
338 | } | ||
339 | |||
307 | 340 | ||
308 | if (typeof exports === "object") | 341 | if (typeof exports === "object") |
309 | { | 342 | { |
@@ -314,4 +347,5 @@ if (typeof exports === "object") | |||
314 | exports.RuntimeLinearGradientMaterial = RuntimeLinearGradientMaterial; | 347 | exports.RuntimeLinearGradientMaterial = RuntimeLinearGradientMaterial; |
315 | exports.RuntimeBumpMetalMaterial = RuntimeBumpMetalMaterial; | 348 | exports.RuntimeBumpMetalMaterial = RuntimeBumpMetalMaterial; |
316 | exports.RuntimeUberMaterial = RuntimeUberMaterial; | 349 | exports.RuntimeUberMaterial = RuntimeUberMaterial; |
350 | exports.RuntimePlasmaMaterial = RuntimePlasmaMaterial; | ||
317 | } | 351 | } |