aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/fly-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/fly-material.js')
-rw-r--r--js/lib/rdge/materials/fly-material.js26
1 files changed, 17 insertions, 9 deletions
diff --git a/js/lib/rdge/materials/fly-material.js b/js/lib/rdge/materials/fly-material.js
index 37bef66a..ca38cc83 100644
--- a/js/lib/rdge/materials/fly-material.js
+++ b/js/lib/rdge/materials/fly-material.js
@@ -5,6 +5,7 @@
5 </copyright> */ 5 </copyright> */
6 6
7var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; 7var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial;
8var Texture = require("js/lib/rdge/texture").Texture;
8 9
9var FlyMaterial = function FlyMaterial() { 10var FlyMaterial = function FlyMaterial() {
10 /////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////
@@ -29,18 +30,21 @@ var FlyMaterial = function FlyMaterial() {
29 // Methods 30 // Methods
30 /////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////
31 // duplcate method requirde 32 // duplcate method requirde
32 this.dup = function( world ) { 33 this.dup = function( world )
33 // allocate a new uber material 34 {
34 var newMat = new FlyMaterial(); 35 // get the current values;
36 var propNames = [], propValues = [], propTypes = [], propLabels = [];
37 this.getAllProperties(propNames, propValues, propTypes, propLabels);
38
39 // allocate a new material
40 var newMat = new FlyMaterial();
35 41
36 // copy over the current values; 42 // copy over the current values;
37 var propNames = [], propValues = [], propTypes = [], propLabels = []; 43 var n = propNames.length;
38 this.getAllProperties( propNames, propValues, propTypes, propLabels); 44 for (var i = 0; i < n; i++)
39 var n = propNames.length; 45 newMat.setProperty(propNames[i], propValues[i]);
40 for (var i=0; i<n; i++)
41 newMat.setProperty( propNames[i], propValues[i] );
42 46
43 return newMat; 47 return newMat;
44 }; 48 };
45 49
46 this.init = function( world ) { 50 this.init = function( world ) {
@@ -61,6 +65,10 @@ var FlyMaterial = function FlyMaterial() {
61 this._shader['default'].u_time.set( [this._time] ); 65 this._shader['default'].u_time.set( [this._time] );
62 } 66 }
63 67
68 // set up the texture
69 var texMapName = this._propValues[this._propNames[0]];
70 this._glTex = new Texture( world, texMapName );
71
64 // set the shader values in the shader 72 // set the shader values in the shader
65 this.updateTexture(); 73 this.updateTexture();
66 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 74 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );