in gui.js [42:154]
const Config = function(layers, defaults, constants, funcs, randomize) {
const customAdd = C.BLEND_FUNCS['+'];
const one = C.BLEND_FACTORS['1'];
const zero = C.BLEND_FACTORS['0'];
const mode = defaults.mode;
this.product = defaults.product;
const sizePresetSet = getSizeSet(mode, constants);
layers.forEach((layer, index) => {
if (layer.kind == 'webgl') {
if (mode !== 'prod') {
if (layer.blend[0]) {
const blend = layer.blend[0];
this['blendColor' + index] = blend.color || [ 1, 0, 0, 0 ]; // FIXME: get RGBA components
this['blendColorEqFn' + index] = C.BLEND_FUNCS[C.funcKeys[blend.colorEq[0]]];
this['blendColorEqFactor0' + index] = C.BLEND_FACTORS[C.factorKeys[blend.colorEq[1]]];
this['blendColorEqFactor1' + index] = C.BLEND_FACTORS[C.factorKeys[blend.colorEq[2]]];
this['blendAlphaEqFn' + index] = C.BLEND_FUNCS[C.funcKeys[blend.alphaEq[0]]];
this['blendAlphaEqFactor0' + index] = C.BLEND_FACTORS[C.factorKeys[blend.alphaEq[1]]];
this['blendAlphaEqFactor1' + index] = C.BLEND_FACTORS[C.factorKeys[blend.alphaEq[2]]];
} else {
this['blendColor' + index] = [ 0, 0, 0, 0 ];
this['blendColorEqFn' + index] = customAdd;
this['blendColorEqFactor0' + index] = one;
this['blendColorEqFactor1' + index] = zero;
this['blendAlphaEqFn' + index] = customAdd;
this['blendAlphaEqFactor0' + index] = one;
this['blendAlphaEqFactor1' + index] = zero;
}
} else { // mode == 'prod'
this['blendSet' + index] = C.BLEND_SETS['soft'];
this['blendColor' + index] =
layer.blend[0].color || [ 1, 0, 0, 0 ]; // FIXME: get RGBA components
}
} else { // kind != 'webgl'
if (!is.background(layer)) {
this['layer' + index + 'Blend'] = layer.blend[1] || 'normal';
}
}
this['visible' + index] = !!layer.isOn;
if (!is.background(layer) && !is.cover(layer)) {
this['opacity' + index] = layer.opacity;
}
if (is.fss(layer)) {
this['mirror' + index] = layer.model.mirror;
this['renderMode' + index] = 'triangles';
this['lightSpeed' + index] = layer.model.lightSpeed;
this['facesX' + index] = layer.model.faces.x;
this['facesY' + index] = layer.model.faces.y;
this['vignette' + index] = layer.model.vignette;
this['iris' + index] = layer.model.iris;
this['amplitudeX' + index] = layer.model.amplitude[0];
this['amplitudeY' + index] = layer.model.amplitude[1];
this['amplitudeZ' + index] = layer.model.amplitude[2];
this['opacity' + index] = layer.model.opacity;
this['hue' + index] = layer.model.colorShift[0];
this['saturation' + index] = layer.model.colorShift[1];
this['brightness' + index] = layer.model.colorShift[2];
}
if (is.cover(layer)) {
this['productShown'+index] = !!layer.model.productShown;
}
if (is.fluid(layer) || is.nativeMetaballs(layer)) {
if (is.fluid(layer)) {
this['bang' + index] = () => funcs.refreshFluid(index);
this['rebuildGradients' + index] = () => funcs.rebuildFluidGradients(index);
}
if (is.nativeMetaballs(layer)) {
this['bang' + index] = () => funcs.refreshNativeMetaballs(index);
}
this['variety'+index] = layer.model.variety;
this['orbit'+index] = layer.model.orbit;
this['blur'+index] = layer.model.effects.blur;
this['fat'+index] = layer.model.effects.fat;
this['ring'+index] = layer.model.effects.ring;
}
if (is.background(layer)) {
const stopStates = layer.model.stops || [];
const gradientType = layer.model.orientation || "linear";
this['isRadial'+index] = gradientType == "radial";
this['stop1'+index] = stopStates[0] == "on";
this['stop2'+index] = stopStates[1] == "on";
this['stop3'+index] = stopStates[2] == "on";
this['darken'+index] = layer.model.darken;
}
});
//this.customSize = sizePresetSet['browser'];
this.sizePreset = sizePresetSet['browser'];
//this.savePng = funcs.savePng;
this.saveBatch = () => funcs.saveBatch(/*Object.values(sizePresetSet)*/);
// this.randomize = randomize(this); // FIXME: this way we updated FSS using "I feel lucky", consider returning it back in some way
this.randomize = () => funcs.iFeelLucky();
// this.store = () => funcs.store();
// -------
//this.timeShift = 0;
// this.getSceneJson = funcs.getSceneJson;
// this.loadSceneJson = funcs.loadSceneJson;
//this.exportZip = funcs.exportZip;
};