aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge')
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js31
1 files changed, 22 insertions, 9 deletions
diff --git a/js/lib/rdge/materials/radial-gradient-material.js b/js/lib/rdge/materials/radial-gradient-material.js
index a671ee42..b0b63cee 100755
--- a/js/lib/rdge/materials/radial-gradient-material.js
+++ b/js/lib/rdge/materials/radial-gradient-material.js
@@ -25,8 +25,7 @@ var RadialGradientMaterial = function RadialGradientMaterial() {
25 this._colorStop4 = 1.0; 25 this._colorStop4 = 1.0;
26 // this._colorCount = 4; 26 // this._colorCount = 4;
27 27
28 var s = Math.sqrt( 2.0 ); 28 this._textureTransform = [1,0,0, 0,1,0, 0,0,1];
29 this._textureTransform = [s,0,0, 0,s,0, 0,0,1];
30 29
31 /////////////////////////////////////////////////////////////////////// 30 ///////////////////////////////////////////////////////////////////////
32 // Property Accessors 31 // Property Accessors
@@ -147,9 +146,9 @@ var RadialGradientMaterial = function RadialGradientMaterial() {
147 /////////////////////////////////////////////////////////////////////// 146 ///////////////////////////////////////////////////////////////////////
148 // Material Property Accessors 147 // Material Property Accessors
149 /////////////////////////////////////////////////////////////////////// 148 ///////////////////////////////////////////////////////////////////////
150 this._propNames = ["color1", "color2", "color3", "color4", "colorStop1", "colorStop2", "colorStop3", "colorStop4", "angle"]; 149 this._propNames = ["color1", "color2", "color3", "color4", "colorStop1", "colorStop2", "colorStop3", "colorStop4" ];
151 this._propLabels = ["Color 1", "Color 2", "Color 3", "Color 4", "Color Stop 1", "Color Stop 2", "Color Stop 3", "Color Stop 4", "Angle"]; 150 this._propLabels = ["Color 1", "Color 2", "Color 3", "Color 4", "Color Stop 1", "Color Stop 2", "Color Stop 3", "Color Stop 4" ];
152 this._propTypes = ["color", "color", "color", "color", "float", "float", "float", "float", "float"]; 151 this._propTypes = ["color", "color", "color", "color", "float", "float", "float", "float" ];
153 this._propValues = []; 152 this._propValues = [];
154 153
155 this._propValues[this._propNames[0]] = this._color1.slice(0); 154 this._propValues[this._propNames[0]] = this._color1.slice(0);
@@ -192,9 +191,21 @@ var RadialGradientMaterial = function RadialGradientMaterial() {
192 // Methods 191 // Methods
193 /////////////////////////////////////////////////////////////////////// 192 ///////////////////////////////////////////////////////////////////////
194 // duplcate method requirde 193 // duplcate method requirde
195 this.dup = function () { 194 this.dup = function () {
196 return new RadialGradientMaterial(); 195 // allocate a new material
197 }; 196 var newMat = new RadialGradientMaterial();
197
198 // copy over the current values;
199 var propNames = [], propValues = [], propTypes = [], propLabels = [];
200 this.getAllProperties( propNames, propValues, propTypes, propLabels);
201 var n = propNames.length;
202 for (var i=0; i<n; i++) {
203 newMat.setProperty( propNames[i], propValues[i] );
204 }
205 newMat._textureTransform = this._textureTransform.slice();
206
207 return newMat;
208 };
198 209
199 this.init = function (world) { 210 this.init = function (world) {
200 this.setWorld(world); 211 this.setWorld(world);
@@ -287,7 +298,8 @@ var RadialGradientMaterial = function RadialGradientMaterial() {
287 'colorStop1': this.getColorStop1(), 298 'colorStop1': this.getColorStop1(),
288 'colorStop2': this.getColorStop2(), 299 'colorStop2': this.getColorStop2(),
289 'colorStop3': this.getColorStop3(), 300 'colorStop3': this.getColorStop3(),
290 'colorStop4': this.getColorStop4() 301 'colorStop4': this.getColorStop4(),
302 'textureTransform': this._textureTransform
291 }; 303 };
292 304
293 return jObj; 305 return jObj;
@@ -306,6 +318,7 @@ var RadialGradientMaterial = function RadialGradientMaterial() {
306 colorStop2 = jObj.colorStop2, 318 colorStop2 = jObj.colorStop2,
307 colorStop3 = jObj.colorStop3, 319 colorStop3 = jObj.colorStop3,
308 colorStop4 = jObj.colorStop4; 320 colorStop4 = jObj.colorStop4;
321 this._textureTransform = jObj.textureTransform;
309 322
310 this.setProperty("color1", color1); 323 this.setProperty("color1", color1);
311 this.setProperty("color2", color2); 324 this.setProperty("color2", color2);