use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class OutlinesRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCentreX(0.1 - Math.random() * 0.2);
flame.setCentreY(0.1 - Math.random() * 0.2);
flame.setCamZoom(1.05 + Math.random() * 0.15);
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(26.32600695);
xForm.setColor(0.74488914);
xForm.setColorSymmetry(0);
xForm.setMaterial(0);
xForm.setMaterialSpeed(0);
// a
xForm.setCoeff00(1);
// b
xForm.setCoeff10(0);
// e
xForm.setCoeff20(1.25325706);
// c
xForm.setCoeff01(0);
// d
xForm.setCoeff11(1);
// f
xForm.setCoeff21(-0.93791588);
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("spherical3D", 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(224.48613855);
xForm.setColor(0.90312262);
xForm.setColorSymmetry(0.95);
xForm.setMaterial(0);
xForm.setMaterialSpeed(0);
// a
xForm.setCoeff00(1.07039553);
// b
xForm.setCoeff10(0.4803511);
// e
xForm.setCoeff20(-0.2742276);
// c
xForm.setCoeff01(-0.4803511);
// d
xForm.setCoeff11(1.07039553);
// f
xForm.setCoeff21(-0.04097021);
xForm.setPostCoeff00(1);
xForm.setPostCoeff10(0);
xForm.setPostCoeff01(0);
xForm.setPostCoeff11(1);
xForm.setPostCoeff20(0);
xForm.setPostCoeff21(0);
// variation 1
if (Math.random() > 0.1) {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("loonie2", true);
varFunc.setParameter("sides", 3 + (int) (Math.random() * 6));
varFunc.setParameter("star", 0.1 + Math.random() * 0.3);
varFunc.setParameter("circle", 0.1 + Math.random() * 0.3);
xForm.addVariation(1, varFunc);
} else {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
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);
}
// create transform 3
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(146.3720822);
xForm.setColor(0.6312262);
xForm.setColorSymmetry(0.12);
xForm.setMaterial(0);
xForm.setMaterialSpeed(0);
// a
xForm.setCoeff00(0.9031166);
// b
xForm.setCoeff10(0.38124873);
// e
xForm.setCoeff20(0.37716179);
// c
xForm.setCoeff01(-0.38124873);
// d
xForm.setCoeff11(0.9031166);
// f
xForm.setCoeff21(-0.53412667);
xForm.setPostCoeff00(1);
xForm.setPostCoeff10(0);
xForm.setPostCoeff01(0);
xForm.setPostCoeff11(1);
xForm.setPostCoeff20(0);
xForm.setPostCoeff21(0);
// change relative weights
xForm.getModifiedWeights()[2] = 0;
// variation 1
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.4 + Math.random() * 0.2, 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;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class BrokatRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
flame.setCentreX(0.0);
flame.setCentreY(0.0);
flame.setPixelsPerUnit(200);
flame.setCamZoom(2.0);
flame.setCamRoll(-90.0);
Layer layer = flame.getFirstLayer();
layer.getFinalXForms().clear();
layer.getXForms().clear();
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(1.5 + Math.random() * 1.0);
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("curl", true);
varFunc.setParameter("c1", -1.0);
varFunc.setParameter("c2", 0.001 + Math.random() * 0.0199);
xForm.addVariation(1.6 + Math.random() * 0.8, varFunc);
xForm.setColor(0.4 + Math.random() * 0.2);
xForm.setColorSymmetry(0.82 + Math.random() * 0.16);
XFormTransformService.rotate(xForm, 180, false);
XFormTransformService.localTranslate(xForm, 1.0, 0.0, true);
xForm.getModifiedWeights()[0] = 0.0;
xForm.getModifiedWeights()[1] = 1.0;
xForm.getModifiedWeights()[2] = 0.0;
xForm.getModifiedWeights()[3] = 0.0;
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.05 + Math.random() * 0.35);
String[] fncNames = { "juliascope", "julia3D", "julia3Dz", "julian" };
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(fncNames[Tools.randomInt(fncNames.length)], true);
varFunc.setParameter("power", Math.random() < 0.33 ? 2 : Math.random() < 0.5 ? 3 : 4);
xForm.addVariation(1.0, varFunc);
xForm.setColor(0.5 + Math.random() * 0.5);
xForm.setColorSymmetry(0.5);
xForm.getModifiedWeights()[0] = 1.0;
xForm.getModifiedWeights()[1] = 0.0;
xForm.getModifiedWeights()[2] = 1.0;
xForm.getModifiedWeights()[3] = 1.0;
}
// 3rd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.4 + Math.random() * 0.2);
String fncName;
if (Math.random() < 0.33) {
fncName = "bubble";
} else {
fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length)];
}
xForm.addVariation(0.01 + Math.random() * 0.04, VariationFuncList.getVariationFuncInstance(fncName, true));
xForm.addVariation(5.0 + Math.random() * 10.0, VariationFuncList.getVariationFuncInstance("pre_blur", true));
xForm.setColor(0.1 + Math.random() * 0.3);
xForm.setColorSymmetry(0);
XFormTransformService.localTranslate(xForm, -1.0, 0.0, true);
xForm.getModifiedWeights()[0] = 1.0;
xForm.getModifiedWeights()[1] = 1.0;
xForm.getModifiedWeights()[2] = 0.0;
xForm.getModifiedWeights()[3] = 0.0;
}
// 4th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.4 + Math.random() * 0.2);
String fncName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length)];
xForm.addVariation(0.01 + Math.random() * 0.04, VariationFuncList.getVariationFuncInstance(fncName, true));
if (Math.random() > 0.5) {
xForm.addVariation((0.01 + Math.random() * 0.04) * 0.5, VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true)).setPriority(-1);
}
xForm.setColor(0.1 + Math.random() * 0.3);
xForm.setColorSymmetry(0);
XFormTransformService.rotate(xForm, Math.random() * 360.0, true);
XFormTransformService.scale(xForm, 1.1 + Math.random() * 3.0, true, true, true);
xForm.getModifiedWeights()[0] = 1.0;
xForm.getModifiedWeights()[1] = 1.0;
xForm.getModifiedWeights()[2] = 1.0;
xForm.getModifiedWeights()[3] = 1.0;
}
return flame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class BubblesRandomFlameGenerator 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.setCamZoom(0.5);
flame.setPixelsPerUnit(200);
layer.getFinalXForms().clear();
layer.getXForms().clear();
int fncCount = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(12.0 + Math.random() * 80.0);
xForm.addVariation(2 + Math.random() * 4, VariationFuncList.getVariationFuncInstance("spherical", true));
String fName;
if (Math.random() < 0.15) {
fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(fncCount)];
} else {
fName = Math.random() < 0.8 ? "eyefish" : "fisheye";
}
xForm.addVariation(0.05 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance(fName, true));
xForm.setColorSymmetry(0.991 + Math.random() * 0.08);
XFormTransformService.scale(xForm, 0.5 - Math.random() * 0.5, true, true, false);
XFormTransformService.rotate(xForm, 180 - Math.random() * 360.0, false);
XFormTransformService.localTranslate(xForm, 3.0 - 6.0 * Math.random(), 3.0 - 6.0 * Math.random(), false);
if (Math.random() < 0.33) {
XFormTransformService.localTranslate(xForm, 0.75 - 1.5 * Math.random(), 0.75 - 1.5 * Math.random(), true);
}
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5 + Math.random() * 0.8);
if (Math.random() < 0.05) {
xForm.addVariation(0.01 + Math.random() * 0.4, VariationFuncList.getVariationFuncInstance("bubble", true));
VariationFunc checks = VariationFuncList.getVariationFuncInstance("checks", true);
checks.setParameter("size", 5.0);
checks.setParameter("x", 3.0);
checks.setParameter("y", 3.0);
xForm.addVariation(0.01 + Math.random() * 0.04, checks);
} else {
xForm.addVariation(0.1 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance("bubble", true));
}
xForm.addVariation(4 + Math.random() * 2, VariationFuncList.getVariationFuncInstance("pre_blur", true));
xForm.setColorSymmetry(-0.5);
XFormTransformService.scale(xForm, 1.1 + Math.random() * 1.9, true, true, false);
XFormTransformService.localTranslate(xForm, 0.75 - 1.50 * Math.random(), 0.75 - 1.50 * Math.random(), false);
XFormTransformService.rotate(xForm, 30 - Math.random() * 60.0, false);
}
// 3rd xForm
if (Math.random() > 0.25) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5 + Math.random() * 1.5);
String fName;
if (Math.random() > 0.8) {
fName = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(fncCount)];
} else {
fName = Math.random() > 0.5 ? "linear3D" : "noise";
}
xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance(fName, true));
xForm.setColorSymmetry(-0.5);
XFormTransformService.rotate(xForm, 30.0 - Math.random() * 60.0, false);
if (Math.random() < 0.5) {
XFormTransformService.scale(xForm, 0.5 + Math.random() * 1.5, true, true, false);
}
}
// 4th xForm
if (Math.random() > 0.5) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5 + Math.random() * 1.5);
String fName;
if (Math.random() > 0.8) {
fName = Math.random() > 0.75 ? VariationFuncList.getRandomVariationname() : ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL[Tools.randomInt(fncCount)];
} else {
fName = Math.random() > 0.5 ? "linear3D" : "gaussian_blur";
}
xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance(fName, true));
xForm.setColorSymmetry(-0.5);
XFormTransformService.rotate(xForm, 30.0 - Math.random() * 60.0, false);
if (Math.random() < 0.5) {
XFormTransformService.scale(xForm, 0.15 + Math.random() * 1.25, true, true, false);
}
}
flame.getFirstLayer().distributeColors();
return flame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class CrossRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
// Bases loosely on the W2R Batch Script by parrotdolphin.deviantart.com */
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCentreX(0.0);
flame.setCentreY(0.0);
if (Math.random() > 0.6) {
flame.setNewCamDOF(true);
flame.setCamDOF(Math.random() * 0.07);
} else {
flame.setNewCamDOF(false);
flame.setCamDOF(Math.random() * 0.2);
}
flame.setCamPitch(10 + Math.random() * 50);
flame.setPreserveZ(Math.random() > 0.33);
flame.setCamPerspective(0.10 + Math.random() * 0.5);
flame.setPixelsPerUnit(200);
layer.getFinalXForms().clear();
layer.getXForms().clear();
// create transform 1
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.setColorSymmetry(0.99 - Math.random() * 0.2);
// 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(-1);
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
}
// create transform 2
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.setColorSymmetry(0.8 - Math.random() * 0.1);
// 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(-1);
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
}
// create transform 3
{
XForm xForm = new XForm();
xForm.setWeight(0.5);
layer.getXForms().add(xForm);
xForm.setColor(0.1 + Math.random() * 0.1);
xForm.setColorSymmetry(0.92);
// 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(1);
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
}
// create transform 4
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.setColorSymmetry(0.9 - Math.random() * 0.2);
// 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(1);
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
}
// create transform 5
XForm xForm5;
{
XForm xForm = xForm5 = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.05 + Math.random() * 0.2);
xForm.setColorSymmetry(0.10 + Math.random() * 0.2);
// 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.70711);
xForm.setPostCoeff10(0.70711);
xForm.setPostCoeff01(-0.70711);
xForm.setPostCoeff11(0.70711);
xForm.setPostCoeff20(0);
xForm.setPostCoeff21(0);
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.45, varFunc);
}
}
// create optional linked transform 6
if (Math.random() > 0.75) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.05 + Math.random() * 0.2);
xForm.setColorSymmetry(0.10 + Math.random() * 0.2);
// 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.70711);
xForm.setPostCoeff10(0.70711);
xForm.setPostCoeff01(-0.70711);
xForm.setPostCoeff11(0.70711);
xForm.setPostCoeff20(0);
xForm.setPostCoeff21(0);
xForm.getModifiedWeights()[5] = 0;
xForm5.getModifiedWeights()[0] = 0;
xForm5.getModifiedWeights()[1] = 0;
xForm5.getModifiedWeights()[2] = 0;
xForm5.getModifiedWeights()[3] = 0;
xForm5.getModifiedWeights()[4] = 0;
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.1 + Math.random() * 0.6, varFunc);
}
}
// create final transform 1
{
XForm xForm = new XForm();
layer.getFinalXForms().add(xForm);
xForm.setWeight(0);
xForm.setColorSymmetry(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);
XFormTransformService.rotate(xForm, Math.random() * 360.0, true);
XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random(), true);
if (Math.random() > 0.75) {
String[] variations = { "cross", "boarders2", "boarders", "butterfly", "cos", "cosh", "cosine", "csc", "cylinder", "cylinder_apo", "dc_ztransl", "elliptic", "eyefish", "fibonacci2", "heart_wf", "hypertile1", "loonie", "mobius", "perspective", "popcorn", "popcorn2_3D", "ripple", "roundspher3D", "scry_3D", "sec", "secant2", "separation", "shredlin", "sin", "spherical", "spiral", "stripes", "unpolar", "waves2", "waves4_wf", "whorl", "xtrb", "rays1", "rays2", "rays3" };
String varName = Math.random() < 0.25 ? "cross" : Math.random() < 0.25 ? "rays2" : variations[(int) (Math.random() * variations.length)];
xForm.addVariation(1.57, VariationFuncList.getVariationFuncInstance(varName, true));
} else {
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true));
}
}
layer.randomizeColors();
return flame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class Flowers3DRandomFlameGenerator 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(49.0);
flame.setCamYaw(12.0);
flame.setPixelsPerUnit(200);
layer.getFinalXForms().clear();
layer.getXForms().clear();
// int fncCount = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL.length;
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5 + Math.random());
xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance("gaussian_blur", true));
xForm.setColor(0.0);
xForm.setColorSymmetry(0.0);
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(3.0 + Math.random() * 10.0);
if (Math.random() < 0.33) {
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
} else {
VariationFunc f = VariationFuncList.getVariationFuncInstance("linearT3D", true);
double x = 2.0 * Math.random() - 0.5;
f.setParameter("powX", x);
f.setParameter("powY", x);
f.setParameter("powZ", 2.0 * Math.random() - 0.5);
xForm.addVariation(1.0, f);
}
xForm.addVariation(0.1 + Math.random() * 0.3, VariationFuncList.getVariationFuncInstance("spherical", true));
xForm.addVariation(0.2 + Math.random() * 0.9, VariationFuncList.getVariationFuncInstance("zcone", true));
xForm.addVariation(0.01 + 0.045 * Math.random(), VariationFuncList.getVariationFuncInstance("cross", true));
if (Math.random() < 0.33) {
VariationFunc ef = VariationFuncList.getVariationFuncInstance("epispiral_wf", true);
ef.setParameter("waves", 3 + Tools.randomInt(10));
xForm.addVariation(0.02 + 0.29 * Math.random(), ef);
if (Math.random() < 0.33) {
VariationFunc ef2 = VariationFuncList.getVariationFuncInstance("epispiral", true);
ef2.setParameter("thickness", 0.05 + Math.random() * 0.15);
ef2.setParameter("n", 3.0 + Math.random() * 10.0);
xForm.addVariation(0.01 + 0.14 * Math.random(), ef2);
}
}
xForm.setColor(Math.random());
xForm.setColorSymmetry(Math.random());
XFormTransformService.scale(xForm, 1.0 + (0.1 - Math.random() * 0.2), true, true, false);
XFormTransformService.rotate(xForm, 45.0 - Math.random() * 90.0, false);
XFormTransformService.localTranslate(xForm, 0.01 - 0.02 * Math.random(), 0.01 - 0.02 * Math.random(), false);
}
// 3rd xForm
boolean advStructure = Math.random() > 0.25;
if (advStructure) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.3 + Math.random() * 0.3);
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("blob3D", true);
varFunc.setParameter("low", 0.1);
varFunc.setParameter("high", 0.3);
varFunc.setParameter("waves", 9.0);
xForm.addVariation(0.05, varFunc);
xForm.setColor(0.0);
xForm.setColorSymmetry(1.0);
// 4th xForm
}
if (advStructure && Math.random() > 0.25) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.1 + Math.random() * 0.3);
xForm.addVariation(0.5, VariationFuncList.getVariationFuncInstance("blur3D", true));
xForm.addVariation(15.0, VariationFuncList.getVariationFuncInstance("ztranslate", true));
xForm.setColor(0.0);
xForm.setColorSymmetry(1.0);
}
// final xForm
{
XForm xForm = new XForm();
layer.getFinalXForms().add(xForm);
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("julia3D", true);
double power = -2.0;
if (Math.random() < 0.25) {
power -= Math.random() * 4.0;
}
varFunc.setParameter("power", power);
xForm.addVariation(2.0 + (1.0 - 2.0 * Math.random()), varFunc);
xForm.setColor(0.0);
xForm.setColorSymmetry(0.0);
}
return flame;
}
Aggregations