in src/gui.js [28:102]
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;
this.omega = defaults.omega;
const sizePresetSet = getSizeSet(mode, constants);
layers.forEach((layer, index) => {
if (layer.webglOrHtml == '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['normal'];
this['blendColor' + index] =
layer.blend[0].color || [ 1, 0, 0, 0 ]; // FIXME: get RGBA components
}
} else { // webglOrHtml != 'webgl'
this['layer' + index + 'Blend'] = layer.blend[1] || 'normal';
}
this['visible' + index] = true;
if (isFss(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];
}
});
//this.customSize = sizePresetSet['browser'];
this.sizePreset = sizePresetSet['browser'];
//this.savePng = funcs.savePng;
this.saveBatch = () => funcs.saveBatch(Object.values(sizePresetSet));
this.randomize = randomize(this);
// -------
//this.timeShift = 0;
// this.getSceneJson = funcs.getSceneJson;
// this.loadSceneJson = funcs.loadSceneJson;
//this.exportZip = funcs.exportZip;
};