Search in sources :

Example 26 with VariationFunc

use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.

the class AbstractFlameWriter method createXFormAttrList.

protected List<SimpleXMLBuilder.Attribute<?>> createXFormAttrList(SimpleXMLBuilder pXB, Layer pLayer, XForm pXForm) throws Exception {
    List<SimpleXMLBuilder.Attribute<?>> attrList = new ArrayList<SimpleXMLBuilder.Attribute<?>>();
    attrList.add(pXB.createAttr("weight", pXForm.getWeight()));
    attrList.add(pXB.createAttr("color", pXForm.getColor()));
    attrList.add(pXB.createAttr("symmetry", pXForm.getColorSymmetry()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MIRROR_PRE_POST_TRANSLATIONS, pXForm.getMirrorTranslations() ? 1 : 0));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MATERIAL, pXForm.getMaterial()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MATERIAL_SPEED, pXForm.getMaterialSpeed()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MOD_GAMMA, pXForm.getModGamma()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MOD_GAMMA_SPEED, pXForm.getModGammaSpeed()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MOD_CONTRAST, pXForm.getModContrast()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MOD_CONTRAST_SPEED, pXForm.getModContrastSpeed()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MOD_SATURATION, pXForm.getModSaturation()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MOD_SATURATION_SPEED, pXForm.getModSaturationSpeed()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MOD_HUE, pXForm.getModHue()));
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_MOD_HUE_SPEED, pXForm.getModHueSpeed()));
    if (pXForm.getDrawMode().equals(DrawMode.OPAQUE)) {
        attrList.add(pXB.createAttr("opacity", pXForm.getOpacity()));
    } else if (pXForm.getDrawMode().equals(DrawMode.HIDDEN)) {
        attrList.add(pXB.createAttr("opacity", 0.0));
    }
    UniqueNamesMaker namesMaker = new UniqueNamesMaker();
    for (int vIdx = 0; vIdx < pXForm.getVariationCount(); vIdx++) {
        Variation v = pXForm.getVariation(vIdx);
        VariationFunc func = v.getFunc();
        String fName = namesMaker.makeUnique(func.getName());
        attrList.add(pXB.createAttr(fName, v.getAmount()));
        attrList.add(pXB.createAttr(fName + "_" + AbstractFlameReader.ATTR_FX_PRIORITY, v.getPriority()));
        // params
        {
            String[] params = func.getParameterNames();
            if (params != null) {
                Object[] vals = func.getParameterValues();
                for (int i = 0; i < params.length; i++) {
                    if (vals[i] instanceof Integer) {
                        attrList.add(pXB.createAttr((fName + "_" + params[i]), (Integer) vals[i]));
                    } else if (vals[i] instanceof Double) {
                        attrList.add(pXB.createAttr((fName + "_" + params[i]), (Double) vals[i]));
                    } else {
                        throw new IllegalStateException();
                    }
                    MotionCurve curve = v.getMotionCurve(params[i]);
                    if (curve != null) {
                        writeMotionCurve(pXB, attrList, fName + "_" + params[i], curve);
                    }
                }
            }
        }
        // curves
        List<String> blackList = Collections.emptyList();
        writeMotionCurves(v, pXB, attrList, fName + "_", blackList);
        // ressources
        {
            String[] ressNames = func.getRessourceNames();
            if (ressNames != null) {
                byte[][] vals = func.getRessourceValues();
                for (int i = 0; i < ressNames.length; i++) {
                    String hexStr = vals[i] != null && vals[i].length > 0 ? Tools.byteArrayToHexString(vals[i]) : "";
                    attrList.add(pXB.createAttr((fName + "_" + ressNames[i]), hexStr));
                }
            }
        }
    }
    attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_XY_COEFS, pXForm.getXYCoeff00() + " " + pXForm.getXYCoeff01() + " " + pXForm.getXYCoeff10() + " " + pXForm.getXYCoeff11() + " " + pXForm.getXYCoeff20() + " " + pXForm.getXYCoeff21()));
    if (pXForm.isHasXYPostCoeffs()) {
        attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_XY_POST, pXForm.getXYPostCoeff00() + " " + pXForm.getXYPostCoeff01() + " " + pXForm.getXYPostCoeff10() + " " + pXForm.getXYPostCoeff11() + " " + pXForm.getXYPostCoeff20() + " " + pXForm.getXYPostCoeff21()));
    }
    if (pXForm.isHasYZCoeffs()) {
        attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_YZ_COEFS, pXForm.getYZCoeff00() + " " + pXForm.getYZCoeff01() + " " + pXForm.getYZCoeff10() + " " + pXForm.getYZCoeff11() + " " + pXForm.getYZCoeff20() + " " + pXForm.getYZCoeff21()));
    }
    if (pXForm.isHasYZPostCoeffs()) {
        attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_YZ_POST, pXForm.getYZPostCoeff00() + " " + pXForm.getYZPostCoeff01() + " " + pXForm.getYZPostCoeff10() + " " + pXForm.getYZPostCoeff11() + " " + pXForm.getYZPostCoeff20() + " " + pXForm.getYZPostCoeff21()));
    }
    if (pXForm.isHasZXCoeffs()) {
        attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_ZX_COEFS, pXForm.getZXCoeff00() + " " + pXForm.getZXCoeff01() + " " + pXForm.getZXCoeff10() + " " + pXForm.getZXCoeff11() + " " + pXForm.getZXCoeff20() + " " + pXForm.getZXCoeff21()));
    }
    if (pXForm.isHasZXPostCoeffs()) {
        attrList.add(pXB.createAttr(AbstractFlameReader.ATTR_ZX_POST, pXForm.getZXPostCoeff00() + " " + pXForm.getZXPostCoeff01() + " " + pXForm.getZXPostCoeff10() + " " + pXForm.getZXPostCoeff11() + " " + pXForm.getZXPostCoeff20() + " " + pXForm.getZXPostCoeff21()));
    }
    {
        String hs = "";
        for (int i = 0; i < pLayer.getXForms().size() - 1; i++) {
            hs += pXForm.getModifiedWeights()[i] + " ";
        }
        hs += pXForm.getModifiedWeights()[pLayer.getXForms().size() - 1];
        attrList.add(pXB.createAttr("chaos", hs));
    }
    String xName = pXForm.getName().replaceAll("\"", "");
    if (!xName.equals("")) {
        attrList.add(pXB.createAttr("name", xName));
    }
    List<String> blackList = Collections.emptyList();
    writeMotionCurves(pXForm, pXB, attrList, null, blackList);
    return attrList;
}
Also used : MotionCurveAttribute(org.jwildfire.create.tina.animate.AnimationService.MotionCurveAttribute) ArrayList(java.util.ArrayList) MotionCurve(org.jwildfire.create.tina.base.motion.MotionCurve) Variation(org.jwildfire.create.tina.variation.Variation) VariationFunc(org.jwildfire.create.tina.variation.VariationFunc)

