aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/Materials/PulseMaterial.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/Materials/PulseMaterial.js')
-rw-r--r--js/helper-classes/RDGE/Materials/PulseMaterial.js32
1 files changed, 29 insertions, 3 deletions
diff --git a/js/helper-classes/RDGE/Materials/PulseMaterial.js b/js/helper-classes/RDGE/Materials/PulseMaterial.js
index 3d6107fb..d76b9966 100644
--- a/js/helper-classes/RDGE/Materials/PulseMaterial.js
+++ b/js/helper-classes/RDGE/Materials/PulseMaterial.js
@@ -95,6 +95,10 @@ function PulseMaterial()
95 // save the world 95 // save the world
96 if (world) this.setWorld( world ); 96 if (world) this.setWorld( world );
97 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
98 // set up the shader 102 // set up the shader
99 this._shader = new jshader(); 103 this._shader = new jshader();
100 this._shader.def = pulseMaterialDef; 104 this._shader.def = pulseMaterialDef;
@@ -125,9 +129,20 @@ function PulseMaterial()
125 { 129 {
126 var texMapName = this._propValues[this._propNames[0]]; 130 var texMapName = this._propValues[this._propNames[0]];
127 var wrap = 'REPEAT', mips = true; 131 var wrap = 'REPEAT', mips = true;
128 //var tex = renderer.getTextureByName(texMapName, wrap, mips );
129 //this.registerTexture( tex );
130 var tex = this.loadTexture( texMapName, wrap, mips ); 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
131 if (tex) 146 if (tex)
132 technique.u_tex0.set( tex ); 147 technique.u_tex0.set( tex );
133 } 148 }
@@ -146,6 +161,7 @@ function PulseMaterial()
146 if (this._shader && this._shader.default) 161 if (this._shader && this._shader.default)
147 this._shader.default.u_time.set( [this._time] ); 162 this._shader.default.u_time.set( [this._time] );
148 this._time += this._dTime; 163 this._time += this._dTime;
164 if (this._time > 200.0) this._time = 0.0;
149 } 165 }
150 } 166 }
151 } 167 }
@@ -184,7 +200,17 @@ function PulseMaterial()
184 this.setName( pu.nextValue( "name: ") ); 200 this.setName( pu.nextValue( "name: ") );
185 201
186 var rtnStr; 202 var rtnStr;
187 203 try
204 {
205 var endKey = "endMaterial\n";
206 var index = importStr.indexOf( endKey );
207 index += endKey.length;
208 rtnStr = importStr.substr( index );
209 }
210 catch (e)
211 {
212 throw new Error( "could not import material: " + importStr );
213 }
188 return rtnStr; 214 return rtnStr;
189 } 215 }
190} 216}