Search in sources :

Example 1 with SubFlameWFFunc

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

the class SolidLabyrinthRandomFlameGenerator method embedSubFlame.

public void embedSubFlame(Flame flame, Flame subFlame) {
    Layer layer = flame.getFirstLayer();
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    {
        XForm xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.5);
        try {
            SubFlameWFFunc var = new SubFlameWFFunc();
            String flameXML = new FlameWriter().getFlameXML(subFlame);
            var.setRessource("flame", flameXML.getBytes());
            var.setParameter("color_mode", 0);
            double cs = (1.5 - Math.random() * 3.0);
            if (MathLib.fabs(cs) < 0.4) {
                cs = (Math.random() < 0.5 ? -0.3 - Math.random() : 0.3 + Math.random());
            }
            var.setParameter("colorscale_z", cs);
            xForm.addVariation(1, var);
        } catch (Exception ex) {
            ex.printStackTrace();
            Unchecker.rethrow(ex);
        }
        xForm.setColor(0);
        xForm.setColorSymmetry(-0.22);
    }
}
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)

Example 2 with SubFlameWFFunc

use of org.jwildfire.create.tina.variation.SubFlameWFFunc 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 3 with SubFlameWFFunc

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

the class SubFlameDOFBlurShape method prepare.

@Override
public void prepare(FlameTransformationContext pFlameTransformationContext, AbstractRandomGenerator pRandGen, double pCamDOF_10) {
    super.prepare(pFlameTransformationContext, pRandGen, pCamDOF_10);
    useColor = Tools.FTOI(params.get(PARAM_FLAME_COLORS)) > 0;
    s = new XYZPoint();
    d = new XYZPoint();
    xform = new XForm();
    fnc = new SubFlameWFFunc();
    for (String paramName : getParamNames()) {
        if (!PARAM_FLAME.equals(paramName) && !PARAM_FLAME_COLORS.equals(paramName)) {
            fnc.setParameter(paramName, params.get(paramName));
        }
    }
    fnc.setRessource(SubFlameWFFunc.RESSOURCE_FLAME, getFlameXML(Tools.FTOI(params.get(PARAM_FLAME))).getBytes());
    fnc.init(pFlameTransformationContext, new Layer(), xform, 1.0);
}
Also used : SubFlameWFFunc(org.jwildfire.create.tina.variation.SubFlameWFFunc) XForm(org.jwildfire.create.tina.base.XForm) XYZPoint(org.jwildfire.create.tina.base.XYZPoint) Layer(org.jwildfire.create.tina.base.Layer)

Aggregations

Layer (org.jwildfire.create.tina.base.Layer)3 XForm (org.jwildfire.create.tina.base.XForm)3 SubFlameWFFunc (org.jwildfire.create.tina.variation.SubFlameWFFunc)3 FlameWriter (org.jwildfire.create.tina.io.FlameWriter)2 Flame (org.jwildfire.create.tina.base.Flame)1 XYZPoint (org.jwildfire.create.tina.base.XYZPoint)1 VariationFunc (org.jwildfire.create.tina.variation.VariationFunc)1