Search in sources :

Example 1 with VariationFunc

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

the class RasterRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCentreX(2.45);
    flame.setCentreY(1.37);
    flame.setCamZoom(1.25 + Math.random() * 0.5);
    flame.setCamRoll(0);
    flame.setCamPitch(0);
    flame.setCamYaw(0);
    flame.setCamPerspective(0);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // create transform 1
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.05);
        xForm.setColor(0);
        xForm.setColorSymmetry(0.89103422);
        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(0.45811152);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(0.45811152);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        // variation 1
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.5 + Math.random() * 0.65, varFunc);
        }
        // variation 2
        if (Math.random() < 0.20) {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.4 + Math.random() * 0.5, varFunc);
        }
        // variation 3
        if (Math.random() < 0.10) {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.3 + Math.random() * 0.4, varFunc);
        }
        // set default edit plane
        flame.setEditPlane(EditPlane.XY);
        // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
        if (Math.random() < 0.5) {
            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.15 - Math.random() * 0.65, 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(0.5);
        xForm.setColor(0.33333333);
        xForm.setColorSymmetry(0.62668861);
        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(1);
        xForm.setPostCoeff21(0);
        // variation 1
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", 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 3
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.setColor(0.66666667);
        xForm.setColorSymmetry(0.33786964);
        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(1);
        // variation 1
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", 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 4
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.05);
        xForm.setColor(1);
        xForm.setColorSymmetry(0.95291095);
        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(0.0423868);
        xForm.setPostCoeff10(0.14299816);
        xForm.setPostCoeff01(-0.14299816);
        xForm.setPostCoeff11(0.0423868);
        xForm.setPostCoeff20(0.5);
        xForm.setPostCoeff21(0.5);
        // variation 1
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.4 + Math.random() * 0.65, varFunc);
        }
        // variation 2
        if (Math.random() < 0.10) {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.4 + Math.random() * 0.5, varFunc);
        }
        // variation 3
        if (Math.random() < 0.05) {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
            xForm.addVariation(0.3 + Math.random() * 0.4, varFunc);
        }
        // set default edit plane
        flame.setEditPlane(EditPlane.XY);
        // XFormTransformService.scale(xForm, 1.25-Math.random()*0.5, true, true, false);
        if (Math.random() < 0.25) {
            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.15 - Math.random() * 0.75, true, true, true);
        XFormTransformService.rotate(xForm, 360.0 * Math.random(), true);
        XFormTransformService.localTranslate(xForm, 0.25 - 0.5 * Math.random(), 0.25 - 0.5 * Math.random(), 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 2 with VariationFunc

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

the class RaysRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCamRoll(Math.random() * 360.0);
    flame.setCamZoom(1.0 + Math.random() * 0.75);
    flame.setGamma(1.2 + Math.random() * 0.8);
    flame.setGammaThreshold(Math.random() * 0.15);
    flame.setBrightness(2.5 + Math.random() * 1.5);
    flame.setCamPitch(0);
    flame.setCamYaw(0);
    flame.setCamPerspective(0);
    flame.setCentreX(0.0);
    flame.setCentreY(0.0);
    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // create a random gradient
    layer.setPalette(new TwoColorsRandomGradientGenerator().generatePalette(2, true, true));
    // create transform 1
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.1 + Math.random() * 0.7);
        xForm.setColor(0);
        xForm.setColorSymmetry(0);
        // a
        xForm.setCoeff00(-0.43686351);
        // b
        xForm.setCoeff10(0.63649767);
        // e
        xForm.setCoeff20(0.7325555);
        // c
        xForm.setCoeff01(-0.59864436);
        // d
        xForm.setCoeff11(-0.50111868);
        // f
        xForm.setCoeff21(0.08008955);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        // variation 1
        xForm.addVariation(0.125 + Math.random() * 0.125, VariationFuncList.getVariationFuncInstance("linear", true));
        // variation 2
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("julian", true);
            varFunc.setParameter("power", 3);
            varFunc.setParameter("dist", 1);
            xForm.addVariation(0.6 + Math.random() * 0.4, varFunc);
        }
        // variation 3
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("juliascope", true);
            varFunc.setParameter("power", 6);
            varFunc.setParameter("dist", 1);
            xForm.addVariation(0.6 + Math.random() * 0.3, varFunc);
        }
        XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), false);
        XFormTransformService.scale(xForm, 0.9 + Math.random() * 0.5, true, true, false);
        XFormTransformService.rotate(xForm, 360.0 * Math.random(), false);
    }
    // create transform 2
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.23272111);
        xForm.setColor(0.8);
        xForm.setColorSymmetry(0);
        // a
        xForm.setCoeff00(-0.15514012);
        // b
        xForm.setCoeff10(0.20816567);
        // e
        xForm.setCoeff20(0.19004075);
        // c
        xForm.setCoeff01(-0.15087636);
        // d
        xForm.setCoeff11(0.20174952);
        // f
        xForm.setCoeff21(-0.04671182);
        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("linear", true));
        // variation 2
        {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("juliascope", true);
            varFunc.setParameter("power", 2);
            varFunc.setParameter("dist", 1);
            xForm.addVariation(0.25 + Math.random() * 0.5, varFunc);
        }
        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.18 - Math.random() * 0.36, VariationFuncList.getVariationFuncInstance(fName, true));
        XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), false);
        XFormTransformService.scale(xForm, 0.9 + Math.random() * 0.5, true, true, false);
        XFormTransformService.rotate(xForm, 360.0 * Math.random(), false);
    }
    // create transform 3
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.04166667);
        xForm.setColor(0.1);
        xForm.setColorSymmetry(0.75);
        // a
        xForm.setCoeff00(0.92931929);
        // b
        xForm.setCoeff10(0.17076568);
        // e
        xForm.setCoeff20(0.15869232);
        // c
        xForm.setCoeff01(-0.02999303);
        // d
        xForm.setCoeff11(0.67104838);
        // f
        xForm.setCoeff21(-0.19510192);
        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(Math.random() > 0.5 ? "linear" : getRandomVariationName(), true));
    }
    // create transform 4
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.04166667);
        xForm.setColor(0.15);
        xForm.setColorSymmetry(0.75);
        // a
        xForm.setCoeff00(0.53699507);
        // b
        xForm.setCoeff10(0.12206942);
        // e
        xForm.setCoeff20(-0.0380713);
        // c
        xForm.setCoeff01(0.23469299);
        // d
        xForm.setCoeff11(0.79862481);
        // f
        xForm.setCoeff21(0.04291273);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance(Math.random() > 0.5 ? "linear" : getRandomVariationName(), true));
    }
    // create transform 5
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.04166667);
        xForm.setColor(0.2);
        xForm.setColorSymmetry(0);
        // a
        xForm.setCoeff00(0.89779523);
        // b
        xForm.setCoeff10(-0.23112747);
        // e
        xForm.setCoeff20(-0.4497571);
        // c
        xForm.setCoeff01(0.1734196);
        // d
        xForm.setCoeff11(0.94619577);
        // f
        xForm.setCoeff21(-0.0672393);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance(Math.random() > 0.5 ? "linear" : getRandomVariationName(), true));
    }
    // create transform 6
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.04166667);
        xForm.setColor(0.25);
        xForm.setColorSymmetry(0);
        // a
        xForm.setCoeff00(0.70624241);
        // b
        xForm.setCoeff10(0.15652237);
        // e
        xForm.setCoeff20(0.43007701);
        // c
        xForm.setCoeff01(-0.04953437);
        // d
        xForm.setCoeff11(0.78838922);
        // f
        xForm.setCoeff21(0.21371425);
        xForm.setPostCoeff00(1);
        xForm.setPostCoeff10(0);
        xForm.setPostCoeff01(0);
        xForm.setPostCoeff11(1);
        xForm.setPostCoeff20(0);
        xForm.setPostCoeff21(0);
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance(Math.random() > 0.5 ? "linear" : getRandomVariationName(), true));
    }
    // final transform
    if (Math.random() > 0.33) {
        XForm xForm = new XForm();
        layer.getFinalXForms().add(xForm);
        String[] finals = { "falloff2", "bwrands", "bwraps7", "cosine", "falloff3", "bwrands", "bwrands", "falloff2" };
        VariationFunc var = VariationFuncList.getVariationFuncInstance(finals[(int) (Math.random() * finals.length)], true);
        if (var.getName().equals("bwrands")) {
            var.setParameter("seed", Tools.randomInt(Short.MAX_VALUE));
            var.setParameter("minpetals", (int) (3 + Math.random() * 3));
            var.setParameter("maxpetals", (int) (6 + Math.random() * 12));
        }
        if (var.getName().equals("bwrands") || var.getName().equals("bwraps7")) {
            var.setParameter("cellsize", 1.0 - Math.random() * 0.9);
            var.setParameter("space", Math.random() * 0.2);
            if (Math.random() > 0.5) {
                var.setParameter("inner_twist", 0.2 - Math.random() * 0.4);
                var.setParameter("outer_twist", 2.0 - Math.random() * 4.0);
            }
        }
        xForm.addVariation(1, var);
    }
    return flame;
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) TwoColorsRandomGradientGenerator(org.jwildfire.create.tina.randomgradient.TwoColorsRandomGradientGenerator) Layer(org.jwildfire.create.tina.base.Layer) VariationFunc(org.jwildfire.create.tina.variation.VariationFunc) Flame(org.jwildfire.create.tina.base.Flame)

