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