diff options
author | Armen Kesablyan | 2012-02-13 11:59:19 -0800 |
---|---|---|
committer | Armen Kesablyan | 2012-02-13 11:59:19 -0800 |
commit | 90d0c8c0e98d062c628c061fe5765ce991fda409 (patch) | |
tree | 9780e9dcf475bf319f3cacc1a1ad52fcf9f133af /js/helper-classes/RDGE/Materials/PlasmaMaterial.js | |
parent | 8110e01dc5093ac6baf621103dcaa5f769e5be92 (diff) | |
parent | e142611e22718b1f1d1696902ad9161ec5f33f98 (diff) | |
download | ninja-90d0c8c0e98d062c628c061fe5765ce991fda409.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Conflicts:
css/ninja.css
js/stage/stage.reel/stage.html
js/tools/TextTool.js
node_modules/labs/rich-text-editor.reel/rich-text-editor.css
node_modules/labs/rich-text-editor.reel/rich-text-editor.html
node_modules/labs/rich-text-editor.reel/rich-text-editor.js
node_modules/labs/rich-text-editor.reel/rich-text-resizer.js
node_modules/labs/rich-text-editor.reel/rich-text-sanitizer.js
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/helper-classes/RDGE/Materials/PlasmaMaterial.js')
-rw-r--r-- | js/helper-classes/RDGE/Materials/PlasmaMaterial.js | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/js/helper-classes/RDGE/Materials/PlasmaMaterial.js b/js/helper-classes/RDGE/Materials/PlasmaMaterial.js deleted file mode 100644 index f900b35a..00000000 --- a/js/helper-classes/RDGE/Materials/PlasmaMaterial.js +++ /dev/null | |||
@@ -1,132 +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 | /////////////////////////////////////////////////////////////////////// | ||
36 | // Material Property Accessors | ||
37 | /////////////////////////////////////////////////////////////////////// | ||
38 | this._propNames = ["color"]; | ||
39 | this._propLabels = ["Color"]; | ||
40 | this._propTypes = ["color"]; | ||
41 | this._propValues = []; | ||
42 | |||
43 | this._propValues[ this._propNames[0] ] = this._color; | ||
44 | |||
45 | this.setProperty = function( prop, value ) | ||
46 | { | ||
47 | // make sure we have legitimate imput | ||
48 | if (this.validateProperty( prop, value )) | ||
49 | { | ||
50 | this._color = value.slice(0); | ||
51 | this._shader.default[prop].set(value); | ||
52 | } | ||
53 | } | ||
54 | /////////////////////////////////////////////////////////////////////// | ||
55 | |||
56 | /////////////////////////////////////////////////////////////////////// | ||
57 | // Methods | ||
58 | /////////////////////////////////////////////////////////////////////// | ||
59 | // duplcate method requirde | ||
60 | this.dup = function() { return new PlasmaMaterial(); } | ||
61 | |||
62 | this.init = function() | ||
63 | { | ||
64 | // set up the shader | ||
65 | this._shader = new jshader(); | ||
66 | this._shader.def = plasmaShaderDef; | ||
67 | this._shader.init(); | ||
68 | |||
69 | // set the default value | ||
70 | this._time = 0; | ||
71 | this._shader.default.u_time = this._time; | ||
72 | this.setProperty( "color", [this._time, 0, 0, 1] ); | ||
73 | |||
74 | // set up the material node | ||
75 | this._materialNode = createMaterialNode("plasmaMaterial"); | ||
76 | this._materialNode.setShader(this._shader); | ||
77 | } | ||
78 | |||
79 | this.update = function( time ) | ||
80 | { | ||
81 | this._shader.default.u_time = this._time; | ||
82 | var color = this.getProperty( "color" ); | ||
83 | color[0] = this._time; | ||
84 | this.setProperty( "color", color ); | ||
85 | //console.log( "update color to: " + color ); | ||
86 | this._time += this._dTime; | ||
87 | } | ||
88 | |||
89 | } | ||
90 | |||
91 | /////////////////////////////////////////////////////////////////////////////////////// | ||
92 | // RDGE shader | ||
93 | |||
94 | // shader spec (can also be loaded from a .JSON file, or constructed at runtime) | ||
95 | var plasmaShaderDef = | ||
96 | {'shaders': | ||
97 | { | ||
98 | 'defaultVShader':"assets/shaders/plasma.vert.glsl", | ||
99 | 'defaultFShader':"assets/shaders/plasma.frag.glsl", | ||
100 | }, | ||
101 | 'techniques': | ||
102 | { | ||
103 | 'default': | ||
104 | [ | ||
105 | { | ||
106 | 'vshader' : 'defaultVShader', | ||
107 | 'fshader' : 'defaultFShader', | ||
108 | // attributes | ||
109 | 'attributes' : | ||
110 | { | ||
111 | 'vert' : { 'type' : 'vec3' }, | ||
112 | 'normal' : { 'type' : 'vec3' }, | ||
113 | 'texcoord' : { 'type' : 'vec2' }, | ||
114 | }, | ||
115 | // parameters | ||
116 | 'params' : | ||
117 | { | ||
118 | 'u_time' : { 'type' : 'float' }, | ||
119 | 'color' : { 'type' : 'vec4' } | ||
120 | }, | ||
121 | |||
122 | // render states | ||
123 | 'states' : | ||
124 | { | ||
125 | 'depthEnable' : true, | ||
126 | 'offset':[1.0, 0.1] | ||
127 | }, | ||
128 | }, | ||
129 | ] | ||
130 | } | ||
131 | }; | ||
132 | |||