aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/backup-delete/Materials/PlasmaMaterial.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/backup-delete/Materials/PlasmaMaterial.js')
-rw-r--r--js/helper-classes/backup-delete/Materials/PlasmaMaterial.js134
1 files changed, 0 insertions, 134 deletions
diff --git a/js/helper-classes/backup-delete/Materials/PlasmaMaterial.js b/js/helper-classes/backup-delete/Materials/PlasmaMaterial.js
deleted file mode 100644
index 4e60df9f..00000000
--- a/js/helper-classes/backup-delete/Materials/PlasmaMaterial.js
+++ /dev/null
@@ -1,134 +0,0 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7///////////////////////////////////////////////////////////////////////
8// Class GLMaterial
9// RDGE representation of a material.
10///////////////////////////////////////////////////////////////////////
11function PlasmaMaterial()
12{
13 // initialize the inherited members
14 this.inheritedFrom = GLMaterial;
15 this.inheritedFrom();
16
17 ///////////////////////////////////////////////////////////////////////
18 // Instance variables
19 ///////////////////////////////////////////////////////////////////////
20 this._name = "PlasmaMaterial";
21 this._shaderName = "plasma";
22
23 this._time = 0.0;
24 this._dTime = 0.01;
25 this._speed = 1.0;
26
27 this._color = [1,0,0,1];
28
29
30 ///////////////////////////////////////////////////////////////////////
31 // Property Accessors
32 ///////////////////////////////////////////////////////////////////////
33 this.getShaderName = function() { return this._shaderName; }
34
35 this.isAnimated = function() { return true; }
36
37 ///////////////////////////////////////////////////////////////////////
38 // Material Property Accessors
39 ///////////////////////////////////////////////////////////////////////
40 this._propNames = ["color"];
41 this._propLabels = ["Color"];
42 this._propTypes = ["color"];
43 this._propValues = [];
44
45 this._propValues[ this._propNames[0] ] = this._color;
46
47 this.setProperty = function( prop, value )
48 {
49 // make sure we have legitimate imput
50 if (this.validateProperty( prop, value ))
51 {
52 this._color = value.slice(0);
53 this._shader.default[prop].set(value);
54 }
55 }
56 ///////////////////////////////////////////////////////////////////////
57
58 ///////////////////////////////////////////////////////////////////////
59 // Methods
60 ///////////////////////////////////////////////////////////////////////
61 // duplcate method requirde
62 this.dup = function() { return new PlasmaMaterial(); }
63
64 this.init = function()
65 {
66 // set up the shader
67 this._shader = new jshader();
68 this._shader.def = plasmaShaderDef;
69 this._shader.init();
70
71 // set the default value
72 this._time = 0;
73 this._shader.default.u_time = this._time;
74 this.setProperty( "color", [this._time, 0, 0, 1] );
75
76 // set up the material node
77 this._materialNode = createMaterialNode("plasmaMaterial_" + world.generateUniqueNodeID());
78 this._materialNode.setShader(this._shader);
79 }
80
81 this.update = function( time )
82 {
83 this._shader.default.u_time = this._time;
84 var color = this.getProperty( "color" );
85 color[0] = this._time;
86 this.setProperty( "color", color );
87 //console.log( "update color to: " + color );
88 this._time += this._dTime;
89 }
90
91}
92
93///////////////////////////////////////////////////////////////////////////////////////
94// RDGE shader
95
96// shader spec (can also be loaded from a .JSON file, or constructed at runtime)
97var plasmaShaderDef =
98{'shaders':
99 {
100 'defaultVShader':"assets/shaders/plasma.vert.glsl",
101 'defaultFShader':"assets/shaders/plasma.frag.glsl",
102 },
103 'techniques':
104 {
105 'default':
106 [
107 {
108 'vshader' : 'defaultVShader',
109 'fshader' : 'defaultFShader',
110 // attributes
111 'attributes' :
112 {
113 'vert' : { 'type' : 'vec3' },
114 'normal' : { 'type' : 'vec3' },
115 'texcoord' : { 'type' : 'vec2' },
116 },
117 // parameters
118 'params' :
119 {
120 'u_time' : { 'type' : 'float' },
121 'color' : { 'type' : 'vec4' }
122 },
123
124 // render states
125 'states' :
126 {
127 'depthEnable' : true,
128 'offset':[1.0, 0.1]
129 },
130 },
131 ]
132 }
133};
134