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