Search in sources :

Example 6 with VariationFunc

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

the class Spherical3DRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCentreX(0.0);
    flame.setCentreY(-0.20);
    flame.setCamPitch(48.0);
    flame.setCamYaw(112.0);
    flame.setCamZoom(3.6);
    flame.setCamPerspective(0.32);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    flame.setPreserveZ(Math.random() < 0.5);
    boolean invert = Math.random() > 0.5;
    VariationFunc varFunc;
    // 1st xForm
    XForm xForm1;
    {
        XForm xForm = xForm1 = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(1.0 + 4.0 * Math.random());
        varFunc = VariationFuncList.getVariationFuncInstance("spherical3D_wf", true);
        if (invert) {
            varFunc.setParameter("invert", 1);
        }
        xForm.addVariation(1.0, varFunc);
        XFormTransformService.rotate(xForm, Math.random() < 0.5 ? 90.0 : -90.0, false);
        XFormTransformService.globalTranslate(xForm, 1.0, 0.0, false);
        xForm.setColor(1.0);
        xForm.setColorSymmetry(0.9 + Math.random() * 0.1);
    }
    // 2nd xForm
    XForm xForm2;
    {
        XForm xForm = xForm2 = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5 + Math.random() * 4.5);
        varFunc = VariationFuncList.getVariationFuncInstance("spherical3D_wf", true);
        if (invert) {
            varFunc.setParameter("invert", 1);
        }
        xForm.addVariation(1.0, varFunc);
        XFormTransformService.rotate(xForm, 90.0, false);
        xForm.setColor(0.5);
        xForm.setColorSymmetry(0.9 + Math.random() * 0.1);
    }
    String cylinderVar = Math.random() < 0.5 ? "cylinder" : "cylinder_apo";
    // 3rd xForm
    String[] fncList = { "bipolar", "blade", "blur", "blur3D", "cannabiscurve_wf", "crackle", "cylinder", "cylinder_apo", "edisc", "flower", "glynnSim2", "julia3D", "mandelbrot", "modulus", "noise", "parabola", "pie", "pie3D", "checks", "pre_subflame_wf", "radial_blur", "rays", "rings", "rose_wf", "secant2", "sinusoidal", "spiral", "spirograph", "splits", "square", "twintrian", "wedge_julia" };
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(0.25 + 0.25 * Math.random(), VariationFuncList.getVariationFuncInstance("pre_blur", true));
        xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance("ztranslate", true));
        String fnc = Math.random() < 0.66 ? cylinderVar : fncList[(int) (Math.random() * fncList.length)];
        xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance(fnc, true));
        XFormTransformService.scale(xForm, 5.0, false, true, true);
        xForm.setColor(1.0);
        xForm.setColorSymmetry(-1.0);
    }
    // 4th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(0.025 + 0.025 * Math.random(), VariationFuncList.getVariationFuncInstance("pre_blur", true));
        xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance("ztranslate", true));
        String fnc = Math.random() < 0.33 ? cylinderVar : fncList[(int) (Math.random() * fncList.length)];
        xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance(fnc, true));
        XFormTransformService.scale(xForm, 3.0, false, true, true);
        xForm.setColor(1.0);
        xForm.setColorSymmetry(-1.0);
    }
    // 5th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.1);
        xForm.addVariation(0.005 + Math.random() * 0.005, VariationFuncList.getVariationFuncInstance("gaussian_blur", true));
        xForm.addVariation(0.005 + Math.random() * 0.005, VariationFuncList.getVariationFuncInstance("ztranslate", true));
        XFormTransformService.globalTranslate(xForm, 0.3, 0.0, true);
        xForm.setColor(1.0);
        xForm.setColorSymmetry(-1.0);
    }
    // 6th (final) xForm
    if (Math.random() < 0.5) {
        XForm xForm = new XForm();
        layer.getFinalXForms().add(xForm);
        xForm.setWeight(0.1);
        int power;
        int style = Tools.randomInt(3);
        switch(style) {
            case 0:
            case 1:
                varFunc = VariationFuncList.getVariationFuncInstance(style == 1 ? "julia3D" : "julia3Dz", true);
                power = -4 + Tools.randomInt(9);
                varFunc.setParameter("power", power != 0 ? power : 0);
                if (Math.random() > 0.5) {
                    xForm.addVariation(0.005 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance("linear3D", true));
                }
                break;
            default:
                varFunc = VariationFuncList.getVariationFuncInstance("spherical3D_wf", true);
                if (Math.random() < 0.5) {
                    varFunc.setParameter("invert", 1);
                }
        }
        xForm.addVariation(0.25 + Math.random() * 0.75, varFunc);
        XFormTransformService.rotate(xForm, 45.0, false);
        XFormTransformService.globalTranslate(xForm, 0.0, 0.25, false);
        XFormTransformService.globalTranslate(xForm, 0.0, -0.25, true);
        xForm.setColor(1.0);
        xForm.setColorSymmetry(0.5 + Math.random() * 0.5);
    }
    if (Math.random() > 0.5) {
        xForm1.getModifiedWeights()[3] = 0;
        xForm1.getModifiedWeights()[4] = 0;
        xForm2.getModifiedWeights()[3] = 0;
        xForm2.getModifiedWeights()[4] = 0;
    }
    flame.getFirstLayer().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 7 with VariationFunc

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

