Search in sources :

Example 71 with XForm

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

the class JulianDiscRandomFlameGenerator 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.setCamYaw(0.0);
    flame.setCamZoom(1.0);
    flame.setCamPerspective(0.0);
    flame.setPixelsPerUnit(100);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5 + Math.random() * 0.5);
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("julian", true);
        int power = Tools.FTOI(200.0 - Math.random() * 400.0);
        if (power == 0 || power == 1 || power == -1) {
            power = -30;
        }
        varFunc.setParameter("power", power);
        double[] amounts = { 0.25, 0.5, 0.75 };
        xForm.addVariation(amounts[(int) (Math.random() * amounts.length)], varFunc);
        if (Math.random() < 0.5) {
            String fncName = Math.random() > 0.5 ? getNonBlurRandomFunc() : "gaussian_blur";
            xForm.addVariation(0.001 + Math.random() * 0.039, VariationFuncList.getVariationFuncInstance(fncName, true));
        }
        xForm.setColorSymmetry(-1.0);
        xForm.setColor(0.0);
        if (Math.random() < 0.33) {
            XFormTransformService.globalTranslate(xForm, -0.0125 + 0.025 * Math.random(), -0.0125 + 0.025 * Math.random(), false);
        } else if (Math.random() < 0.75) {
            XFormTransformService.globalTranslate(xForm, -0.125 + 0.25 * Math.random(), -0.125 + 0.25 * Math.random(), false);
        }
        if (Math.random() < 0.15) {
            XFormTransformService.rotate(xForm, 6.0 - Math.random() * 12.0, false);
        } else if (Math.random() < 0.3) {
            XFormTransformService.rotate(xForm, -45.0, false);
        } else if (Math.random() < 0.75) {
            XFormTransformService.rotate(xForm, 90.0 - Math.random() * 180.0, false);
        }
        if (Math.random() < 0.5) {
            XFormTransformService.scale(xForm, 1.2 - Math.random() * 0.4, true, true, false);
        }
        if (Math.random() < 0.5) {
            XFormTransformService.scale(xForm, 1.2 - Math.random() * 0.4, true, true, true);
        }
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(2.0 + Math.random() * 24.0);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("disc", true));
        if (Math.random() < 0.125) {
            String fncName = Math.random() > 0.5 ? getNonBlurRandomFunc() : "gaussian_blur";
            xForm.addVariation(0.001 + Math.random() * 0.039, VariationFuncList.getVariationFuncInstance(fncName, true));
        }
        xForm.setColor(0.5 + Math.random() * 0.5);
        xForm.setColorSymmetry(0.6 + Math.random() * 0.33);
        if (Math.random() < 0.33) {
            XFormTransformService.globalTranslate(xForm, -0.0125 + 0.025 * Math.random(), -0.0125 + 0.025 * Math.random(), false);
        } else if (Math.random() < 0.75) {
            XFormTransformService.globalTranslate(xForm, -0.125 + 0.25 * Math.random(), -0.125 + 0.25 * Math.random(), false);
        }
        if (Math.random() < 0.15) {
            XFormTransformService.rotate(xForm, 6.0 - Math.random() * 12.0, false);
        } else if (Math.random() < 0.3) {
            XFormTransformService.rotate(xForm, -45.0, false);
        } else if (Math.random() < 0.75) {
            XFormTransformService.rotate(xForm, 90.0 - Math.random() * 180.0, false);
        }
    }
    // final
    if (Math.random() < 0.15) {
        XForm xForm = new XForm();
        layer.getFinalXForms().add(xForm);
        if (Math.random() < 0.5) {
            String[] fncList = { "auger", "bent", "bent2", "boarders", "bubble", "butterfly", "bwraps7", "cosine", "curve", "cylinder", "diamond", "disc", "eclipse", "edisc", "elliptic", "ex", "exp", "exponential", "eyefish", "fan", "fan2", "fisheye", "heart_wf", "hemisphere", "horseshoe", "hyperbolic", "julia", "julia3D", "julia3Dz", "julian", "juliascope", "linearT", "log", "mobius", "ngon", "oscilloscope", "rings", "rings2", "scry", "xtrb", "sec", "sin", "sinh", "sinusoidal", "spherical", "swirl", "tan", "tangent", "tanh", "boarders2", "polar" };
            String varName = fncList[(int) (Math.random() * fncList.length)];
            xForm.addVariation(2.0 + Math.random() * 2.0, VariationFuncList.getVariationFuncInstance(varName, true));
        }
    }
    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 72 with XForm

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