Example 3 with VariationFunc

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

the class SolidExperimentalRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCamRoll(0);
    flame.setCamPitch(90.0 - Math.random() * 180.0);
    flame.setCamYaw(30.0 - Math.random() * 60.0);
    flame.setCamPerspective(Math.random() * 0.2);
    flame.setWidth(601);
    flame.setHeight(338);
    flame.setPixelsPerUnit(92.48366013);
    flame.setCamZoom(0.2 + Math.random() * 0.4);
    randomizeSolidRenderingSettings(flame);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // create transform 1
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(Math.random() < 0.3 ? 0.5 : 0.25 + Math.random());
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(1.0 - 2 * Math.random());
        xForm.setMaterial(0);
        xForm.setMaterialSpeed(0);
        // a
        xForm.setXYCoeff00(0.58839186);
        // b
        xForm.setXYCoeff10(-0.93477004);
        // e
        xForm.setXYCoeff20(0.88339811);
        // c
        xForm.setXYCoeff01(0.93477004);
        // d
        xForm.setXYCoeff11(0.58839186);
        // f
        xForm.setXYCoeff21(0.59357541);
        xForm.setXYPostCoeff00(-1);
        xForm.setXYPostCoeff10(0.0000000000000001);
        xForm.setXYPostCoeff01(-0.0000000000000001);
        xForm.setXYPostCoeff11(-1);
        xForm.setXYPostCoeff20(0);
        xForm.setXYPostCoeff21(0);
        xForm.setYZCoeff00(1);
        xForm.setYZCoeff10(0);
        xForm.setYZCoeff20(0);
        xForm.setYZCoeff01(0);
        xForm.setYZCoeff11(1);
        xForm.setYZCoeff21(0);
        xForm.setYZPostCoeff00(-0.00074102);
        xForm.setYZPostCoeff10(0.99999973);
        xForm.setYZPostCoeff01(-0.99999973);
        xForm.setYZPostCoeff11(-0.00074102);
        xForm.setYZPostCoeff20(0);
        xForm.setYZPostCoeff21(0);
        xForm.setZXCoeff00(1);
        xForm.setZXCoeff10(0);
        xForm.setZXCoeff20(0);
        xForm.setZXCoeff01(0);
        xForm.setZXCoeff11(1);
        xForm.setZXCoeff21(0);
        xForm.setZXPostCoeff00(1);
        xForm.setZXPostCoeff10(0);
        xForm.setZXPostCoeff01(0);
        xForm.setZXPostCoeff11(1);
        xForm.setZXPostCoeff20(0);
        xForm.setZXPostCoeff21(0);
        // variation 1
        if (Math.random() < 0.85) {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("hypertile3D2", true);
            if (Math.random() > 0.75) {
                varFunc.setParameter("p", 4 + Math.random() * 3.0);
                varFunc.setParameter("q", 4 + Math.random() * 2.0);
            } else {
                varFunc.setParameter("p", 5);
                varFunc.setParameter("q", 4);
            }
            xForm.addVariation(0.25 + Math.random() * 0.75, varFunc);
        } else {
            xForm.addVariation(0.25 + Math.random() * 0.75, getRandomVariation());
        }
        // 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(0.5);
        xForm.setColor(Math.random());
        xForm.setColorSymmetry(1.0 - 2 * Math.random());
        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);
        if (Math.random() > 0.125) {
            xForm.setDrawMode(DrawMode.HIDDEN);
        }
        // variation 1
        xForm.addVariation(0.2 + Math.random() * 0.5, getRandom3DShape());
        // set default edit plane
        flame.setEditPlane(Math.random() > 0.666 ? EditPlane.XY : Math.random() < 0.5 ? EditPlane.YZ : EditPlane.ZX);
        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);
        if (Math.random() > 0.5) {
            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
    if (Math.random() > 0.666) {
        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
        {
            xForm.addVariation(0.75 + Math.random() * 0.25, getRandomVariation());
        }
        // variation 2
        if (Math.random() > 0.5) {
            xForm.addVariation(0.25 + Math.random() * 0.25, VariationFuncList.getVariationFuncInstance("linear3D", true));
        }
        // set default edit plane
        flame.setEditPlane(EditPlane.XY);
        if (Math.random() > 0.5) {
            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);
        }
        if (Math.random() > 0.5) {
            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);
        }
    }
    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 4 with VariationFunc

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