the class SpiralsRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    flame.setCentreX(-Math.random() * 0.5);
    flame.setCentreY(-Math.random() * 0.5);
    flame.setPixelsPerUnit(200);
    flame.setCamRoll(90.0 - Math.random() * 180);
    flame.setCamPitch(0);
    flame.setCamYaw(0);
    flame.setCamPerspective(0);
    flame.setCamZoom(2.0);
    Layer layer = flame.getFirstLayer();
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(25.0 + Math.random() * 55.0);
        xForm.setColor(0.9);
        xForm.setColorSymmetry(0.93185856);
        // a
        xForm.setCoeff00(0.23168009);
        // b
        xForm.setCoeff10(-0.87153216);
        // e
        xForm.setCoeff20(-1.09851548);
        // c
        xForm.setCoeff01(1.01859563);
        // d
        xForm.setCoeff11(0.23718475);
        // f
        xForm.setCoeff21(0.30609214);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        // variation 1
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("waves2", true);
            varFunc.setParameter("scalex", 0.04933602 + Math.random() * 0.04);
            varFunc.setParameter("scaley", 0.06933602);
            varFunc.setParameter("freqx", 2.98088993);
            varFunc.setParameter("freqy", 2.98088993);
            xForm.addVariation(1, varFunc);
        }
        // variation 2
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.001 + Math.random() * 0.001, varFunc);
        }
        // variation 3
        if (Math.random() < 0.33) {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.0001 + Math.random() * 0.0001, varFunc).setPriority(-1);
        }
        xForm.setColor(0.4 + Math.random() * 0.2);
        xForm.setColorSymmetry(0.82 + Math.random() * 0.16);
        // XFormTransformService.rotate(xForm, 180, false);
        // XFormTransformService.scale(xForm, 2.0 + Math.random() * 25.0, true, true, false);
        XFormTransformService.localTranslate(xForm, 0.5 * (0.5 - 1.0 * Math.random()), 0.5 - 1.0 * Math.random(), true);
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.setColor(0);
        xForm.setColorSymmetry(-1);
        // a
        xForm.setCoeff00(1.1144261);
        // b
        xForm.setCoeff10(-0.1144261);
        // e
        xForm.setCoeff20(-0.1144261);
        // c
        xForm.setCoeff01(0.03033403);
        // d
        xForm.setCoeff11(0.96966597);
        // f
        xForm.setCoeff21(-0.03033403);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        // variation 1
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.2 + Math.random() * 0.2, varFunc);
        }
        // variation 2
        if (Math.random() > 0.42) {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.1 + Math.random() * 0.1, varFunc).setPriority(-1);
        }
        // variation 3
        if (Math.random() > 0.42) {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.0001 + Math.random() * 0.0001, varFunc).setPriority(+1);
        }
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(Math.random());
    }
    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 8 with VariationFunc

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

