diff options
author | Valerio Virgillito | 2012-03-06 11:05:00 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-03-06 11:05:00 -0800 |
commit | 4540b5b4ea2065c3e0d67b46bba8b6764801fbea (patch) | |
tree | 4e1561530b1b90ea497bac8e41d193fa605e98b4 /js/helper-classes/RDGE/Materials/PlasmaMaterial.js | |
parent | 4e35725e6c9044c37bef28b8c8d36f4b5c89bfd9 (diff) | |
parent | 84332ab81c1b445195f1d9be8bbeae0725c8e758 (diff) | |
download | ninja-4540b5b4ea2065c3e0d67b46bba8b6764801fbea.tar.gz |
Merge branch 'refs/heads/master' into panels
Diffstat (limited to 'js/helper-classes/RDGE/Materials/PlasmaMaterial.js')
-rw-r--r-- | js/helper-classes/RDGE/Materials/PlasmaMaterial.js | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/js/helper-classes/RDGE/Materials/PlasmaMaterial.js b/js/helper-classes/RDGE/Materials/PlasmaMaterial.js deleted file mode 100644 index a65f3a33..00000000 --- a/js/helper-classes/RDGE/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 | /////////////////////////////////////////////////////////////////////// | ||
11 | function 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"); | ||
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) | ||
97 | var 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 | |||