the class SolidJulia3DRandomFlameGenerator method prepareFlame.

@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
    Flame flame = new Flame();
    Layer layer = flame.getFirstLayer();
    flame.setCamRoll(0);
    flame.setCamPitch(90.0 - Math.random() * 180.0);
    flame.setCamYaw(30.0 - Math.random() * 60.0);
    flame.setCamPerspective(Math.random() * 0.2);
    flame.setWidth(601);
    flame.setHeight(338);
    flame.setPixelsPerUnit(92.48366013);
    flame.setCamZoom(0.3 + Math.random() * 0.5);
    randomizeSolidRenderingSettings(flame);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // create transform 1
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        xForm.setColor(0.16556899);
        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.5 + Math.random() * 2.0, getRandom3DShape());
        }
        // variation 2
        if (Math.random() > 0.75) {
            VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("pre_wave3D_wf", true);
            varFunc.setParameter("wavelen", 0.75 + Math.random() * 0.5);
            varFunc.setParameter("phase", 0.5 + Math.random());
            varFunc.setParameter("damping", 0.01);
            Variation variation = xForm.addVariation(0.2 + Math.random() * 0.2, varFunc);
            variation.setPriority(0);
        }
        // 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(0.5);
        xForm.setColor(0.02637356);
        xForm.setColorSymmetry(0);
        xForm.setMaterial(0);
        xForm.setMaterialSpeed(0);
        // a
        xForm.setXYCoeff00(0.53041695);
        // b
        xForm.setXYCoeff10(-0.14810786);
        // e
        xForm.setXYCoeff20(2.09422612);
        // c
        xForm.setXYCoeff01(0.14810786);
        // d
        xForm.setXYCoeff11(0.53041695);
        // f
        xForm.setXYCoeff21(0.23893855);
        xForm.setXYPostCoeff00(1);
        xForm.setXYPostCoeff10(0);
        xForm.setXYPostCoeff01(0);
        xForm.setXYPostCoeff11(1);
        xForm.setXYPostCoeff20(0);
        xForm.setXYPostCoeff21(0);
        xForm.setYZCoeff00(1);
        xForm.setYZCoeff10(0);
        xForm.setYZCoeff20(0.01405521);
        xForm.setYZCoeff01(0);
        xForm.setYZCoeff11(1);
        xForm.setYZCoeff21(-0.01405521);
        xForm.setYZPostCoeff00(1);
        xForm.setYZPostCoeff10(0);
        xForm.setYZPostCoeff01(0);
        xForm.setYZPostCoeff11(1);
        xForm.setYZPostCoeff20(0);
        xForm.setYZPostCoeff21(0);
        xForm.setZXCoeff00(0.74081053);
        xForm.setZXCoeff10(-0.04366518);
        xForm.setZXCoeff20(-0.07027604);
        xForm.setZXCoeff01(0.04366518);
        xForm.setZXCoeff11(0.74081053);
        xForm.setZXCoeff21(-0.14055209);
        xForm.setZXPostCoeff00(1);
        xForm.setZXPostCoeff10(0);
        xForm.setZXPostCoeff01(0);
        xForm.setZXPostCoeff11(1);
        xForm.setZXPostCoeff20(0);
        xForm.setZXPostCoeff21(0);
        // variation 1
        xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
        // variation 2
        xForm.addVariation(-0.524, VariationFuncList.getVariationFuncInstance("zscale", 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);
        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("julia3Dq", true);
            varFunc.setParameter("power", Tools.FTOI(3 + Math.random() * 4.0));
            varFunc.setParameter("divisor", Math.random() > 0.5 ? 2 : 1.0 + Math.random() * 2.0);
            xForm.addVariation(1, 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);
    }
    return flame;
}
Also used : XForm(org.jwildfire.create.tina.base.XForm) Variation(org.jwildfire.create.tina.variation.Variation) Layer(org.jwildfire.create.tina.base.Layer) VariationFunc(org.jwildfire.create.tina.variation.VariationFunc) Flame(org.jwildfire.create.tina.base.Flame)

