use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class SpiralsRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
flame.setCentreX(-Math.random() * 0.5);
flame.setCentreY(-Math.random() * 0.5);
flame.setPixelsPerUnit(200);
flame.setCamRoll(90.0 - Math.random() * 180);
flame.setCamPitch(0);
flame.setCamYaw(0);
flame.setCamPerspective(0);
flame.setCamZoom(2.0);
Layer layer = flame.getFirstLayer();
layer.getFinalXForms().clear();
layer.getXForms().clear();
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(25.0 + Math.random() * 55.0);
xForm.setColor(0.9);
xForm.setColorSymmetry(0.93185856);
// a
xForm.setCoeff00(0.23168009);
// b
xForm.setCoeff10(-0.87153216);
// e
xForm.setCoeff20(-1.09851548);
// c
xForm.setCoeff01(1.01859563);
// d
xForm.setCoeff11(0.23718475);
// f
xForm.setCoeff21(0.30609214);
xForm.setPostCoeff00(1);
xForm.setPostCoeff10(0);
xForm.setPostCoeff01(0);
xForm.setPostCoeff11(1);
xForm.setPostCoeff20(0);
xForm.setPostCoeff21(0);
// variation 1
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("waves2", true);
varFunc.setParameter("scalex", 0.04933602 + Math.random() * 0.04);
varFunc.setParameter("scaley", 0.06933602);
varFunc.setParameter("freqx", 2.98088993);
varFunc.setParameter("freqy", 2.98088993);
xForm.addVariation(1, varFunc);
}
// variation 2
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.001 + Math.random() * 0.001, varFunc);
}
// variation 3
if (Math.random() < 0.33) {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.0001 + Math.random() * 0.0001, varFunc).setPriority(-1);
}
xForm.setColor(0.4 + Math.random() * 0.2);
xForm.setColorSymmetry(0.82 + Math.random() * 0.16);
// XFormTransformService.rotate(xForm, 180, false);
// XFormTransformService.scale(xForm, 2.0 + Math.random() * 25.0, true, true, false);
XFormTransformService.localTranslate(xForm, 0.5 * (0.5 - 1.0 * Math.random()), 0.5 - 1.0 * Math.random(), true);
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.setColor(0);
xForm.setColorSymmetry(-1);
// a
xForm.setCoeff00(1.1144261);
// b
xForm.setCoeff10(-0.1144261);
// e
xForm.setCoeff20(-0.1144261);
// c
xForm.setCoeff01(0.03033403);
// d
xForm.setCoeff11(0.96966597);
// f
xForm.setCoeff21(-0.03033403);
xForm.setPostCoeff00(1);
xForm.setPostCoeff10(0);
xForm.setPostCoeff01(0);
xForm.setPostCoeff11(1);
xForm.setPostCoeff20(0);
xForm.setPostCoeff21(0);
// variation 1
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.2 + Math.random() * 0.2, varFunc);
}
// variation 2
if (Math.random() > 0.42) {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.1 + Math.random() * 0.1, varFunc).setPriority(-1);
}
// variation 3
if (Math.random() > 0.42) {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.0001 + Math.random() * 0.0001, varFunc).setPriority(+1);
}
xForm.setColor(Math.random());
xForm.setColorSymmetry(Math.random());
}
return flame;
}
use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class SplitsRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCentreX(0.0);
flame.setCentreY(0.0);
flame.setCamPitch(0.0);
flame.setCamRoll(00.0);
flame.setCamYaw(0.0);
flame.setCamZoom(2.0);
flame.setGamma(2.7);
flame.setCamPerspective(0.0);
flame.setPixelsPerUnit(200);
layer.getFinalXForms().clear();
layer.getXForms().clear();
VariationFunc varFunc;
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5 + 0.4 * Math.random());
String fncName = FNCLST_TX1[Tools.randomInt(FNCLST_TX1.length)];
varFunc = VariationFuncList.getVariationFuncInstance(fncName, true);
xForm.addVariation(1.0, varFunc);
XFormTransformService.rotate(xForm, Math.random() < 0.5 ? 90.0 : -90.0, false);
xForm.setColor(0.60 + Math.random() * 0.20);
xForm.setColorSymmetry(Math.random() * 0.2);
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
varFunc = VariationFuncList.getVariationFuncInstance("splits", true);
if (Math.random() < 0.25) {
varFunc.setParameter("x", -0.5 + Math.random() * 1.0);
varFunc.setParameter("y", -0.5 + Math.random() * 1.0);
} else {
varFunc.setParameter("x", -1.0 + Math.random() * 4.0);
varFunc.setParameter("y", 0.0);
}
xForm.addVariation(1.0, varFunc);
XFormTransformService.scale(xForm, 0.6 + Math.random() * 0.8, true, true, false);
XFormTransformService.scale(xForm, 1.0 + Math.random() * 0.8, true, true, true);
xForm.setColor(0.40 + Math.random() * 0.20);
}
// 3th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.2 + 0.4 * Math.random());
String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length)];
// String fncName = Math.random() < 0.5 ? "linear" : "cylinder";
varFunc = VariationFuncList.getVariationFuncInstance(fncName, true);
xForm.addVariation(1.0, varFunc);
// XFormTransformService.scale(xForm, 5.0 + Math.random() * 10.0, false, true, true);
// XFormTransformService.scale(xForm, 0.5 + Math.random() * 0.75, true, false, true);
// XFormTransformService.scale(xForm, 0.2 + Math.random() * 0.8, true, true, false);
XFormTransformService.rotate(xForm, Math.random() < 0.5 ? 90.0 : -90.0, false);
xForm.setColor(0.60 + Math.random() * 0.20);
xForm.setColorSymmetry(Math.random() * 0.2);
}
// 4th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.3 + 0.8 * Math.random());
// String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[(int) (ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length * Math.random())];
String fncName = Math.random() < 0.5 ? "noise" : "cylinder";
varFunc = VariationFuncList.getVariationFuncInstance(fncName, true);
xForm.addVariation(1.0, varFunc);
XFormTransformService.scale(xForm, 5.0 + Math.random() * 10.0, false, true, true);
XFormTransformService.scale(xForm, 0.5 + Math.random() * 0.75, true, false, true);
XFormTransformService.scale(xForm, 0.2 + Math.random() * 0.8, true, true, false);
xForm.setColor(0.60 + Math.random() * 0.20);
xForm.setColorSymmetry(Math.random() * 0.2);
}
// flame.randomizeColors();
return flame;
}
use of org.jwildfire.create.tina.base.Flame 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.base.Flame in project JWildfire by thargor6.
the class WikimediaCommonsRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Prefs prefs = Prefs.getPrefs();
Flame flame = createSubFlame(prefs);
flame.setPixelsPerUnit(200);
return flame;
}
use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class OrchidsRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
flame.setCamRoll(-0);
flame.setCamPitch(0);
flame.setCamYaw(0);
flame.setCamPerspective(0);
flame.setWidth(638);
flame.setHeight(359);
flame.setPixelsPerUnit(315.33902046);
flame.setCamZoom(2.2 + Math.random() * 0.6);
// create layer 1
{
Layer layer = flame.getFirstLayer();
// create a random gradient
new RandomGradientMutation().execute(layer);
// create transform 1
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(4 + Math.random() * 2.0);
xForm.setColor(0.6 * Math.random());
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(1.5 + Math.random(), VariationFuncList.getVariationFuncInstance("elliptic", 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 2
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(1.5 + Math.random());
xForm.setColor(0.5 + Math.random() * 0.2);
xForm.setColorSymmetry(0);
xForm.setMaterial(0);
xForm.setMaterialSpeed(0);
// a
xForm.setCoeff00(-0.00283201);
// b
xForm.setCoeff10(0.99999599);
// e
xForm.setCoeff20(0);
// c
xForm.setCoeff01(-0.99999599);
// d
xForm.setCoeff11(-0.00283201);
// 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("poincare3D", true);
varFunc.setParameter("r", 0);
varFunc.setParameter("a", 0);
varFunc.setParameter("b", 0);
xForm.addVariation(Math.random() + 1.0, varFunc);
}
// variation 2
xForm.addVariation(10.0 * Math.random() - 5.0, VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true));
// set default edit plane
flame.setEditPlane(EditPlane.XY);
// random affine transforms (uncomment to play around)
XFormTransformService.scale(xForm, 0.5 + 2.0 * Math.random(), 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(1.2 + Math.random());
xForm.setColor(0.2 + Math.random() * 0.5);
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, VariationFuncList.getVariationFuncInstance("rays", 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.96);
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("hypertile1", true);
varFunc.setParameter("p", 4);
varFunc.setParameter("q", 6);
xForm.addVariation(0.3 + Math.random() * 0.8, 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);
}
// create final transform 2
{
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
if (Math.random() > 0.25) {
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance(Math.random() < 0.5 ? "polar" : "polar2", true));
} else {
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true));
}
}
if (Math.random() > 0.666) {
layer.getXForms().get(0).getModifiedWeights()[0] = 1.0 + Math.random();
layer.getXForms().get(0).getModifiedWeights()[2] = 0.2 * Math.random();
}
}
return flame;
}
Aggregations