aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/twist-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/twist-material.js')
-rw-r--r--js/lib/rdge/materials/twist-material.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/js/lib/rdge/materials/twist-material.js b/js/lib/rdge/materials/twist-material.js
index 7fcca081..9e2c124a 100644
--- a/js/lib/rdge/materials/twist-material.js
+++ b/js/lib/rdge/materials/twist-material.js
@@ -6,6 +6,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
6 6
7 7
8var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; 8var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial;
9var Texture = require("js/lib/rdge/texture").Texture;
9 10
10/////////////////////////////////////////////////////////////////////// 11///////////////////////////////////////////////////////////////////////
11var TwistMaterial = function TwistMaterial() { 12var TwistMaterial = function TwistMaterial() {
@@ -32,16 +33,17 @@ var TwistMaterial = function TwistMaterial() {
32 /////////////////////////////////////////////////////////////////////// 33 ///////////////////////////////////////////////////////////////////////
33 // duplcate method requirde 34 // duplcate method requirde
34 this.dup = function (world) { 35 this.dup = function (world) {
35 // allocate a new uber material 36 // get the current values;
36 var newMat = new TwistMaterial();
37
38 // copy over the current values;
39 var propNames = [], propValues = [], propTypes = [], propLabels = []; 37 var propNames = [], propValues = [], propTypes = [], propLabels = [];
40 this.getAllProperties(propNames, propValues, propTypes, propLabels); 38 this.getAllProperties(propNames, propValues, propTypes, propLabels);
39
40 // allocate a new material
41 var newMat = new TwistMaterial();
42
43 // copy over the current values;
41 var n = propNames.length; 44 var n = propNames.length;
42 for (var i = 0; i < n; i++) { 45 for (var i = 0; i < n; i++)
43 newMat.setProperty(propNames[i], propValues[i]); 46 newMat.setProperty(propNames[i], propValues[i]);
44 }
45 47
46 return newMat; 48 return newMat;
47 }; 49 };
@@ -64,6 +66,10 @@ var TwistMaterial = function TwistMaterial() {
64 this._shader['default'].u_time.set([this._time]); 66 this._shader['default'].u_time.set([this._time]);
65 } 67 }
66 68
69 // set up the texture
70 var texMapName = this._propValues[this._propNames[0]];
71 this._glTex = new Texture( world, texMapName );
72
67 // set the shader values in the shader 73 // set the shader values in the shader
68 this.updateTexture(); 74 this.updateTexture();
69 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); 75 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]);