the class SphericalRandomFlameGenerator 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(90.0);
    flame.setCamYaw(0.0);
    flame.setCamZoom(2.4);
    flame.setCamPerspective(0.32);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    VariationFunc varFunc;
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(4.0 + 12.0 * Math.random());
        varFunc = VariationFuncList.getVariationFuncInstance("spherical3D", true);
        xForm.addVariation(1.0, varFunc);
        // XFormTransformService.rotate(xForm, Math.random() < 0.5 ? 90.0 : -90.0, false);
        XFormTransformService.rotate(xForm, Math.random() < 0.5 ? Math.random() < 0.5 ? 180.0 : 90 : -90.0, false);
        XFormTransformService.globalTranslate(xForm, 1.0, 0.0, false);
        xForm.setColor(1.0);
        xForm.setColorSymmetry(0.9 + Math.random() * 0.2);
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(3.0 + 11.0 * Math.random());
        varFunc = VariationFuncList.getVariationFuncInstance("spherical3D", true);
        xForm.addVariation(1.0, varFunc);
        // XFormTransformService.rotate(xForm, 90.0, false);
        XFormTransformService.rotate(xForm, Math.random() < 0.5 ? Math.random() < 0.5 ? 180.0 : 90 : -90.0, false);
        xForm.setColor(0.5);
        xForm.setColorSymmetry(0.9 + Math.random() * 0.2);
    }
    // 3rd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.3 + 0.2 * Math.random());
        varFunc = VariationFuncList.getVariationFuncInstance("linear3D", true);
        xForm.addVariation(1.0, varFunc);
        XFormTransformService.rotate(xForm, 90.0, false);
        XFormTransformService.globalTranslate(xForm, (int) (2.0 + Math.random() * 2.0), 0.0, false);
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(0);
    }
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.2 + 0.15 * Math.random());
        varFunc = VariationFuncList.getVariationFuncInstance("linear3D", true);
        xForm.addVariation(1.0, varFunc);
        XFormTransformService.rotate(xForm, 90.0, false);
        XFormTransformService.globalTranslate(xForm, -(int) (2.0 + Math.random() * 2.0), 0.0, false);
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(0);
    }
    int max = Tools.randomInt(4);
    for (int i = 0; i < max; i++) {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5 + 0.3 * Math.random());
        String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length)];
        varFunc = VariationFuncList.getVariationFuncInstance(fncName, true);
        xForm.addVariation(1.0, varFunc);
        XFormTransformService.rotate(xForm, 90.0 - Math.random() * 180.0, false);
        XFormTransformService.scale(xForm, 0.2 + 0.2 * Math.random(), true, true);
        XFormTransformService.globalTranslate(xForm, 0.25 - Math.random() * 0.5, 0.25 - Math.random() * 0.5, false);
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(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 73 with XForm

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

the class SynthRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    // Bases loosely on the SynthRandomBatch Script by slobo777, http://slobo777.deviantart.com/art/Synth-V2-128594088 */
    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();
    // init
    // These vars affect the style of the centre effect
    double centre_synth = 0.7;
    // 5;
    double centre_mode = Tools.randomInt(20);
    double centre_noise = .0;
    double centre_power = -1.0;
    double centre_smooth = 1;
    double centre_color = 0.4 + 0.2 * Math.random();
    double centre_symmetry = 0.6 + 0.4 * Math.random();
    XForm xForm1;
    // 1st XForm
    {
        XForm xForm = xForm1 = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(1.0);
        xForm.setColor(0.0);
        xForm.setColorSymmetry(-1.0);
        VariationFunc synth = VariationFuncList.getVariationFuncInstance("synth");
        xForm.addVariation(1.0, synth);
        // 3;
        synth.setParameter("mode", Tools.randomInt(20));
        synth.setParameter("power", -0.2);
        int numWaves = (int) (Math.random() * 3.5 + 2);
        // Starting circle . . .
        synth.setParameter("a", 0.8 + (Math.random() * 0.4));
        // Wave #1
        synth.setParameter("b", Math.random() * 2);
        synth.setParameter("b_type", Tools.randomInt(7));
        synth.setParameter("b_frq", Tools.randomInt(7) + 1);
        synth.setParameter("b_phs", Math.random() * M_PI);
        synth.setParameter("b_layer", Tools.randomInt(4));
        // Skew effect?
        if (Math.random() < 0.2) {
            synth.setParameter("b_skew", Math.random() * 2 - 1);
        }
        // Exceptionally high frequency?
        if (Math.random() < 0.1) {
            synth.setParameter("b_frq", Tools.randomInt(20) + 7);
        }
        // Usually higher frequencies affect the amplitude
        if (Math.random() < 0.8) {
            synth.setParameter("b", (Double) synth.getParameter("b") / (1 + 0.3 * (Double) synth.getParameter("b_frq")));
        }
        // Wave #2
        synth.setParameter("c", Math.random());
        synth.setParameter("c_type", Tools.randomInt(7));
        synth.setParameter("c_frq", Tools.randomInt(7) + 1);
        synth.setParameter("c_phs", Math.random() * M_PI);
        synth.setParameter("c_layer", Tools.randomInt(4));
        // Skew effect?
        if (Math.random() < 0.2) {
            synth.setParameter("c_skew", Math.random() * 2 - 1);
        }
        // Exceptionally high frequency?
        if (Math.random() < 0.1) {
            synth.setParameter("c_frq", Tools.randomInt(20) + 7);
        }
        // Usually higher frequencies affect the amplitude
        if (Math.random() < 0.8) {
            synth.setParameter("c", (Double) synth.getParameter("c") / (1 + 0.3 * (Double) synth.getParameter("c_frq")));
        }
        // Wave #3
        if (numWaves >= 3) {
            synth.setParameter("d", Math.random());
            synth.setParameter("d_type", Tools.randomInt(7));
            synth.setParameter("d_frq", Tools.randomInt(7) + 1);
            synth.setParameter("d_phs", Math.random() * M_PI);
            synth.setParameter("d_layer", Tools.randomInt(4));
            // Skew effect?
            if (Math.random() < 0.2) {
                synth.setParameter("d_skew", Math.random() * 2 - 1);
            }
            // Exceptionally high frequency?
            if (Math.random() < 0.1) {
                synth.setParameter("d_frq", Tools.randomInt(20) + 7);
            }
            // Usually higher frequencies affect the amplitude
            if (Math.random() < 0.8) {
                synth.setParameter("d", (Double) synth.getParameter("d") / (1 + 0.3 * (Double) synth.getParameter("d_frq")));
            }
        }
        // Wave #4
        if (numWaves >= 4) {
            synth.setParameter("e", Math.random());
            synth.setParameter("e_type", Tools.randomInt(7));
            synth.setParameter("e_frq", Tools.randomInt(7) + 1);
            synth.setParameter("e_phs", Math.random() * M_PI);
            synth.setParameter("e_layer", Tools.randomInt(4));
            // Skew effect?
            if (Math.random() < 0.2) {
                synth.setParameter("e_skew", Math.random() * 2 - 1);
            }
            // Exceptionally high frequency?
            if (Math.random() < 0.1) {
                synth.setParameter("e_frq", Tools.randomInt(20) + 7);
            }
            // Usually higher frequencies affect the amplitude
            if (Math.random() < 0.8) {
                synth.setParameter("e", (Double) synth.getParameter("e") / (1 + 0.3 * (Double) synth.getParameter("e_frq")));
            }
        }
        // Wave #5
        if (numWaves >= 5) {
            synth.setParameter("f", Math.random());
            synth.setParameter("f_type", Tools.randomInt(7));
            synth.setParameter("f_frq", Tools.randomInt(7) + 1);
            synth.setParameter("f_phs", Math.random() * M_PI);
            synth.setParameter("f_layer", Tools.randomInt(4));
            // Skew effect?
            if (Math.random() < 0.2) {
                synth.setParameter("f_skew", Math.random() * 2 - 1);
            }
            // Exceptionally high frequency?
            if (Math.random() < 0.1) {
                synth.setParameter("f_frq", Tools.randomInt(20) + 7);
            }
            // Usually higher frequencies affect the amplitude
            if (Math.random() < 0.8) {
                synth.setParameter("f", (Double) synth.getParameter("f") / (1 + 0.3 * (Double) synth.getParameter("f_frq")));
            }
        }
    }
    // Second "inner" transform is smaller with a little noise
    // added to remove annoying lines at the centre
    {
        XForm xForm = xForm1.makeCopy();
        layer.getXForms().add(xForm);
        xForm.setWeight(1.0);
        xForm.setColor(centre_color);
        xForm.setColorSymmetry(centre_symmetry);
        VariationFunc synth = xForm.getVariation(0).getFunc();
        xForm.getVariation(0).setAmount(centre_synth);
        synth.setParameter("power", centre_power);
        synth.setParameter("mode", centre_mode);
        synth.setParameter("smooth", centre_smooth);
        VariationFunc noise = VariationFuncList.getVariationFuncInstance("noise");
        xForm.addVariation(centre_noise, noise);
    }
    if (Math.random() < 0.55) {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(5 * Math.random() + 0.125);
        xForm.setColor(centre_color + 0.2 * Math.random());
        xForm.setColorSymmetry(centre_symmetry - 0.4 * Math.random());
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname());
        xForm.addVariation(0.25 + Math.random() * 1.5, varFunc);
        xForm.getModifiedWeights()[1] = 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)