the class SplitsRandomFlameGenerator 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(0.0);
    flame.setCamRoll(00.0);
    flame.setCamYaw(0.0);
    flame.setCamZoom(2.0);
    flame.setGamma(2.7);
    flame.setCamPerspective(0.0);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    VariationFunc varFunc;
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5 + 0.4 * Math.random());
        String fncName = FNCLST_TX1[Tools.randomInt(FNCLST_TX1.length)];
        varFunc = VariationFuncList.getVariationFuncInstance(fncName, true);
        xForm.addVariation(1.0, varFunc);
        XFormTransformService.rotate(xForm, Math.random() < 0.5 ? 90.0 : -90.0, false);
        xForm.setColor(0.60 + Math.random() * 0.20);
        xForm.setColorSymmetry(Math.random() * 0.2);
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        varFunc = VariationFuncList.getVariationFuncInstance("splits", true);
        if (Math.random() < 0.25) {
            varFunc.setParameter("x", -0.5 + Math.random() * 1.0);
            varFunc.setParameter("y", -0.5 + Math.random() * 1.0);
        } else {
            varFunc.setParameter("x", -1.0 + Math.random() * 4.0);
            varFunc.setParameter("y", 0.0);
        }
        xForm.addVariation(1.0, varFunc);
        XFormTransformService.scale(xForm, 0.6 + Math.random() * 0.8, true, true, false);
        XFormTransformService.scale(xForm, 1.0 + Math.random() * 0.8, true, true, true);
        xForm.setColor(0.40 + Math.random() * 0.20);
    }
    // 3th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.2 + 0.4 * Math.random());
        String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length)];
        // String fncName = Math.random() < 0.5 ? "linear" : "cylinder";
        varFunc = VariationFuncList.getVariationFuncInstance(fncName, true);
        xForm.addVariation(1.0, varFunc);
        // XFormTransformService.scale(xForm, 5.0 + Math.random() * 10.0, false, true, true);
        // XFormTransformService.scale(xForm, 0.5 + Math.random() * 0.75, true, false, true);
        // XFormTransformService.scale(xForm, 0.2 + Math.random() * 0.8, true, true, false);
        XFormTransformService.rotate(xForm, Math.random() < 0.5 ? 90.0 : -90.0, false);
        xForm.setColor(0.60 + Math.random() * 0.20);
        xForm.setColorSymmetry(Math.random() * 0.2);
    }
    // 4th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.3 + 0.8 * Math.random());
        // String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length * Math.random())];
        String fncName = Math.random() < 0.5 ? "noise" : "cylinder";
        varFunc = VariationFuncList.getVariationFuncInstance(fncName, true);
        xForm.addVariation(1.0, varFunc);
        XFormTransformService.scale(xForm, 5.0 + Math.random() * 10.0, false, true, true);
        XFormTransformService.scale(xForm, 0.5 + Math.random() * 0.75, true, false, true);
        XFormTransformService.scale(xForm, 0.2 + Math.random() * 0.8, true, true, false);
        xForm.setColor(0.60 + Math.random() * 0.20);
        xForm.setColorSymmetry(Math.random() * 0.2);
    }
    // flame.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 9 with VariationFunc

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

the class SubFlameRandomFlameGenerator method embedFlame.

public Flame embedFlame(Flame pSubFlame) throws Exception {
    Flame flame = new Flame();
    flame.assign(pSubFlame);
    Layer layer = flame.getFirstLayer();
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    flame.getFirstLayer().setPalette(pSubFlame.getFirstLayer().getPalette().makeCopy());
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        {
            {
                SubFlameWFFunc var = new SubFlameWFFunc();
                String flameXML = new FlameWriter().getFlameXML(pSubFlame);
                var.setRessource("flame", flameXML.getBytes());
                xForm.addVariation(1, var);
            }
        }
        xForm.setColor(0);
        xForm.setColorSymmetry(-0.22);
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.25 + Math.random() * 0.5);
        xForm.setCoeff00(0.17254603006834707);
        xForm.setCoeff01(0.6439505508593787);
        xForm.setCoeff10(-0.6439505508593787);
        xForm.setCoeff11(0.17254603006834707);
        xForm.setCoeff20(1.5 + Math.random() * 2.5);
        xForm.setCoeff21(-0.25 - Math.random() * 0.35);
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(-0.62);
    }
    // 3rd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.25 + Math.random() * 0.5);
        xForm.setCoeff00(0.17254603006834707);
        xForm.setCoeff01(0.6439505508593787);
        xForm.setCoeff10(-0.6439505508593787);
        xForm.setCoeff11(0.17254603006834707);
        xForm.setCoeff20(-3.0);
        xForm.setCoeff21(0.3);
        {
            VariationFunc varFunc;
            varFunc = VariationFuncList.getVariationFuncInstance("curl3D", true);
            varFunc.setParameter("cx", -0.2 + 0.4 * Math.random());
            varFunc.setParameter("cy", 0);
            varFunc.setParameter("cz", 0);
            xForm.addVariation(1, varFunc);
        }
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(0);
    }
    return flame;
}
Also used : SubFlameWFFunc(org.jwildfire.create.tina.variation.SubFlameWFFunc) FlameWriter(org.jwildfire.create.tina.io.FlameWriter) 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 10 with VariationFunc

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

