Search in sources :

Example 16 with XForm

use of org.jwildfire.create.tina.base.XForm in project JWildfire by thargor6.

the class BrokatRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    flame.setCentreX(0.0);
    flame.setCentreY(0.0);
    flame.setPixelsPerUnit(200);
    flame.setCamZoom(2.0);
    flame.setCamRoll(-90.0);
    Layer layer = flame.getFirstLayer();
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(1.5 + Math.random() * 1.0);
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("curl", true);
        varFunc.setParameter("c1", -1.0);
        varFunc.setParameter("c2", 0.001 + Math.random() * 0.0199);
        xForm.addVariation(1.6 + Math.random() * 0.8, varFunc);
        xForm.setColor(0.4 + Math.random() * 0.2);
        xForm.setColorSymmetry(0.82 + Math.random() * 0.16);
        XFormTransformService.rotate(xForm, 180, false);
        XFormTransformService.localTranslate(xForm, 1.0, 0.0, true);
        xForm.getModifiedWeights()[0] = 0.0;
        xForm.getModifiedWeights()[1] = 1.0;
        xForm.getModifiedWeights()[2] = 0.0;
        xForm.getModifiedWeights()[3] = 0.0;
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.05 + Math.random() * 0.35);
        String[] fncNames = { "juliascope", "julia3D", "julia3Dz", "julian" };
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(fncNames[Tools.randomInt(fncNames.length)], true);
        varFunc.setParameter("power", Math.random() < 0.33 ? 2 : Math.random() < 0.5 ? 3 : 4);
        xForm.addVariation(1.0, varFunc);
        xForm.setColor(0.5 + Math.random() * 0.5);
        xForm.setColorSymmetry(0.5);
        xForm.getModifiedWeights()[0] = 1.0;
        xForm.getModifiedWeights()[1] = 0.0;
        xForm.getModifiedWeights()[2] = 1.0;
        xForm.getModifiedWeights()[3] = 1.0;
    }
    // 3rd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.4 + Math.random() * 0.2);
        String fncName;
        if (Math.random() < 0.33) {
            fncName = "bubble";
        } else {
            fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length)];
        }
        xForm.addVariation(0.01 + Math.random() * 0.04, VariationFuncList.getVariationFuncInstance(fncName, true));
        xForm.addVariation(5.0 + Math.random() * 10.0, VariationFuncList.getVariationFuncInstance("pre_blur", true));
        xForm.setColor(0.1 + Math.random() * 0.3);
        xForm.setColorSymmetry(0);
        XFormTransformService.localTranslate(xForm, -1.0, 0.0, true);
        xForm.getModifiedWeights()[0] = 1.0;
        xForm.getModifiedWeights()[1] = 1.0;
        xForm.getModifiedWeights()[2] = 0.0;
        xForm.getModifiedWeights()[3] = 0.0;
    }
    // 4th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.4 + Math.random() * 0.2);
        String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length)];
        xForm.addVariation(0.01 + Math.random() * 0.04, VariationFuncList.getVariationFuncInstance(fncName, true));
        if (Math.random() > 0.5) {
            xForm.addVariation((0.01 + Math.random() * 0.04) * 0.5, VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true)).setPriority(-1);
        }
        xForm.setColor(0.1 + Math.random() * 0.3);
        xForm.setColorSymmetry(0);
        XFormTransformService.rotate(xForm, Math.random() * 360.0, true);
        XFormTransformService.scale(xForm, 1.1 + Math.random() * 3.0, true, true, true);
        xForm.getModifiedWeights()[0] = 1.0;
        xForm.getModifiedWeights()[1] = 1.0;
        xForm.getModifiedWeights()[2] = 1.0;
        xForm.getModifiedWeights()[3] = 1.0;
    }
    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)

Example 17 with XForm

use of org.jwildfire.create.tina.base.XForm in project JWildfire by thargor6.

