diff options
Diffstat (limited to 'js/lib/rdge/materials/linear-gradient-material.js')
-rwxr-xr-x | js/lib/rdge/materials/linear-gradient-material.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js index 51a7430c..586948bb 100755 --- a/js/lib/rdge/materials/linear-gradient-material.js +++ b/js/lib/rdge/materials/linear-gradient-material.js | |||
@@ -42,6 +42,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
42 | 42 | ||
43 | this.setColor1 = function (c) { | 43 | this.setColor1 = function (c) { |
44 | this._color1 = c.slice(); | 44 | this._color1 = c.slice(); |
45 | this._propValues[this._propNames[0]] = this._color1.slice(0); | ||
45 | 46 | ||
46 | if (this._shader && this._shader['default']) { | 47 | if (this._shader && this._shader['default']) { |
47 | this._shader['default'].u_color1.set(c); | 48 | this._shader['default'].u_color1.set(c); |
@@ -54,6 +55,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
54 | 55 | ||
55 | this.setColor2 = function (c) { | 56 | this.setColor2 = function (c) { |
56 | this._color2 = c.slice(); | 57 | this._color2 = c.slice(); |
58 | this._propValues[this._propNames[1]] = this._color2.slice(0); | ||
57 | 59 | ||
58 | if (this._shader && this._shader['default']) { | 60 | if (this._shader && this._shader['default']) { |
59 | this._shader['default'].u_color2.set(c); | 61 | this._shader['default'].u_color2.set(c); |
@@ -66,6 +68,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
66 | 68 | ||
67 | this.setColor3 = function (c) { | 69 | this.setColor3 = function (c) { |
68 | this._color3 = c.slice(); | 70 | this._color3 = c.slice(); |
71 | this._propValues[this._propNames[2]] = this._color3.slice(0); | ||
69 | 72 | ||
70 | if (this._shader && this._shader['default']) { | 73 | if (this._shader && this._shader['default']) { |
71 | this._shader['default'].u_color3.set(c); | 74 | this._shader['default'].u_color3.set(c); |
@@ -78,6 +81,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
78 | 81 | ||
79 | this.setColor4 = function (c) { | 82 | this.setColor4 = function (c) { |
80 | this._color4 = c.slice(); | 83 | this._color4 = c.slice(); |
84 | this._propValues[this._propNames[3]] = this._color4.slice(0); | ||
81 | 85 | ||
82 | if (this._shader && this._shader['default']) { | 86 | if (this._shader && this._shader['default']) { |
83 | this._shader['default'].u_color4.set(c); | 87 | this._shader['default'].u_color4.set(c); |
@@ -200,7 +204,23 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
200 | // Methods | 204 | // Methods |
201 | /////////////////////////////////////////////////////////////////////// | 205 | /////////////////////////////////////////////////////////////////////// |
202 | // duplcate method requirde | 206 | // duplcate method requirde |
203 | this.dup = function () { return new LinearGradientMaterial(); }; | 207 | this.dup = function () |
208 | { | ||
209 | // get the current values; | ||
210 | var propNames = [], propValues = [], propTypes = [], propLabels = []; | ||
211 | this.getAllProperties(propNames, propValues, propTypes, propLabels); | ||
212 | |||
213 | // allocate a new material | ||
214 | var newMat = new LinearGradientMaterial(); | ||
215 | |||
216 | // copy over the current values; | ||
217 | var n = propNames.length; | ||
218 | for (var i = 0; i < n; i++) | ||
219 | newMat.setProperty(propNames[i], propValues[i]); | ||
220 | |||
221 | return newMat; | ||
222 | } | ||
223 | |||
204 | 224 | ||
205 | this.init = function (world) { | 225 | this.init = function (world) { |
206 | this.setWorld(world); | 226 | this.setWorld(world); |