aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/backup-delete/Materials/PulseMaterial.js
diff options
context:
space:
mode:
authorJohn Mayhew2012-04-02 16:28:39 -0700
committerJohn Mayhew2012-04-02 16:28:39 -0700
commitb4155fb4c33675a8a7cd37473513718043fdf0ba (patch)
tree3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/helper-classes/backup-delete/Materials/PulseMaterial.js
parent5ba9aeac94c86049423fd5d4b37b277263939c13 (diff)
parentc6de22bf42be90b403491b5f87b1818d9020310c (diff)
downloadninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts: js/helper-classes/RDGE/rdge-compiled.js js/helper-classes/RDGE/runtime/GLRuntime.js js/helper-classes/RDGE/src/core/script/MeshManager.js js/helper-classes/RDGE/src/core/script/engine.js js/helper-classes/RDGE/src/core/script/fx/ssao.js js/helper-classes/RDGE/src/core/script/init_state.js js/helper-classes/RDGE/src/core/script/run_state.js js/helper-classes/RDGE/src/core/script/scenegraphNodes.js js/helper-classes/RDGE/src/core/script/utilities.js js/helper-classes/RDGE/src/tools/compile-rdge-core.bat js/helper-classes/RDGE/src/tools/compile-rdge-core.sh js/helper-classes/RDGE/src/tools/rdge-compiled.js js/lib/drawing/world.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/deform-material.js js/lib/rdge/materials/flat-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/linear-gradient-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-blur-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/relief-tunnel-material.js js/lib/rdge/materials/square-tunnel-material.js js/lib/rdge/materials/star-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/tunnel-material.js js/lib/rdge/materials/twist-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/uber-material.js js/lib/rdge/materials/water-material.js js/lib/rdge/materials/z-invert-material.js js/preloader/Preloader.js
Diffstat (limited to 'js/helper-classes/backup-delete/Materials/PulseMaterial.js')
-rw-r--r--js/helper-classes/backup-delete/Materials/PulseMaterial.js263
1 files changed, 0 insertions, 263 deletions
diff --git a/js/helper-classes/backup-delete/Materials/PulseMaterial.js b/js/helper-classes/backup-delete/Materials/PulseMaterial.js
deleted file mode 100644
index d76b9966..00000000
--- a/js/helper-classes/backup-delete/Materials/PulseMaterial.js
+++ /dev/null
@@ -1,263 +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
9///////////////////////////////////////////////////////////////////////
10// Class GLMaterial
11// RDGE representation of a material.
12///////////////////////////////////////////////////////////////////////
13function PulseMaterial()
14{
15 // initialize the inherited members
16 this.inheritedFrom = GLMaterial;
17 this.inheritedFrom();
18
19 ///////////////////////////////////////////////////////////////////////
20 // Instance variables
21 ///////////////////////////////////////////////////////////////////////
22 this._name = "PulseMaterial";
23 this._shaderName = "pulse";
24
25 this._texMap = 'assets/images/cubelight.png';
26
27 this._time = 0.0;
28 this._dTime = 0.01;
29
30 ///////////////////////////////////////////////////////////////////////
31 // Property Accessors
32 ///////////////////////////////////////////////////////////////////////
33 this.getName = function() { return this._name; }
34 this.getShaderName = function() { return this._shaderName; }
35
36 this.getTextureMap = function() { return this._propValues[this._propNames[0]] ? this._propValues[this._propNames[0]].slice() : null }
37 this.setTextureMap = function(m) { this._propValues[this._propNames[0]] = m ? m.slice(0) : null; this.updateTexture(); }
38
39 this.isAnimated = function() { return true; }
40
41 ///////////////////////////////////////////////////////////////////////
42 // Material Property Accessors
43 ///////////////////////////////////////////////////////////////////////
44 this._propNames = ["texmap"];
45 this._propLabels = ["Texture map"];
46 this._propTypes = ["file"];
47 this._propValues = [];
48
49 this._propValues[ this._propNames[0] ] = this._texMap.slice(0);
50
51 this.setProperty = function( prop, value )
52 {
53 // make sure we have legitimate imput
54 var ok = this.validateProperty( prop, value );
55 if (!ok)
56 console.log( "invalid property in Radial Gradient Material:" + prop + " : " + value );
57
58 switch (prop)
59 {
60 case "texmap":
61 this.setTextureMap(value);
62 break;
63
64 case "color":
65 break;
66 }
67 }
68 ///////////////////////////////////////////////////////////////////////
69
70
71 ///////////////////////////////////////////////////////////////////////
72 // Methods
73 ///////////////////////////////////////////////////////////////////////
74 // duplcate method requirde
75 this.dup = function( world )
76 {
77 // save the world
78 if (world) this.setWorld( world );
79
80 // allocate a new uber material
81 var newMat = new PulseMaterial();
82
83 // copy over the current values;
84 var propNames = [], propValues = [], propTypes = [], propLabels = [];
85 this.getAllProperties( propNames, propValues, propTypes, propLabels);
86 var n = propNames.length;
87 for (var i=0; i<n; i++)
88 newMat.setProperty( propNames[i], propValues[i] );
89
90 return newMat;
91 }
92
93 this.init = function( world )
94 {
95 // save the world
96 if (world) this.setWorld( world );
97
98 // this variable declared above is inherited set to a smaller delta.
99 // the pulse material runs a little faster
100 this._dTime = 0.01;
101
102 // set up the shader
103 this._shader = new jshader();
104 this._shader.def = pulseMaterialDef;
105 this._shader.init();
106
107 // set up the material node
108 this._materialNode = createMaterialNode("pulseMaterial");
109 this._materialNode.setShader(this._shader);
110
111 this._time = 0;
112 if (this._shader && this._shader.default)
113 this._shader.default.u_time.set( [this._time] );
114
115 // set the shader values in the shader
116 this.updateTexture();
117 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
118 this.update( 0 );
119 }
120
121 this.updateTexture = function()
122 {
123 var material = this._materialNode;
124 if (material)
125 {
126 var technique = material.shaderProgram.default;
127 var renderer = g_Engine.getContext().renderer;
128 if (renderer && technique)
129 {
130 var texMapName = this._propValues[this._propNames[0]];
131 var wrap = 'REPEAT', mips = true;
132 var tex = this.loadTexture( texMapName, wrap, mips );
133
134 /*
135 var glTex = new GLTexture( this.getWorld() );
136 var prevWorld = this.findPreviousWorld();
137 if (prevWorld)
138 {
139 var srcCanvas = prevWorld.getCanvas();
140 tex = glTex.loadFromCanvas( srcCanvas );
141 }
142 else
143 tex = glTex.loadFromFile( texMapName, wrap, mips );
144 */
145
146 if (tex)
147 technique.u_tex0.set( tex );
148 }
149 }
150 }
151
152 this.update = function( time )
153 {
154 var material = this._materialNode;
155 if (material)
156 {
157 var technique = material.shaderProgram.default;
158 var renderer = g_Engine.getContext().renderer;
159 if (renderer && technique)
160 {
161 if (this._shader && this._shader.default)
162 this._shader.default.u_time.set( [this._time] );
163 this._time += this._dTime;
164 if (this._time > 200.0) this._time = 0.0;
165 }
166 }
167 }
168
169 this.setResolution = function( res )
170 {
171 var material = this._materialNode;
172 if (material)
173 {
174 var technique = material.shaderProgram.default;
175 var renderer = g_Engine.getContext().renderer;
176 if (renderer && technique)
177 {
178 technique.u_resolution.set( res );
179 }
180 }
181 }
182
183 this.export = function()
184 {
185 // every material needs the base type and instance name
186 var exportStr = "material: " + this.getShaderName() + "\n";
187 exportStr += "name: " + this.getName() + "\n";
188
189 // every material needs to terminate like this
190 exportStr += "endMaterial\n";
191
192 return exportStr;
193 }
194
195 this.import = function( importStr )