Example 74 with XForm

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

the class TentacleRandomFlameGenerator 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 maxXFormsX = (int) (2.0 + Math.random() * 3.0);
    int maxXFormsY = (int) (2.0 + Math.random() * 3.0);
    double xMin = -(double) maxXFormsX * 0.5;
    double yMin = -(double) maxXFormsY * 0.5 + 1;
    String[] fnc = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL;
    double scl = 1.0;
    for (int y = 0; y < maxXFormsY; y++) {
        for (int x = 0; x < maxXFormsX; x++) {
            XForm xForm = new XForm();
            xForm.setWeight(0.5 + Math.random() * 99.5);
            layer.getXForms().add(xForm);
            XFormTransformService.globalTranslate(xForm, xMin + x, yMin + y, false);
            if (Math.random() < 0.5) {
                XFormTransformService.rotate(xForm, 360.0 * Math.random(), true);
            } else {
                XFormTransformService.rotate(xForm, -360.0 * Math.random(), true);
            }
            XFormTransformService.localTranslate(xForm, -1.0 + 2.0 * Math.random(), -1.0 + 2.0 * Math.random(), true);
            scl *= 0.75 + Math.random() / 4;
            XFormTransformService.scale(xForm, scl, true, true, true);
            int fncIdx = (int) (Math.random() * fnc.length);
            xForm.addVariation(Math.random() * 0.9 + 0.1, VariationFuncList.getVariationFuncInstance(Math.random() > 0.25 ? fnc[fncIdx] : "linear3D", true));
            xForm.setColor(Math.random());
        }
    }
    return flame;
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Layer(org.jwildfire.create.tina.base.Layer) Flame(org.jwildfire.create.tina.base.Flame)

