diff options
Diffstat (limited to 'js/lib/rdge/materials/z-invert-material.js')
-rw-r--r-- | js/lib/rdge/materials/z-invert-material.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/js/lib/rdge/materials/z-invert-material.js b/js/lib/rdge/materials/z-invert-material.js index fc7632eb..e1149f8b 100644 --- a/js/lib/rdge/materials/z-invert-material.js +++ b/js/lib/rdge/materials/z-invert-material.js | |||
@@ -6,6 +6,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | 7 | ||
8 | var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; | 8 | var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; |
9 | var Texture = require("js/lib/rdge/texture").Texture; | ||
9 | 10 | ||
10 | var ZInvertMaterial = function ZInvertMaterial() { | 11 | var ZInvertMaterial = function ZInvertMaterial() { |
11 | /////////////////////////////////////////////////////////////////////// | 12 | /////////////////////////////////////////////////////////////////////// |
@@ -31,16 +32,17 @@ var ZInvertMaterial = function ZInvertMaterial() { | |||
31 | /////////////////////////////////////////////////////////////////////// | 32 | /////////////////////////////////////////////////////////////////////// |
32 | // duplicate method required | 33 | // duplicate method required |
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 ZInvertMaterial(); | ||
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 ZInvertMaterial(); | ||
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 ZInvertMaterial = function ZInvertMaterial() { | |||
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()]); |