Example 5 with VariationFunc

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

the class SolidLabyrinthRandomFlameGenerator method createSubFlame.

private Flame createSubFlame() {
    Flame flame = new Flame();
    flame.getLayers().clear();
    flame.setCamRoll(0);
    flame.setCamPitch(0);
    flame.setCamYaw(0);
    flame.setCamPerspective(0);
    flame.setWidth(711);
    flame.setHeight(400);
    flame.setPixelsPerUnit(38.88427164);
    flame.setCamZoom(1);
    // create layer 1
    {
        Layer layer = new Layer();
        flame.getLayers().add(layer);
        layer.setWeight(1);
        layer.setVisible(true);
        // create a random gradient
        new RandomGradientMutation().execute(layer);
        // create transform 1
        {
            XForm xForm = new XForm();
            layer.getXForms().add(xForm);
            xForm.setWeight(0.5);
            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);
            if (Math.random() < 0.15) {
                if (Math.random() < 0.85) {
                    VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("dc_crackle_wf", true);
                    varFunc.setParameter("cellsize", 0.15 + Math.random() * 0.5);
                    varFunc.setParameter("power", 0.2 + Math.random() * 1.2);
                    varFunc.setParameter("distort", Math.random() > 0.2 ? Math.random() * 0.5 : 0.0);
                    varFunc.setParameter("scale", Math.random() > 0.667 ? 1.06 - Math.random() * 0.12 : 1.0);
                    varFunc.setParameter("z", Math.random() * 0.5);
                    varFunc.setParameter("color_scale", 0.5);
                    varFunc.setParameter("color_offset", 0);
                    xForm.addVariation(1.0 + Math.random() * 2.0, varFunc);
                } else {
                    {
                        VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("truchet", true);
                        varFunc.setParameter("extended", Math.random() < 0.25 ? 1 : 0);
                        varFunc.setParameter("exponent", 0.2 + Math.random() * 1.3);
                        varFunc.setParameter("arc_width", 0.5 + Math.random() * 0.5);
                        varFunc.setParameter("rotation", 0);
                        varFunc.setParameter("size", 0.4 + Math.random() * 0.3);
                        varFunc.setParameter("seed", 50.0 + Math.random() * 50.0);
                        varFunc.setParameter("direct_color", 1);
                        xForm.addVariation(1, varFunc);
                    }
                    xForm.addVariation(2.0 + Math.random() * 2.0, VariationFuncList.getVariationFuncInstance("pre_blur", true));
                }
            } else {
                VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("dc_perlin", true);
                varFunc.setParameter("shape", (int) (Math.random() * 3.0));
                varFunc.setParameter("map", Math.random() < 0.15 ? (int) (Math.random() * 6.0) : 2);
                varFunc.setParameter("select_centre", 0);
                varFunc.setParameter("select_range", 1);
                varFunc.setParameter("centre", 0.25 + Math.random() * 0.5);
                varFunc.setParameter("range", 0.25 + Math.random() * 0.5);
                varFunc.setParameter("edge", 0);
                varFunc.setParameter("scale", 1.0 + Math.random() * 5.0);
                varFunc.setParameter("octaves", Math.random() < 0.33 ? Tools.FTOI(2 + Math.random() * 2.0) : 2);
                varFunc.setParameter("amps", Math.random() < 0.33 ? Tools.FTOI(2 + Math.random() * 2.0) : 2);
                varFunc.setParameter("freqs", Math.random() < 0.33 ? Tools.FTOI(2 + Math.random() * 2.0) : 2);
                varFunc.setParameter("z", 0);
                varFunc.setParameter("select_bailout", 10);
                xForm.addVariation(3.0 + Math.random() * 4.0, 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);
        }
    }
    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