Search in sources :

Example 91 with XForm

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

the class AddTransformMutation method execute.

@Override
public void execute(Layer pLayer) {
    if (Math.random() < 0.75) {
        if (Math.random() < 0.5 && pLayer.getXForms().size() > 0) {
            int idx = (int) (Math.random() * pLayer.getXForms().size());
            pLayer.getXForms().remove(idx);
        }
        XForm xForm = new XForm();
        pLayer.getXForms().add(xForm);
        xForm.setWeight(0.1 + Math.random() * 2.0);
        String fName;
        if (Math.random() < 0.33) {
            int idx = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
            fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(idx)];
        } else {
            fName = VariationFuncList.getRandomVariationname();
        }
        xForm.addVariation(0.01 + Math.random() * 10.0, VariationFuncList.getVariationFuncInstance(fName, true));
    } else {
        if (Math.random() < 0.5 && pLayer.getFinalXForms().size() > 0) {
            int idx = (int) (Math.random() * pLayer.getFinalXForms().size());
            pLayer.getFinalXForms().remove(idx);
        }
        XForm xForm = new XForm();
        pLayer.getFinalXForms().add(xForm);
        xForm.setWeight(0.1 + Math.random() * 2.0);
        String fName;
        if (Math.random() < 0.33) {
            int idx = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
            fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(idx)];
        } else {
            while (true) {
                fName = VariationFuncList.getRandomVariationname();
                if (fName.indexOf("blur") < 0 && fName.indexOf("Blur") < 0 && fName.indexOf("fract_") != 0) {
                    break;
                }
            }
        }
        xForm.addVariation(0.01 + Math.random() * 10.0, VariationFuncList.getVariationFuncInstance(fName, true));
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm)

Example 92 with XForm

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

the class AddVariationMutation method execute.

@Override
public void execute(Layer pLayer) {
    XForm xForm;
    if (Math.random() < 0.75 || pLayer.getFinalXForms().size() == 0) {
        int idx = Tools.randomInt(pLayer.getXForms().size());
        xForm = pLayer.getXForms().get(idx);
    } else {
        int idx = Tools.randomInt(pLayer.getFinalXForms().size());
        xForm = pLayer.getFinalXForms().get(idx);
    }
    if (Math.random() < 0.75) {
        if (Math.random() < 0.67 && xForm.getVariationCount() > 0) {
            int idx = (int) (Math.random() * xForm.getVariationCount());
            xForm.removeVariation(xForm.getVariation(idx));
        }
        String fName;
        if (Math.random() < 0.33) {
            int idx = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
            fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(idx)];
        } else {
            fName = VariationFuncList.getRandomVariationname();
        }
        xForm.addVariation(0.01 + Math.random() * 10.0, VariationFuncList.getVariationFuncInstance(fName, true));
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm)

Example 93 with XForm

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

the class GradientPositionMutation method execute.

@Override
public void execute(Layer pLayer) {
    if (Math.random() < 0.5) {
        for (int i = 0; i < pLayer.getXForms().size(); i++) {
            XForm xForm = pLayer.getXForms().get(i);
            xForm.setColor(Math.random());
            if (Math.random() < 0.25) {
                xForm.setColorSymmetry(Math.random());
            }
        }
    } else {
        pLayer.getPalette().setModShift(-256 + Tools.randomInt(512));
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm)

Example 94 with XForm

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

the class AbstractAffine3DRandomFlameGenerator method rotateXForm.

protected void rotateXForm(Flame pFlame, int idx, double amp0) {
    Layer layer = pFlame.getFirstLayer();
    if (layer.getXForms().size() > idx) {
        pFlame.setEditPlane(EditPlane.ZX);
        XForm xform = layer.getXForms().get(idx);
        XFormTransformService.rotate(xform, (0.5 - Math.random()) * amp0);
        pFlame.setEditPlane(EditPlane.XY);
    }
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Layer(org.jwildfire.create.tina.base.Layer)

Example 95 with XForm

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

the class PerlinNoiseDOFBlurShape method prepare.

@Override
public void prepare(FlameTransformationContext pFlameTransformationContext, AbstractRandomGenerator pRandGen, double pCamDOF_10) {
    super.prepare(pFlameTransformationContext, pRandGen, pCamDOF_10);
    s = new XYZPoint();
    d = new XYZPoint();
    xform = new XForm();
    fnc = new DCPerlinFunc();
    for (String paramName : getParamNames()) {
        fnc.setParameter(paramName, params.get(paramName));
    }
    fnc.init(pFlameTransformationContext, new Layer(), xform, 1.0);
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) XYZPoint(org.jwildfire.create.tina.base.XYZPoint) DCPerlinFunc(org.jwildfire.create.tina.variation.DCPerlinFunc) Layer(org.jwildfire.create.tina.base.Layer)

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