From 80715f4f0c45d29926184fa02e0a01b4e7642a79 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 30 Apr 2012 09:52:59 -0700 Subject: twist vertex material changes --- js/lib/rdge/materials/twist-vert-material.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/lib/rdge/materials/twist-vert-material.js b/js/lib/rdge/materials/twist-vert-material.js index 892e975f..b27c0b11 100644 --- a/js/lib/rdge/materials/twist-vert-material.js +++ b/js/lib/rdge/materials/twist-vert-material.js @@ -47,7 +47,21 @@ var TwistVertMaterial = function TwistVertMaterial() // Methods /////////////////////////////////////////////////////////////////////// // duplcate method requirde - this.dup = function () { return new TwistVertMaterial(); }; + this.dup = function() { + // get the current values; + var propNames = [], propValues = [], propTypes = [], propLabels = []; + this.getAllProperties(propNames, propValues, propTypes, propLabels); + + // allocate a new material + var newMat = new TwistVertMaterial(); + + // copy over the current values; + var n = propNames.length; + for (var i = 0; i < n; i++) + newMat.setProperty(propNames[i], propValues[i]); + + return newMat; + }; this.init = function (world) { @@ -162,8 +176,15 @@ var TwistVertMaterial = function TwistVertMaterial() { case "u_tex0": case "u_tex1": - case "color": this._shader.twistMe[propName].set(propValue); break; - default: this._shader.twistMe[propName].set([propValue]); break; + break; + + case "color": + this._shader.twistMe[propName].set(propValue); + break; + + default: + this._shader.twistMe[propName].set([propValue]); + break; } } } -- cgit v1.2.3