aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/backup-delete/Materials/PulseMaterial.js
diff options
context:
space:
mode:
authorJonathan Duran2012-03-15 13:46:53 -0700
committerJonathan Duran2012-03-15 13:46:53 -0700
commitcc57a3dff8f504526bbf41a8b01c412c4788424a (patch)
tree9127331e952ef1da6faa331ec0bb49ea3acfb980 /js/helper-classes/backup-delete/Materials/PulseMaterial.js
parent0893ba7f5d1f03099c7b5f8c53ce750e412023cd (diff)
parente6bfd7fb3d3324bea5dbc05350832a9e25c6c00d (diff)
downloadninja-cc57a3dff8f504526bbf41a8b01c412c4788424a.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Conflicts: js/controllers/selection-controller.js js/helper-classes/RDGE/src/tools/rdge-compiled.js js/helper-classes/backup-delete/GLBrushStroke.js js/helper-classes/backup-delete/GLCircle.js js/helper-classes/backup-delete/GLGeomObj.js js/helper-classes/backup-delete/GLRectangle.js js/helper-classes/backup-delete/GLSubpath.js js/helper-classes/backup-delete/GLWorld.js js/helper-classes/backup-delete/Materials/BumpMetalMaterial.js js/helper-classes/backup-delete/Materials/DeformMaterial.js js/helper-classes/backup-delete/Materials/FlatMaterial.js js/helper-classes/backup-delete/Materials/FlyMaterial.js js/helper-classes/backup-delete/Materials/JuliaMaterial.js js/helper-classes/backup-delete/Materials/KeleidoscopeMaterial.js js/helper-classes/backup-delete/Materials/LinearGradientMaterial.js js/helper-classes/backup-delete/Materials/MandelMaterial.js js/helper-classes/backup-delete/Materials/PlasmaMaterial.js js/helper-classes/backup-delete/Materials/PulseMaterial.js js/helper-classes/backup-delete/Materials/RadialBlurMaterial.js js/helper-classes/backup-delete/Materials/RadialGradientMaterial.js js/helper-classes/backup-delete/Materials/ReliefTunnelMaterial.js js/helper-classes/backup-delete/Materials/SquareTunnelMaterial.js js/helper-classes/backup-delete/Materials/StarMaterial.js js/helper-classes/backup-delete/Materials/TaperMaterial.js js/helper-classes/backup-delete/Materials/TunnelMaterial.js js/helper-classes/backup-delete/Materials/TwistMaterial.js js/helper-classes/backup-delete/Materials/TwistVertMaterial.js js/helper-classes/backup-delete/Materials/UberMaterial.js js/helper-classes/backup-delete/Materials/WaterMaterial.js js/helper-classes/backup-delete/Materials/ZInvertMaterial.js js/lib/drawing/world.js js/preloader/Preloader.js js/stage/layout.js Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/helper-classes/backup-delete/Materials/PulseMaterial.js')
-rw-r--r--js/helper-classes/backup-delete/Materials/PulseMaterial.js266
1 files changed, 0 insertions, 266 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 e55798b7..00000000
--- a/js/helper-classes/backup-delete/Materials/PulseMaterial.js
+++ /dev/null
@@ -1,266 +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_" + world.generateUniqueNodeID());
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 var texMapName = this._propValues[this._propNames[0]];
190 exportStr += "texture: " + texMapName + "\n";
191
192 // every material needs to terminate like this
193 exportStr += "endMaterial\n";
194