Example 27 with VariationFunc

use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.

the class Affine3DMutation method apply.

private void apply(Layer pLayer, double pAmount) {
    XForm xForm;
    if (pLayer.getFinalXForms().size() == 0 || Math.random() < 0.5) {
        xForm = pLayer.getXForms().get(Tools.randomInt(pLayer.getXForms().size()));
    } else {
        xForm = pLayer.getFinalXForms().get(Tools.randomInt(pLayer.getFinalXForms().size()));
    }
    if (pLayer.getOwner().isPreserveZ() && Math.random() > 0.25) {
        boolean hasZScale = false;
        for (Variation var : xForm.getVariations()) {
            if (PostZScaleWFFunc.VAR_NAME.equals(var.getFunc().getName())) {
                hasZScale = true;
                break;
            }
        }
        if (!hasZScale) {
            VariationFunc fnc = VariationFuncList.getVariationFuncInstance(PostZScaleWFFunc.VAR_NAME);
            xForm.addVariation(new Variation(0.001 + Math.random() * 0.1, fnc));
        }
    }
    if (Math.random() < 0.5) {
        if (Math.random() < 0.75) {
            if (Math.random() < 0.5) {
                xForm.setXYCoeff00(xForm.getXYCoeff00() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYCoeff01(xForm.getXYCoeff01() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYCoeff10(xForm.getXYCoeff10() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYCoeff11(xForm.getXYCoeff11() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYCoeff20(xForm.getXYCoeff20() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYCoeff21(xForm.getXYCoeff21() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
        } else {
            if (Math.random() < 0.5) {
                xForm.setXYPostCoeff00(xForm.getXYPostCoeff00() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYPostCoeff01(xForm.getXYPostCoeff01() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYPostCoeff10(xForm.getXYPostCoeff10() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYPostCoeff11(xForm.getXYPostCoeff11() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYPostCoeff20(xForm.getXYPostCoeff20() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
            if (Math.random() < 0.5) {
                xForm.setXYPostCoeff21(xForm.getXYPostCoeff21() + pAmount * (-0.25 + 0.5 * Math.random()));
            }
        }
    } else {
        if (Math.random() < 0.33) {
            XFormTransformService.flipHorizontal(xForm, Math.random() < 0.5);
        }
        if (Math.random() > 0.67) {
            XFormTransformService.flipVertical(xForm, Math.random() < 0.5);
        }
        if (Math.random() < 0.75) {
            XFormTransformService.globalTranslate(xForm, -pAmount + 2 * Math.random() * pAmount, -pAmount + 2 * Math.random() * pAmount, Math.random() < 0.5);
        }
        if (Math.random() < 0.5) {
            XFormTransformService.rotate(xForm, -pAmount * 10.0 + 20.0 * Math.random() * pAmount, Math.random() < 0.5);
        }
        if (Math.random() < 0.5) {
            XFormTransformService.scale(xForm, -pAmount + 2 * Math.random() * pAmount, Math.random() < 0.75, Math.random() < 0.75);
        }
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Variation(org.jwildfire.create.tina.variation.Variation) VariationFunc(org.jwildfire.create.tina.variation.VariationFunc)

Example 28 with VariationFunc

use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.

the class BokehMutation method execute.

@Override
public void execute(Layer pLayer) {
    Flame flame = pLayer.getOwner();
    flame.setCamDOF(0.1 + Math.random() * 0.3);
    flame.setNewCamDOF(true);
    flame.setCamPitch(30 + Math.random() * 20.0);
    flame.setCamYaw(15 - Math.random() * 30.0);
    flame.setCamPerspective(0.05 + Math.random() * 0.2);
    flame.setCamDOFArea(0.2 + Math.random() * 0.5);
    for (Layer layer : flame.getLayers()) {
        Variation crackle = null;
        for (XForm xform : layer.getXForms()) {
            for (int i = xform.getVariationCount() - 1; i >= 0; i--) {
                Variation var = xform.getVariation(i);
                if (var.getFunc().getName().equals(CrackleFunc.VAR_NAME)) {
                    VariationFunc varFunc = var.getFunc();
                    double scale = (Double) varFunc.getParameter(CrackleFunc.PARAM_SCALE);
                    if (MathLib.fabs(scale) < MathLib.EPSILON) {
                        crackle = var;
                        xform.setColor(Math.random());
                        break;
                    }
                }
            }
        }
        if (crackle == null) {
            XForm xform = new XForm();
            xform.setWeight(0.5);
            layer.getXForms().add(xform);
            crackle = xform.addVariation(1.0, VariationFuncList.getVariationFuncInstance(CrackleFunc.VAR_NAME));
            crackle.getFunc().setParameter(CrackleFunc.PARAM_SCALE, 0.0);
        }
        crackle.setAmount(1.0 + Math.random() * 2.0);
        crackle.getFunc().setParameter(CrackleFunc.PARAM_DISTORT, 1.5 + Math.random() * 1.5);
        crackle.getFunc().setParameter(CrackleFunc.PARAM_CELLSIZE, 0.5 + Math.random() * 2.0);
        if (Math.random() < 0.33) {
            flame.setFocusX(0.33 - Math.random() * 0.66);
            flame.setFocusY(0.25 - Math.random() * 0.50);
            flame.setFocusZ(0.1 - Math.random() * 0.2);
        } else {
            flame.setFocusX(0.0);
            flame.setFocusY(0.0);
            flame.setFocusZ(0.0);
        }
        flame.setCamDOFScale(1.5 + Math.random() * 2.0);
        flame.setCamDOFAngle(20.0 * Math.random());
        flame.setCamDOFParam1(0);
        flame.setCamDOFParam2(0);
        flame.setCamDOFParam3(0);
        flame.setCamDOFParam4(0);
        flame.setCamDOFParam5(0);
        double rnd = Math.random();
        if (rnd < 0.08) {
            flame.setCamDOFShape(DOFBlurShapeType.BUBBLE);
            flame.setCamDOFFade(0.6 + Math.random() * 0.4);
        } else if (rnd < 0.16) {
            flame.setCamDOFShape(DOFBlurShapeType.HEART);
            if (Math.random() < 0.25) {
                flame.setCamDOFFade(0.2 + Math.random() * 0.8);
            } else {
                flame.setCamDOFFade(0.0);
            }
        } else if (rnd < 0.24) {
            flame.setCamDOFShape(DOFBlurShapeType.CANNABISCURVE);
            if (Math.random() < 0.25) {
                flame.setCamDOFFade(0.2 + Math.random() * 0.8);
            } else {
                flame.setCamDOFFade(0.0);
            }
        } else if (rnd < 0.32) {
            flame.setCamDOFShape(DOFBlurShapeType.NBLUR);
            flame.setCamDOFFade(0.0);
            // num edges
            flame.setCamDOFParam1(3 + Math.random() * 5);
            if (Math.random() < 0.33) {
                // num stripes
                flame.setCamDOFParam2(2 + Math.random() * 5);
                // ratio stripes
                flame.setCamDOFParam3(1);
                // ratio hole
                flame.setCamDOFParam4(0);
                // circum circle
                flame.setCamDOFParam5(Math.random() < 0.33 ? 1 : 0);
            }
        } else if (rnd < 0.40) {
            flame.setCamDOFShape(DOFBlurShapeType.FLOWER);
            flame.setCamDOFFade(0.0);
            // holes
            flame.setCamDOFParam1(0.3 + Math.random() * 0.2);
            // petals
            flame.setCamDOFParam2(5 + Math.random() * 5);
        } else if (rnd < 0.48) {
            flame.setCamDOFShape(DOFBlurShapeType.CLOVERLEAF);
            if (Math.random() < 0.25) {
                flame.setCamDOFFade(0.2 + Math.random() * 0.8);
            } else {
                flame.setCamDOFFade(0.0);
            }
        } else if (rnd < 0.56) {
            flame.setCamDOFShape(DOFBlurShapeType.SINEBLUR);
            flame.setCamDOFFade(0.0);
            flame.setCamDOFParam1(1.2 + Math.random());
        } else if (rnd < 0.64) {
            flame.setCamDOFShape(DOFBlurShapeType.PERLIN_NOISE);
            flame.setCamDOFFade(0.0);
            // shape
            flame.setCamDOFParam1(Math.random());
            // freqs
            flame.setCamDOFParam2(1.2 + Math.random() * 1.8);
            // amp
            flame.setCamDOFParam3(0.1 + Math.random() * 0.4);
        } else if (rnd < 0.72) {
            flame.setCamDOFFade(0.2 + Math.random() * 0.8);
            flame.setCamDOFShape(DOFBlurShapeType.STARBLUR);
            // power
            flame.setCamDOFParam1(4 + Math.random() * 6);
            // range
            flame.setCamDOFParam2(0.40162283177245455973959534526548);
        } else if (rnd < 0.80) {
            flame.setCamDOFAngle(0.0);
            flame.setCamDOFFade(0.);
            flame.setCamDOFShape(DOFBlurShapeType.TAURUS);
            // r
            flame.setCamDOFParam1(2.5 + Math.random());
            // n
            flame.setCamDOFParam2(4 + Math.random() * 3.0);
            // inv
            flame.setCamDOFParam3(1.25 * Math.random() * 0.5);
            // sor
            flame.setCamDOFParam4(0.9 + Math.random() * 0.2);
        } else if (rnd < 0.9) {
            flame.setCamDOFShape(DOFBlurShapeType.RECT);
            flame.setCamDOFFade(0.0);
            flame.setCamDOFParam1(0.4 + Math.random() * 0.4);
        }
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Variation(org.jwildfire.create.tina.variation.Variation) Layer(org.jwildfire.create.tina.base.Layer) VariationFunc(org.jwildfire.create.tina.variation.VariationFunc) Flame(org.jwildfire.create.tina.base.Flame)

Example 29 with VariationFunc

use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.

the class ExperimentalGnarlRandomFlameGenerator method createExpWaves2Variation.

private VariationFunc createExpWaves2Variation(double scaleX, double scaleY, double freqX, double freqY, double varRnd) {
    VariationFunc w2;
    String varName;
    if (varRnd < 0.6) {
        varName = "waves2_wf";
    } else if (varRnd < 0.8) {
        varName = "waves3_wf";
    } else {
        varName = "waves4_wf";
    }
    w2 = VariationFuncList.getVariationFuncInstance(varName, true);
    if (Math.random() < 0.25) {
        w2.setParameter("use_cos_x", 1);
    } else {
        w2.setParameter("use_cos_x", 0);
    }
    if (Math.random() < 0.25) {
        w2.setParameter("use_cos_y", 1);
    } else {
        w2.setParameter("use_cos_y", 0);
    }
    if (Math.random() < 0.25) {
        w2.setParameter("dampx", -(0.01 + Math.random() * 0.39));
    }
    if (Math.random() < 0.25) {
        w2.setParameter("dampy", -(0.01 + Math.random() * 0.39));
    }
    w2.setParameter("freqx", freqX);
    w2.setParameter("scalex", scaleX);
    w2.setParameter("freqy", freqY);
    w2.setParameter("scaley", scaleY);
    return w2;
}
Also used : VariationFunc(org.jwildfire.create.tina.variation.VariationFunc)

Example 30 with VariationFunc

use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.

the class FilledFlowers3DRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCentreX(0);
    flame.setCentreY(0);
    flame.setCamPitch(37);
    flame.setCamRoll(0);
    flame.setCamYaw(0);
    flame.setPixelsPerUnit(200);
    flame.setCamZoom(2.0);
    flame.setCamPerspective(0.32);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.25 + Math.random() * 0.5);
        {
            xForm.addVariation(0.25 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance("gaussian_blur", true));
        }
        xForm.setColor(0);
        xForm.setColorSymmetry(0);
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(1 + Math.random() * 50.0);
        XFormTransformService.localTranslate(xForm, 0.3 - 0.6 * Math.random(), 0.3 - 0.6 * Math.random(), false);
        XFormTransformService.rotate(xForm, 90.0 + Math.random() * 180.0, false);
        XFormTransformService.scale(xForm, 1.25 + Math.random() * 1.25, true, true, false);
        {
            VariationFunc varFunc;
            xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
            xForm.addVariation(0.01 - Math.random() * 0.02, VariationFuncList.getVariationFuncInstance("epispiral_wf", true));
            xForm.addVariation(0.1 + Math.random() * 0.1, VariationFuncList.getVariationFuncInstance("ztranslate", true));
            xForm.addVariation(0.00001 - Math.random() * 0.00002, VariationFuncList.getVariationFuncInstance("zcone", true));
            {
                String[] fncLst = { "bubble", "log" };
                xForm.addVariation(0.001 + Math.random() * 0.099, VariationFuncList.getVariationFuncInstance(fncLst[Tools.randomInt(fncLst.length)], true));
            }
            {
                String[] fncLst = { "arch", "bipolar", "hyperbolic", "butterfly", "cannabiscurve_wf", "cell", "checks", "circlize", "conic", "coth", "cpow", "ex", "falloff2", "fan", "flux", "foci", "heart", "kaleidoscope", "log", "mobius", "ngon", "pdj", "oscilloscope", "spherical", "spiral" };
                xForm.addVariation(0.001 + Math.random() * 0.099, VariationFuncList.getVariationFuncInstance(fncLst[Tools.randomInt(fncLst.length)], true));
            }
            {
                String[] fncLst = { "waves2", "waves2_wf", "waves3_wf", "waves4_wf" };
                varFunc = VariationFuncList.getVariationFuncInstance(fncLst[Tools.randomInt(fncLst.length)], true);
                varFunc.setParameter("scalex", 0.5 + Math.random());
                varFunc.setParameter("scaley", 0.5 + Math.random());
                varFunc.setParameter("freqx", 1.0 + Math.random() * 2.0);
                varFunc.setParameter("freqy", 1.0 + Math.random() * 2.0);
                xForm.addVariation(0.05 - Math.random() * 0.1, varFunc);
            }
            {
                String[] fncLst = { "cross", "checks", "conic", "kaleidoscope", "lazysusan", "log" };
                xForm.addVariation(0.001 + Math.random() * 0.015, VariationFuncList.getVariationFuncInstance(fncLst[Tools.randomInt(fncLst.length)], true));
            }
        }
        xForm.setColor(0.33);
        xForm.setColorSymmetry(0);
    }
    // blur xForms
    {
        int blurCount = Tools.randomInt(5);
        double weight = 0.25 + Math.random() * 0.5;
        for (int i = 0; i < blurCount; i++) {
            XForm xForm = new XForm();
            layer.getXForms().add(xForm);
            xForm.setWeight(weight);
            weight *= 0.75;
            xForm.addVariation(0.25 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance("gaussian_blur", true));
            xForm.setColor(0);
            xForm.setColorSymmetry(0);
            XFormTransformService.localTranslate(xForm, 0.3 - 0.6 * Math.random(), 0.3 - 0.6 * Math.random(), true);
        }
    }
    // satellite xForm
    {
        String[] fncLst = { "blade", "blur", "blur3D", "bubble_wf", "cannabiscurve_wf", "circlecrop", "cloverleaf_wf", "conic", "crop", "cross", "flower", "flux", "hemisphere", "hyperbolic", "julia3D", "julia3Dz", "lazysusan", "lissajous", "log", "mandelbrot", "mobius", "npolar", "pdj", "perspective", "pie", "pie3D", "polar", "polar2", "power", "pre_subflame_wf", "radial_blur", "scry", "separation", "spiral", "spirograph", "split", "tangent", "tangent3D", "twintrian", "unpolar", "wedge_sph", "zblur" };
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.1 + Math.random() * 1.4);
        XFormTransformService.localTranslate(xForm, 0.3 - 0.6 * Math.random(), 0.3 - 0.6 * Math.random(), true);
        switch(Tools.randomInt(3)) {
            case 0:
                xForm.addVariation(0.05 + Math.random() * 0.15, VariationFuncList.getVariationFuncInstance("bubble", true));
                xForm.addVariation(0.01 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance(fncLst[Tools.randomInt(fncLst.length)], true));
                break;
            case 1:
                xForm.addVariation(0.05 + Math.random() * 0.15, VariationFuncList.getVariationFuncInstance("bubble", true));
                break;
            default:
                xForm.addVariation(0.05 + Math.random() * 0.15, VariationFuncList.getVariationFuncInstance(fncLst[Tools.randomInt(fncLst.length)], true));
                break;
        }
        xForm.addVariation(0.05 + Math.random() * 0.15, VariationFuncList.getVariationFuncInstance("bubble", true));
        xForm.setColor(0);
        xForm.setColorSymmetry(0.8 + Math.random() * 0.2);
    }
    // final xForm
    {
        XForm xForm = new XForm();
        layer.getFinalXForms().add(xForm);
        {
            VariationFunc varFunc;
            xForm.addVariation(0.05 + Math.random() * 0.2, VariationFuncList.getVariationFuncInstance("zscale", true));
            varFunc = VariationFuncList.getVariationFuncInstance("julia3D", true);
            varFunc.setParameter("power", Math.random() < 0.5 ? -3 : -4);
            xForm.addVariation(1, varFunc);
            varFunc = VariationFuncList.getVariationFuncInstance("pre_circlecrop", true);
            varFunc.setParameter("radius", 10000);
            varFunc.setParameter("zero", Math.random() < 0.5 ? 1 : 0);
            xForm.addVariation(1, varFunc);
        }
    }
    return flame;
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Layer(org.jwildfire.create.tina.base.Layer) VariationFunc(org.jwildfire.create.tina.variation.VariationFunc) Flame(org.jwildfire.create.tina.base.Flame)

Aggregations

VariationFunc (org.jwildfire.create.tina.variation.VariationFunc)43 XForm (org.jwildfire.create.tina.base.XForm)34 Layer (org.jwildfire.create.tina.base.Layer)31 Flame (org.jwildfire.create.tina.base.Flame)30 Variation (org.jwildfire.create.tina.variation.Variation)9 ArrayList (java.util.ArrayList)4 MotionCurve (org.jwildfire.create.tina.base.motion.MotionCurve)4 Field (java.lang.reflect.Field)3 List (java.util.List)3 RandomGradientMutation (org.jwildfire.create.tina.mutagen.RandomGradientMutation)3 Map (java.util.Map)2 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)2 JuliaNFunc (org.jwildfire.create.tina.variation.JuliaNFunc)2 Font (java.awt.Font)1 XMLAttribute (org.jwildfire.base.Tools.XMLAttribute)1 XMLAttributes (org.jwildfire.base.Tools.XMLAttributes)1 AnimAware (org.jwildfire.create.tina.animate.AnimAware)1 MotionCurveAttribute (org.jwildfire.create.tina.animate.AnimationService.MotionCurveAttribute)1 SolidRenderSettings (org.jwildfire.create.tina.base.solidrender.SolidRenderSettings)1 FlameWriter (org.jwildfire.create.tina.io.FlameWriter)1