diff options
Diffstat (limited to 'js/lib/rdge/materials/water-material.js')
-rw-r--r-- | js/lib/rdge/materials/water-material.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index 37836636..18a73915 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js | |||
@@ -5,6 +5,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; | 7 | var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; |
8 | var Texture = require("js/lib/rdge/texture").Texture; | ||
8 | 9 | ||
9 | /////////////////////////////////////////////////////////////////////// | 10 | /////////////////////////////////////////////////////////////////////// |
10 | // Class GLMaterial | 11 | // Class GLMaterial |
@@ -36,12 +37,14 @@ var WaterMaterial = function WaterMaterial() { | |||
36 | /////////////////////////////////////////////////////////////////////// | 37 | /////////////////////////////////////////////////////////////////////// |
37 | // duplcate method requirde | 38 | // duplcate method requirde |
38 | this.dup = function (world) { | 39 | this.dup = function (world) { |
39 | // allocate a new uber material | 40 | // get the current values; |
40 | var newMat = new WaterMaterial(); | ||
41 | |||
42 | // copy over the current values; | ||
43 | var propNames = [], propValues = [], propTypes = [], propLabels = []; | 41 | var propNames = [], propValues = [], propTypes = [], propLabels = []; |
44 | this.getAllProperties(propNames, propValues, propTypes, propLabels); | 42 | this.getAllProperties(propNames, propValues, propTypes, propLabels); |
43 | |||
44 | // allocate a new material | ||
45 | var newMat = new WaterMaterial(); | ||
46 | |||
47 | // copy over the current values; | ||
45 | var n = propNames.length; | 48 | var n = propNames.length; |
46 | for (var i = 0; i < n; i++) | 49 | for (var i = 0; i < n; i++) |
47 | newMat.setProperty(propNames[i], propValues[i]); | 50 | newMat.setProperty(propNames[i], propValues[i]); |
@@ -67,6 +70,9 @@ var WaterMaterial = function WaterMaterial() { | |||
67 | this._shader['default'].u_time.set([this._time]); | 70 | this._shader['default'].u_time.set([this._time]); |
68 | } | 71 | } |
69 | 72 | ||
73 | var texMapName = this._propValues[this._propNames[0]]; | ||
74 | this._glTex = new Texture( world, texMapName ); | ||
75 | |||
70 | // set the shader values in the shader | 76 | // set the shader values in the shader |
71 | this.updateTexture(); | 77 | this.updateTexture(); |
72 | this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); | 78 | this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); |