Example 75 with XForm

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

the class TileBallRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    flame.setCentreX(0.1 - Math.random() * 0.2);
    flame.setCentreY(-0.6 + Math.random() * 0.3);
    flame.setPixelsPerUnit(200);
    flame.setCamZoom(1.0 + Math.random() * 0.5);
    flame.setCamPitch(25.0 + Math.random() * 40.0);
    flame.setCamPerspective(0.1 + Math.random() * 0.2);
    flame.setPreserveZ(true);
    Layer layer = flame.getFirstLayer();
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    double tileSpacing = 0.5;
    // 1st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.addVariation(1.5 + Math.random() * 1.5, VariationFuncList.getVariationFuncInstance("ztranslate", true));
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(1.0);
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // 2nd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.setColorSymmetry(1.0);
        XFormTransformService.localTranslate(xForm, 0, tileSpacing);
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // 3rd xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.setColorSymmetry(1.0);
        XFormTransformService.localTranslate(xForm, tileSpacing, tileSpacing);
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // 4th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.setColorSymmetry(1.0);
        XFormTransformService.localTranslate(xForm, tileSpacing, 0);
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // 5th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.setColorSymmetry(1.0);
        XFormTransformService.localTranslate(xForm, tileSpacing, -tileSpacing);
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // 6th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.setColorSymmetry(1.0);
        XFormTransformService.localTranslate(xForm, 0, -tileSpacing);
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // 7th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.setColorSymmetry(1.0);
        XFormTransformService.localTranslate(xForm, -tileSpacing, -tileSpacing);
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // 8th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.setColorSymmetry(1.0);
        XFormTransformService.localTranslate(xForm, -tileSpacing, 0);
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // 9th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
        xForm.setColorSymmetry(1.0);
        XFormTransformService.localTranslate(xForm, -tileSpacing, tileSpacing);
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // 10th xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.25 + Math.random() * 1.25);
        VariationFunc var = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
        xForm.addVariation(0.2 + Math.random() * 0.6, var);
        randomizeParams(var);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("flatten", true));
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(Math.random());
        xForm.getModifiedWeights()[0] = 0.0;
        xForm.getModifiedWeights()[1] = 0.0;
        xForm.getModifiedWeights()[2] = 0.0;
        xForm.getModifiedWeights()[3] = 0.0;
        xForm.getModifiedWeights()[4] = 0.0;
        xForm.getModifiedWeights()[5] = 0.0;
        xForm.getModifiedWeights()[6] = 0.0;
        xForm.getModifiedWeights()[7] = 0.0;
        xForm.getModifiedWeights()[8] = 0.0;
        xForm.getModifiedWeights()[9] = 0.0;
        xForm.getModifiedWeights()[10] = 1.0;
    }
    // 11st xForm
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.25 + Math.random() * 1.25);
        VariationFunc var = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
        xForm.addVariation(0.1 + Math.random() * 0.3, var);
        randomizeParams(var);
        xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("flatten", true));
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(Math.random());
        xForm.getModifiedWeights()[10] = 0.0;
    }
    // final xForm
    {
        XForm xForm = new XForm();
        layer.getFinalXForms().add(xForm);
        xForm.setWeight(0.8 + Math.random() * 0.5);
        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("curl3D", true);
        varFunc.setParameter("cx", -0.75 + Math.random() * 1.5);
        varFunc.setParameter("cy", 0.8 + Math.random() * 0.4);
        varFunc.setParameter("cz", 0.025 + Math.random() * 0.05);
        xForm.addVariation(1.0, 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

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