the class BubblesRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCentreX(0.0);
    flame.setCentreY(0.0);
    flame.setCamZoom(0.5);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    int fncCount = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(12.0 + Math.random() * 80.0);
        xForm.addVariation(2 + Math.random() * 4, VariationFuncList.getVariationFuncInstance("spherical", true));
        String fName;
        if (Math.random() < 0.15) {
            fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(fncCount)];
        } else {
            fName = Math.random() < 0.8 ? "eyefish" : "fisheye";
        }
        xForm.addVariation(0.05 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance(fName, true));
        xForm.setColorSymmetry(0.991 + Math.random() * 0.08);
        XFormTransformService.scale(xForm, 0.5 - Math.random() * 0.5, true, true, false);
        XFormTransformService.rotate(xForm, 180 - Math.random() * 360.0, false);
        XFormTransformService.localTranslate(xForm, 3.0 - 6.0 * Math.random(), 3.0 - 6.0 * Math.random(), false);
        if (Math.random() < 0.33) {
            XFormTransformService.localTranslate(xForm, 0.75 - 1.5 * Math.random(), 0.75 - 1.5 * Math.random(), true);
        }
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5 + Math.random() * 0.8);
        if (Math.random() < 0.05) {
            xForm.addVariation(0.01 + Math.random() * 0.4, VariationFuncList.getVariationFuncInstance("bubble", true));
            VariationFunc checks = VariationFuncList.getVariationFuncInstance("checks", true);
            checks.setParameter("size", 5.0);
            checks.setParameter("x", 3.0);
            checks.setParameter("y", 3.0);
            xForm.addVariation(0.01 + Math.random() * 0.04, checks);
        } else {
            xForm.addVariation(0.1 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance("bubble", true));
        }
        xForm.addVariation(4 + Math.random() * 2, VariationFuncList.getVariationFuncInstance("pre_blur", true));
        xForm.setColorSymmetry(-0.5);
        XFormTransformService.scale(xForm, 1.1 + Math.random() * 1.9, true, true, false);
        XFormTransformService.localTranslate(xForm, 0.75 - 1.50 * Math.random(), 0.75 - 1.50 * Math.random(), false);
        XFormTransformService.rotate(xForm, 30 - Math.random() * 60.0, false);
    }
    // 3rd xForm
    if (Math.random() > 0.25) {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5 + Math.random() * 1.5);
        String fName;
        if (Math.random() > 0.8) {
            fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(fncCount)];
        } else {
            fName = Math.random() > 0.5 ? "linear3D" : "noise";
        }
        xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance(fName, true));
        xForm.setColorSymmetry(-0.5);
        XFormTransformService.rotate(xForm, 30.0 - Math.random() * 60.0, false);
        if (Math.random() < 0.5) {
            XFormTransformService.scale(xForm, 0.5 + Math.random() * 1.5, true, true, false);
        }
    }
    // 4th xForm
    if (Math.random() > 0.5) {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5 + Math.random() * 1.5);
        String fName;
        if (Math.random() > 0.8) {
            fName = Math.random() > 0.75 ? VariationFuncList.getRandomVariationname() : ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(fncCount)];
        } else {
            fName = Math.random() > 0.5 ? "linear3D" : "gaussian_blur";
        }
        xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance(fName, true));
        xForm.setColorSymmetry(-0.5);
        XFormTransformService.rotate(xForm, 30.0 - Math.random() * 60.0, false);
        if (Math.random() < 0.5) {
            XFormTransformService.scale(xForm, 0.15 + Math.random() * 1.25, true, true, false);
        }
    }
    flame.getFirstLayer().distributeColors();
    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)

Example 18 with XForm

use of org.jwildfire.create.tina.base.XForm in project JWildfire by thargor6.

