Search in sources :

Example 1 with RandomParamMutation

use of org.jwildfire.create.tina.mutagen.RandomParamMutation in project JWildfire by thargor6.

the class GalaxiesRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCamRoll(1.49758722);
    flame.setCamPitch(0);
    flame.setCamYaw(0);
    flame.setCamPerspective(0);
    flame.setWidth(601);
    flame.setHeight(338);
    flame.setPixelsPerUnit(92.48366013);
    flame.setCamZoom(0.72 + Math.random() * 0.42);
    flame.setCentreX(1.5357526);
    flame.setCentreY(-0.4416446);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // create transform 1
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(25.75871591);
        xForm.setColor(0.74488914);
        xForm.setColorSymmetry(0);
        // a
        xForm.setCoeff00(1);
        // b
        xForm.setCoeff10(0);
        // e
        xForm.setCoeff20(1.09171281);
        // c
        xForm.setCoeff01(0);
        // d
        xForm.setCoeff11(1);
        // f
        xForm.setCoeff21(-1.22115911);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        // variation 1
        {
            double amount = Math.random() > 0.25 ? 1.0 - 2.0 * Math.random() : 1.0;
            xForm.addVariation(amount, getRandomVariation());
            if (Math.random() > 0.5) {
                new RandomParamMutation().setRandomFlameProperty(flame.getFirstLayer(), 1.0);
            }
        }
    }
    // create transform 2
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(286.87636036);
        xForm.setColor(0.90312262);
        xForm.setColorSymmetry(0.95);
        // a
        xForm.setCoeff00(0.96333808);
        // b
        xForm.setCoeff10(0.12845865);
        // e
        xForm.setCoeff20(0.31387449);
        // c
        xForm.setCoeff01(-0.12845865);
        // d
        xForm.setCoeff11(0.96333808);
        // f
        xForm.setCoeff21(0.08003269);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        // variation 1
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("sec", true));
    }
    if (Math.random() > 0.5) {
        new LocalGammaMutation().execute(flame.getFirstLayer());
    }
    return flame;
}
Also used : RandomParamMutation(org.jwildfire.create.tina.mutagen.RandomParamMutation) XForm(org.jwildfire.create.tina.base.XForm) LocalGammaMutation(org.jwildfire.create.tina.mutagen.LocalGammaMutation) Layer(org.jwildfire.create.tina.base.Layer) Flame(org.jwildfire.create.tina.base.Flame)

Example 2 with RandomParamMutation

use of org.jwildfire.create.tina.mutagen.RandomParamMutation in project JWildfire by thargor6.

the class DualityRandomFlameGenerator 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();
    // create transform 1
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.01 + Math.random() * 50);
        xForm.setColor(0.74488914);
        xForm.setColorSymmetry(0);
        // variation 1
        xForm.addVariation(1.0, getRandomVariation1());
        // 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, 2.0 - 4.0 * Math.random(), 2.0 - 4.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);
    }
    if (Math.random() > 0.25) {
        new RandomParamMutation().execute(flame.getFirstLayer());
    }
    if (Math.random() > 0.50) {
        new RandomParamMutation().execute(flame.getFirstLayer());
    }
    if (Math.random() > 0.75) {
        new RandomParamMutation().execute(flame.getFirstLayer());
    }
    // create transform 2
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.1 + Math.random() * 400.0);
        xForm.setColor(0.90312262);
        xForm.setColorSymmetry(0.95);
        if (Math.random() < 0.33) {
            xForm.addVariation(0.5 + Math.random() * 0.5, getRandomVariation2());
        } else {
            xForm.addVariation(1.0, getRandomVariation2());
        }
        // random affine transforms (uncomment to play around)
        XFormTransformService.scale(xForm, 1.25 - Math.random() * 0.5, true, true, false);
        XFormTransformService.rotate(xForm, 36.0 * Math.random(), false);
        XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), false);
        // XFormTransformService.localTranslate(xForm, 1.0-2.0*Math.random(), 1.0-2.0*Math.random(), true);
        if (Math.random() < 0.5) {
            if (Math.random() < 0.5) {
                xForm.getModifiedWeights()[0] = 0.1 + Math.random() * 0.5;
            } else {
                xForm.getModifiedWeights()[0] = 3.0 + Math.random() * 7;
            }
        }
    }
    if (Math.random() > 0.25) {
        new RandomParamMutation().execute(flame.getFirstLayer());
    }
    if (Math.random() > 0.50) {
        new RandomParamMutation().execute(flame.getFirstLayer());
    }
    if (Math.random() > 0.75) {
        new RandomParamMutation().execute(flame.getFirstLayer());
    }
    // create transform 3
    if (Math.random() < 0.1) {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.01 + Math.random() * 200.0);
        xForm.setColor(0.6312262);
        xForm.setColorSymmetry(0.12);
        xForm.addVariation(0.5 + Math.random() * 0.75, getRandomVariation3());
        xForm.getModifiedWeights()[2] = 0.0;
        // random affine transforms (uncomment to play around)
        XFormTransformService.scale(xForm, 1.05 - Math.random() * 0.45, true, true, false);
        XFormTransformService.rotate(xForm, 24.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);
    }
    if (Math.random() > 0.25) {
        new RandomParamMutation().execute(flame.getFirstLayer());
    }
    if (Math.random() > 0.50) {
        new RandomParamMutation().execute(flame.getFirstLayer());
    }
    if (Math.random() > 0.75) {
        new RandomParamMutation().execute(flame.getFirstLayer());
    }
    return flame;
}
Also used : RandomParamMutation(org.jwildfire.create.tina.mutagen.RandomParamMutation) XForm(org.jwildfire.create.tina.base.XForm) Layer(org.jwildfire.create.tina.base.Layer) Flame(org.jwildfire.create.tina.base.Flame)

Aggregations

Flame (org.jwildfire.create.tina.base.Flame)2 Layer (org.jwildfire.create.tina.base.Layer)2 XForm (org.jwildfire.create.tina.base.XForm)2 RandomParamMutation (org.jwildfire.create.tina.mutagen.RandomParamMutation)2 LocalGammaMutation (org.jwildfire.create.tina.mutagen.LocalGammaMutation)1