the class OrchidsRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    flame.setCamRoll(-0);
    flame.setCamPitch(0);
    flame.setCamYaw(0);
    flame.setCamPerspective(0);
    flame.setWidth(638);
    flame.setHeight(359);
    flame.setPixelsPerUnit(315.33902046);
    flame.setCamZoom(2.2 + Math.random() * 0.6);
    // create layer 1
    {
        Layer layer = flame.getFirstLayer();
        // create a random gradient
        new RandomGradientMutation().execute(layer);
        // create transform 1
        {
            XForm xForm = new XForm();
            layer.getXForms().add(xForm);
            xForm.setWeight(4 + Math.random() * 2.0);
            xForm.setColor(0.6 * Math.random());
            xForm.setColorSymmetry(0);
            xForm.setMaterial(0);
            xForm.setMaterialSpeed(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);
            // variation 1
            xForm.addVariation(1.5 + Math.random(), VariationFuncList.getVariationFuncInstance("elliptic", true));
            // set default edit plane
            flame.setEditPlane(EditPlane.XY);
        // random affine transforms (uncomment to play around)
        // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
        // XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
        // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
        // random affine post transforms (uncomment to play around)
        // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
        // XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
        // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
        }
        // create transform 2
        {
            XForm xForm = new XForm();
            layer.getXForms().add(xForm);
            xForm.setWeight(1.5 + Math.random());
            xForm.setColor(0.5 + Math.random() * 0.2);
            xForm.setColorSymmetry(0);
            xForm.setMaterial(0);
            xForm.setMaterialSpeed(0);
            // a
            xForm.setCoeff00(-0.00283201);
            // b
            xForm.setCoeff10(0.99999599);
            // e
            xForm.setCoeff20(0);
            // c
            xForm.setCoeff01(-0.99999599);
            // d
            xForm.setCoeff11(-0.00283201);
            // f
            xForm.setCoeff21(0);
            xForm.setPostCoeff00(1);
            xForm.setPostCoeff10(0);
            xForm.setPostCoeff01(0);
            xForm.setPostCoeff11(1);
            xForm.setPostCoeff20(0);
            xForm.setPostCoeff21(0);
            // variation 1
            {
                VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("poincare3D", true);
                varFunc.setParameter("r", 0);
                varFunc.setParameter("a", 0);
                varFunc.setParameter("b", 0);
                xForm.addVariation(Math.random() + 1.0, varFunc);
            }
            // variation 2
            xForm.addVariation(10.0 * Math.random() - 5.0, VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true));
            // set default edit plane
            flame.setEditPlane(EditPlane.XY);
            // random affine transforms (uncomment to play around)
            XFormTransformService.scale(xForm, 0.5 + 2.0 * Math.random(), true, true, false);
        // XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
        // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
        // random affine post transforms (uncomment to play around)
        // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
        // XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
        // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
        }
        // create transform 3
        {
            XForm xForm = new XForm();
            layer.getXForms().add(xForm);
            xForm.setWeight(1.2 + Math.random());
            xForm.setColor(0.2 + Math.random() * 0.5);
            xForm.setColorSymmetry(0);
            xForm.setMaterial(0);
            xForm.setMaterialSpeed(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);
            // variation 1
            xForm.addVariation(0.75, VariationFuncList.getVariationFuncInstance("rays", true));
            // set default edit plane
            flame.setEditPlane(EditPlane.XY);
        // random affine transforms (uncomment to play around)
        // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
        // XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
        // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
        // random affine post transforms (uncomment to play around)
        // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
        // XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
        // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
        }
        // create final transform 1
        {
            XForm xForm = new XForm();
            layer.getFinalXForms().add(xForm);
            xForm.setWeight(0);
            xForm.setColor(0.96);
            xForm.setColorSymmetry(0);
            xForm.setMaterial(0);
            xForm.setMaterialSpeed(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);
            // variation 1
            {
                VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("hypertile1", true);
                varFunc.setParameter("p", 4);
                varFunc.setParameter("q", 6);
                xForm.addVariation(0.3 + Math.random() * 0.8, varFunc);
            }
            // set default edit plane
            flame.setEditPlane(EditPlane.XY);
        // random affine transforms (uncomment to play around)
        // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
        // XFormTransformService.rotate(xForm, 360.0*Math.random(), false);
        // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), false);
        // random affine post transforms (uncomment to play around)
        // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, true);
        // XFormTransformService.rotate(xForm, 360.0*Math.random(), true);
        // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
        }
        // create final transform 2
        {
            XForm xForm = new XForm();
            layer.getFinalXForms().add(xForm);
            xForm.setWeight(0);
            xForm.setColor(0);
            xForm.setColorSymmetry(0);
            xForm.setMaterial(0);
            xForm.setMaterialSpeed(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);
            // variation 1
            if (Math.random() > 0.25) {
                xForm.addVariation(1, VariationFuncList.getVariationFuncInstance(Math.random() < 0.5 ? "polar" : "polar2", true));
            } else {
                xForm.addVariation(1, VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true));
            }
        }
        if (Math.random() > 0.666) {
            layer.getXForms().get(0).getModifiedWeights()[0] = 1.0 + Math.random();
            layer.getXForms().get(0).getModifiedWeights()[2] = 0.2 * Math.random();
        }
    }
    return flame;
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) RandomGradientMutation(org.jwildfire.create.tina.mutagen.RandomGradientMutation) 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