the class CrossRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    // Bases loosely on the W2R Batch Script by parrotdolphin.deviantart.com */
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCentreX(0.0);
    flame.setCentreY(0.0);
    if (Math.random() > 0.6) {
        flame.setNewCamDOF(true);
        flame.setCamDOF(Math.random() * 0.07);
    } else {
        flame.setNewCamDOF(false);
        flame.setCamDOF(Math.random() * 0.2);
    }
    flame.setCamPitch(10 + Math.random() * 50);
    flame.setPreserveZ(Math.random() > 0.33);
    flame.setCamPerspective(0.10 + Math.random() * 0.5);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // create transform 1
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.setColorSymmetry(0.99 - Math.random() * 0.2);
        // a
        xForm.setCoeff00(1);
        // b
        xForm.setCoeff10(0);
        // e
        xForm.setCoeff20(0);
        // c
        xForm.setCoeff01(0);
        // d
        xForm.setCoeff11(1);
        // f
        xForm.setCoeff21(0);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(1);
        xForm.setPostCoeff21(-1);
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
    }
    // create transform 2
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.setColorSymmetry(0.8 - Math.random() * 0.1);
        // a
        xForm.setCoeff00(1);
        // b
        xForm.setCoeff10(0);
        // e
        xForm.setCoeff20(0);
        // c
        xForm.setCoeff01(0);
        // d
        xForm.setCoeff11(1);
        // f
        xForm.setCoeff21(0);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(-1);
        xForm.setPostCoeff21(-1);
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
    }
    // create transform 3
    {
        XForm xForm = new XForm();
        xForm.setWeight(0.5);
        layer.getXForms().add(xForm);
        xForm.setColor(0.1 + Math.random() * 0.1);
        xForm.setColorSymmetry(0.92);
        // a
        xForm.setCoeff00(1);
        // b
        xForm.setCoeff10(0);
        // e
        xForm.setCoeff20(0);
        // c
        xForm.setCoeff01(0);
        // d
        xForm.setCoeff11(1);
        // f
        xForm.setCoeff21(0);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(-1);
        xForm.setPostCoeff21(1);
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
    }
    // create transform 4
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.setColorSymmetry(0.9 - Math.random() * 0.2);
        // a
        xForm.setCoeff00(1);
        // b
        xForm.setCoeff10(0);
        // e
        xForm.setCoeff20(0);
        // c
        xForm.setCoeff01(0);
        // d
        xForm.setCoeff11(1);
        // f
        xForm.setCoeff21(0);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(1);
        xForm.setPostCoeff21(1);
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
    }
    // create transform 5
    XForm xForm5;
    {
        XForm xForm = xForm5 = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.05 + Math.random() * 0.2);
        xForm.setColorSymmetry(0.10 + Math.random() * 0.2);
        // a
        xForm.setCoeff00(1);
        // b
        xForm.setCoeff10(0);
        // e
        xForm.setCoeff20(0);
        // c
        xForm.setCoeff01(0);
        // d
        xForm.setCoeff11(1);
        // f
        xForm.setCoeff21(0);
        xForm.setPostCoeff00(0.70711);
        xForm.setPostCoeff10(0.70711);
        xForm.setPostCoeff01(-0.70711);
        xForm.setPostCoeff11(0.70711);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.45, varFunc);
        }
    }
    // create optional linked transform 6
    if (Math.random() > 0.75) {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.05 + Math.random() * 0.2);
        xForm.setColorSymmetry(0.10 + Math.random() * 0.2);
        // a
        xForm.setCoeff00(1);
        // b
        xForm.setCoeff10(0);
        // e
        xForm.setCoeff20(0);
        // c
        xForm.setCoeff01(0);
        // d
        xForm.setCoeff11(1);
        // f
        xForm.setCoeff21(0);
        xForm.setPostCoeff00(0.70711);
        xForm.setPostCoeff10(0.70711);
        xForm.setPostCoeff01(-0.70711);
        xForm.setPostCoeff11(0.70711);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        xForm.getModifiedWeights()[5] = 0;
        xForm5.getModifiedWeights()[0] = 0;
        xForm5.getModifiedWeights()[1] = 0;
        xForm5.getModifiedWeights()[2] = 0;
        xForm5.getModifiedWeights()[3] = 0;
        xForm5.getModifiedWeights()[4] = 0;
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.1 + Math.random() * 0.6, varFunc);
        }
    }
    // create final transform 1
    {
        XForm xForm = new XForm();
        layer.getFinalXForms().add(xForm);
        xForm.setWeight(0);
        xForm.setColorSymmetry(0);
        // a
        xForm.setCoeff00(1);
        // b
        xForm.setCoeff10(0);
        // e
        xForm.setCoeff20(0);
        // c
        xForm.setCoeff01(0);
        // d
        xForm.setCoeff11(1);
        // f
        xForm.setCoeff21(0);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        XFormTransformService.rotate(xForm, Math.random() * 360.0, true);
        XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), true);
        if (Math.random() > 0.75) {
            String[] variations = { "cross", "boarders2", "boarders", "butterfly", "cos", "cosh", "cosine", "csc", "cylinder", "cylinder_apo", "dc_ztransl", "elliptic", "eyefish", "fibonacci2", "heart_wf", "hypertile1", "loonie", "mobius", "perspective", "popcorn", "popcorn2_3D", "ripple", "roundspher3D", "scry_3D", "sec", "secant2", "separation", "shredlin", "sin", "spherical", "spiral", "stripes", "unpolar", "waves2", "waves4_wf", "whorl", "xtrb", "rays1", "rays2", "rays3" };
            String varName = Math.random() < 0.25 ? "cross" : Math.random() < 0.25 ? "rays2" : variations[(int) (Math.random() * variations.length)];
            xForm.addVariation(1.57, VariationFuncList.getVariationFuncInstance(varName, true));
        } else {
            xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true));
        }
    }
    layer.randomizeColors();
    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)

