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);
}
}
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;
}
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);
}
Aggregations