aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/tunnel-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/tunnel-material.js')
-rw-r--r--js/lib/rdge/materials/tunnel-material.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/js/lib/rdge/materials/tunnel-material.js b/js/lib/rdge/materials/tunnel-material.js
index 83bf9021..9e70a6f8 100644
--- a/js/lib/rdge/materials/tunnel-material.js
+++ b/js/lib/rdge/materials/tunnel-material.js
@@ -6,6 +6,7 @@
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
10var TunnelMaterial = function TunnelMaterial() { 11var TunnelMaterial = function TunnelMaterial() {
11 /////////////////////////////////////////////////////////////////////// 12 ///////////////////////////////////////////////////////////////////////
@@ -31,16 +32,17 @@ var TunnelMaterial = function TunnelMaterial() {
31 /////////////////////////////////////////////////////////////////////// 32 ///////////////////////////////////////////////////////////////////////
32 // duplcate method requirde 33 // duplcate method requirde
33 this.dup = function (world) { 34 this.dup = function (world) {
34 // allocate a new uber material 35 // get the current values;
35 var newMat = new TunnelMaterial();
36
37 // copy over the current values;
38 var propNames = [], propValues = [], propTypes = [], propLabels = []; 36 var propNames = [], propValues = [], propTypes = [], propLabels = [];
39 this.getAllProperties(propNames, propValues, propTypes, propLabels); 37 this.getAllProperties(propNames, propValues, propTypes, propLabels);
38
39 // allocate a new material
40 var newMat = new TunnelMaterial();
41
42 // copy over the current values;
40 var n = propNames.length; 43 var n = propNames.length;
41 for (var i = 0; i < n; i++) { 44 for (var i = 0; i < n; i++)
42 newMat.setProperty(propNames[i], propValues[i]); 45 newMat.setProperty(propNames[i], propValues[i]);
43 }
44 46
45 return newMat; 47 return newMat;
46 }; 48 };
@@ -63,6 +65,10 @@ var TunnelMaterial = function TunnelMaterial() {
63 this._shader['default'].u_time.set([this._time]); 65 this._shader['default'].u_time.set([this._time]);
64 } 66 }
65 67
68 // set up the texture
69 var texMapName = this._propValues[this._propNames[0]];
70 this._glTex = new Texture( world, texMapName );
71
66 // set the shader values in the shader 72 // set the shader values in the shader
67 this.updateTexture(); 73 this.updateTexture();
68 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); 74 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]);