Example 19 with XForm

use of org.jwildfire.create.tina.base.XForm in project JWildfire by thargor6.

the class ExperimentalSimpleRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCentreX(0.0);
    flame.setCentreY(0.0);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    int maxXForms = (int) (1.0 + Math.random() * 5.0);
    double scl = 1.0;
    for (int i = 0; i < maxXForms; i++) {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        if (Math.random() < 0.5) {
            XFormTransformService.rotate(xForm, 360.0 * Math.random());
        } else {
            XFormTransformService.rotate(xForm, -360.0 * Math.random());
        }
        XFormTransformService.localTranslate(xForm, Math.random() - 1.0, Math.random() - 1.0);
        scl *= 0.75 + Math.random() / 4;
        XFormTransformService.scale(xForm, scl, true, true);
        xForm.setColor(Math.random());
        xForm.addVariation(Math.random() * 0.3 + 0.2, new Linear3DFunc());
        if (Math.random() > 0.1) {
            String[] fnc = FNCLST_EXPERIMENTAL;
            int fncIdx = (int) (Math.random() * fnc.length);
            xForm.addVariation(0.2 + Math.random() * 0.6, VariationFuncList.getVariationFuncInstance(fnc[fncIdx], true));
        }
        xForm.setWeight(Math.random() * 0.9 + 0.1);
    }
    return flame;
}
Also used : Linear3DFunc(org.jwildfire.create.tina.variation.Linear3DFunc) XForm(org.jwildfire.create.tina.base.XForm) Layer(org.jwildfire.create.tina.base.Layer) Flame(org.jwildfire.create.tina.base.Flame)

Example 20 with XForm

use of org.jwildfire.create.tina.base.XForm in project JWildfire by thargor6.

