aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/geom-obj.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 12:15:26 -0700
committerValerio Virgillito2012-07-09 12:15:26 -0700
commit1839f24e8dcbad38d1381bbcd65c17a9caa45987 (patch)
tree516a29ca99d4aae0d5228223fff438c1a3c4e0d3 /js/lib/geom/geom-obj.js
parentaedd14b18695d031f695d27dfbd94df5614495bb (diff)
parentfebfdb18042d1c73ac58ee4e35c5f176428dee00 (diff)
downloadninja-1839f24e8dcbad38d1381bbcd65c17a9caa45987.tar.gz
Merge pull request #346 from mqg734/MaterialsUI
UI support for preview, edit, duplicate and delete of WebGL Materials.
Diffstat (limited to 'js/lib/geom/geom-obj.js')
-rwxr-xr-xjs/lib/geom/geom-obj.js25
1 files changed, 4 insertions, 21 deletions
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js
index 4b8e1c69..5373c78a 100755
--- a/js/lib/geom/geom-obj.js
+++ b/js/lib/geom/geom-obj.js
@@ -215,27 +215,10 @@ exports.GeomObj = Object.create(Object.prototype, {
215 nMats = this._materialArray.length; 215 nMats = this._materialArray.length;
216 } 216 }
217 217
218 var stops = [], 218 if (nMats === this._materialTypeArray.length) {
219 colors = c.color; 219 for (i = 0; i < nMats; i++) {
220 220 if (this._materialTypeArray[i] == type) {
221 var len = colors.length; 221 this._materialArray[i].setGradientData(c.color);
222 // TODO - Current shaders only support 4 color stops
223 if (len > 4) {
224 len = 4;
225 }
226
227 for (var n = 0; n < len; n++) {
228 var position = colors[n].position / 100;
229 var cs = colors[n].value;
230 var stop = [cs.r / 255, cs.g / 255, cs.b / 255, cs.a];
231 stops.push(stop);
232
233 if (nMats === this._materialTypeArray.length) {
234 for (i = 0; i < nMats; i++) {
235 if (this._materialTypeArray[i] == type) {
236 this._materialArray[i].setProperty("color" + (n + 1), stop.slice(0));
237 this._materialArray[i].setProperty("colorStop" + (n + 1), position);
238 }
239 } 222 }
240 } 223 }
241 } 224 }