diff options
Diffstat (limited to 'js/lib/geom/geom-obj.js')
-rwxr-xr-x | js/lib/geom/geom-obj.js | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index fda071ee..d859d025 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 | } |