the class Flowers3DRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCentreX(0.0);
    flame.setCentreY(0.0);
    flame.setCamPitch(49.0);
    flame.setCamYaw(12.0);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // int fncCount = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5 + Math.random());
        xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance("gaussian_blur", true));
        xForm.setColor(0.0);
        xForm.setColorSymmetry(0.0);
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(3.0 + Math.random() * 10.0);
        if (Math.random() < 0.33) {
            xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        } else {
            VariationFunc f = VariationFuncList.getVariationFuncInstance("linearT3D", true);
            double x = 2.0 * Math.random() - 0.5;
            f.setParameter("powX", x);
            f.setParameter("powY", x);
            f.setParameter("powZ", 2.0 * Math.random() - 0.5);
            xForm.addVariation(1.0, f);
        }
        xForm.addVariation(0.1 + Math.random() * 0.3, VariationFuncList.getVariationFuncInstance("spherical", true));
        xForm.addVariation(0.2 + Math.random() * 0.9, VariationFuncList.getVariationFuncInstance("zcone", true));
        xForm.addVariation(0.01 + 0.045 * Math.random(), VariationFuncList.getVariationFuncInstance("cross", true));
        if (Math.random() < 0.33) {
            VariationFunc ef = VariationFuncList.getVariationFuncInstance("epispiral_wf", true);
            ef.setParameter("waves", 3 + Tools.randomInt(10));
            xForm.addVariation(0.02 + 0.29 * Math.random(), ef);
            if (Math.random() < 0.33) {
                VariationFunc ef2 = VariationFuncList.getVariationFuncInstance("epispiral", true);
                ef2.setParameter("thickness", 0.05 + Math.random() * 0.15);
                ef2.setParameter("n", 3.0 + Math.random() * 10.0);
                xForm.addVariation(0.01 + 0.14 * Math.random(), ef2);
            }
        }
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(Math.random());
        XFormTransformService.scale(xForm, 1.0 + (0.1 - Math.random() * 0.2), true, true, false);
        XFormTransformService.rotate(xForm, 45.0 - Math.random() * 90.0, false);
        XFormTransformService.localTranslate(xForm, 0.01 - 0.02 * Math.random(), 0.01 - 0.02 * Math.random(), false);
    }
    // 3rd xForm
    boolean advStructure = Math.random() > 0.25;
    if (advStructure) {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.3 + Math.random() * 0.3);
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("blob3D", true);
        varFunc.setParameter("low", 0.1);
        varFunc.setParameter("high", 0.3);
        varFunc.setParameter("waves", 9.0);
        xForm.addVariation(0.05, varFunc);
        xForm.setColor(0.0);
        xForm.setColorSymmetry(1.0);
    // 4th xForm
    }
    if (advStructure && Math.random() > 0.25) {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.1 + Math.random() * 0.3);
        xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance("blur3D", true));
        xForm.addVariation(15.0, VariationFuncList.getVariationFuncInstance("ztranslate", true));
        xForm.setColor(0.0);
        xForm.setColorSymmetry(1.0);
    }
    // final xForm
    {
        XForm xForm = new XForm();
        layer.getFinalXForms().add(xForm);
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("julia3D", true);
        double power = -2.0;
        if (Math.random() < 0.25) {
            power -= Math.random() * 4.0;
        }
        varFunc.setParameter("power", power);
        xForm.addVariation(2.0 + (1.0 - 2.0 * Math.random()), varFunc);
        xForm.setColor(0.0);
        xForm.setColorSymmetry(0.0);
    }
    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

XForm (org.jwildfire.create.tina.base.XForm)121 Layer (org.jwildfire.create.tina.base.Layer)73 Flame (org.jwildfire.create.tina.base.Flame)55 VariationFunc (org.jwildfire.create.tina.variation.VariationFunc)34 XYZPoint (org.jwildfire.create.tina.base.XYZPoint)19 Variation (org.jwildfire.create.tina.variation.Variation)15 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)7 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)7 FlameWriter (org.jwildfire.create.tina.io.FlameWriter)6 Linear3DFunc (org.jwildfire.create.tina.variation.Linear3DFunc)6 RandomGradientMutation (org.jwildfire.create.tina.mutagen.RandomGradientMutation)4 RGBPalette (org.jwildfire.create.tina.palette.RGBPalette)4 ZigguratRandomGenerator (org.jwildfire.create.tina.random.ZigguratRandomGenerator)4 FlameRenderer (org.jwildfire.create.tina.render.FlameRenderer)4 Field (java.lang.reflect.Field)3 SubFlameWFFunc (org.jwildfire.create.tina.variation.SubFlameWFFunc)3 DefaultTableModel (javax.swing.table.DefaultTableModel)2 QualityProfile (org.jwildfire.base.QualityProfile)2 ResolutionProfile (org.jwildfire.base.ResolutionProfile)2