aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/keleidoscope-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/keleidoscope-material.js')
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/js/lib/rdge/materials/keleidoscope-material.js b/js/lib/rdge/materials/keleidoscope-material.js
index 4506bb8c..e9f1b10e 100644
--- a/js/lib/rdge/materials/keleidoscope-material.js
+++ b/js/lib/rdge/materials/keleidoscope-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 KeleidoscopeMaterial = function KeleidoscopeMaterial() { 10var KeleidoscopeMaterial = function KeleidoscopeMaterial() {
10 /////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////
@@ -37,17 +38,19 @@ var KeleidoscopeMaterial = function KeleidoscopeMaterial() {
37 /////////////////////////////////////////////////////////////////////// 38 ///////////////////////////////////////////////////////////////////////
38 // duplcate method requirde 39 // duplcate method requirde
39 this.dup = function( world ) { 40 this.dup = function( world ) {
40 // allocate a new uber material 41 // get the current values;
41 var newMat = new KeleidoscopeMaterial(); 42 var propNames = [], propValues = [], propTypes = [], propLabels = [];
43 this.getAllProperties(propNames, propValues, propTypes, propLabels);
44
45 // allocate a new material
46 var newMat = new KeleidoscopeMaterial();
42 47
43 // copy over the current values; 48 // copy over the current values;
44 var propNames = [], propValues = [], propTypes = [], propLabels = []; 49 var n = propNames.length;
45 this.getAllProperties( propNames, propValues, propTypes, propLabels); 50 for (var i = 0; i < n; i++)
46 var n = propNames.length; 51 newMat.setProperty(propNames[i], propValues[i]);
47 for (var i=0; i<n; i++)
48 newMat.setProperty( propNames[i], propValues[i] );
49 52
50 return newMat; 53 return newMat;
51 }; 54 };
52 55
53 this.init = function( world ) { 56 this.init = function( world ) {
@@ -68,6 +71,10 @@ var KeleidoscopeMaterial = function KeleidoscopeMaterial() {
68 this._shader['default'].u_time.set( [this._time] ); 71 this._shader['default'].u_time.set( [this._time] );
69 } 72 }
70 73
74 // set up the texture
75 var texMapName = this._propValues[this._propNames[0]];
76 this._glTex = new Texture( world, texMapName );
77
71 // set the shader values in the shader 78 // set the shader values in the shader
72 this.updateTexture(); 79 this.updateTexture();
73 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 80 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );