diff options
Diffstat (limited to 'js/lib/rdge/materials/flat-material.js')
-rwxr-xr-x | js/lib/rdge/materials/flat-material.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/js/lib/rdge/materials/flat-material.js b/js/lib/rdge/materials/flat-material.js index 40da9305..e5498b65 100755 --- a/js/lib/rdge/materials/flat-material.js +++ b/js/lib/rdge/materials/flat-material.js | |||
@@ -34,7 +34,22 @@ var FlatMaterial = function FlatMaterial() { | |||
34 | // Methods | 34 | // Methods |
35 | /////////////////////////////////////////////////////////////////////// | 35 | /////////////////////////////////////////////////////////////////////// |
36 | // duplcate method requirde | 36 | // duplcate method requirde |
37 | this.dup = function () { return new FlatMaterial(); }; | 37 | this.dup = function( world ) |
38 | { | ||
39 | // get the current values; | ||
40 | var propNames = [], propValues = [], propTypes = [], propLabels = []; | ||
41 | this.getAllProperties(propNames, propValues, propTypes, propLabels); | ||
42 | |||
43 | // allocate a new material | ||
44 | var newMat = new FlatMaterial(); | ||
45 | |||
46 | // copy over the current values; | ||
47 | var n = propNames.length; | ||
48 | for (var i = 0; i < n; i++) | ||
49 | newMat.setProperty(propNames[i], propValues[i]); | ||
50 | |||
51 | return newMat; | ||
52 | }; | ||
38 | 53 | ||
39 | this.init = function (world) { | 54 | this.init = function (world) { |
40 | // save the world | 55 | // save the world |
@@ -72,6 +87,7 @@ var FlatMaterial = function FlatMaterial() { | |||
72 | // make sure we have legitimate input | 87 | // make sure we have legitimate input |
73 | if (this.validateProperty(prop, value)) { | 88 | if (this.validateProperty(prop, value)) { |
74 | this._propValues[prop] = value; | 89 | this._propValues[prop] = value; |
90 | if (prop === 'color') this._color = value.slice(); | ||
75 | if (this._shader && this._shader.colorMe) { | 91 | if (this._shader && this._shader.colorMe) { |
76 | this._shader.colorMe[prop].set(value); | 92 | this._shader.colorMe[prop].set(value); |
77 | } | 93 | } |