use of org.jwildfire.create.tina.base.Flame 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.base.Flame in project JWildfire by thargor6.
the class ExperimentalSimpleRandomFlameGenerator 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.setPixelsPerUnit(200);
layer.getFinalXForms().clear();
layer.getXForms().clear();
int maxXForms = (int) (1.0 + Math.random() * 5.0);
double scl = 1.0;
for (int i = 0; i < maxXForms; i++) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
if (Math.random() < 0.5) {
XFormTransformService.rotate(xForm, 360.0 * Math.random());
} else {
XFormTransformService.rotate(xForm, -360.0 * Math.random());
}
XFormTransformService.localTranslate(xForm, Math.random() - 1.0, Math.random() - 1.0);
scl *= 0.75 + Math.random() / 4;
XFormTransformService.scale(xForm, scl, true, true);
xForm.setColor(Math.random());
xForm.addVariation(Math.random() * 0.3 + 0.2, new Linear3DFunc());
if (Math.random() > 0.1) {
String[] fnc = FNCLST_EXPERIMENTAL;
int fncIdx = (int) (Math.random() * fnc.length);
xForm.addVariation(0.2 + Math.random() * 0.6, VariationFuncList.getVariationFuncInstance(fnc[fncIdx], true));
}
xForm.setWeight(Math.random() * 0.9 + 0.1);
}
return flame;
}
use of org.jwildfire.create.tina.base.Flame 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;
}
use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class GalaxiesRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCamRoll(1.49758722);
flame.setCamPitch(0);
flame.setCamYaw(0);
flame.setCamPerspective(0);
flame.setWidth(601);
flame.setHeight(338);
flame.setPixelsPerUnit(92.48366013);
flame.setCamZoom(0.72 + Math.random() * 0.42);
flame.setCentreX(1.5357526);
flame.setCentreY(-0.4416446);
layer.getFinalXForms().clear();
layer.getXForms().clear();
// create transform 1
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(25.75871591);
xForm.setColor(0.74488914);
xForm.setColorSymmetry(0);
// a
xForm.setCoeff00(1);
// b
xForm.setCoeff10(0);
// e
xForm.setCoeff20(1.09171281);
// c
xForm.setCoeff01(0);
// d
xForm.setCoeff11(1);
// f
xForm.setCoeff21(-1.22115911);
xForm.setPostCoeff00(1);
xForm.setPostCoeff10(0);
xForm.setPostCoeff01(0);
xForm.setPostCoeff11(1);
xForm.setPostCoeff20(0);
xForm.setPostCoeff21(0);
// variation 1
{
double amount = Math.random() > 0.25 ? 1.0 - 2.0 * Math.random() : 1.0;
xForm.addVariation(amount, getRandomVariation());
if (Math.random() > 0.5) {
new RandomParamMutation().setRandomFlameProperty(flame.getFirstLayer(), 1.0);
}
}
}
// create transform 2
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(286.87636036);
xForm.setColor(0.90312262);
xForm.setColorSymmetry(0.95);
// a
xForm.setCoeff00(0.96333808);
// b
xForm.setCoeff10(0.12845865);
// e
xForm.setCoeff20(0.31387449);
// c
xForm.setCoeff01(-0.12845865);
// d
xForm.setCoeff11(0.96333808);
// f
xForm.setCoeff21(0.08003269);
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("sec", true));
}
if (Math.random() > 0.5) {
new LocalGammaMutation().execute(flame.getFirstLayer());
}
return flame;
}
use of org.jwildfire.create.tina.base.Flame in project JWildfire by thargor6.
the class GnarlRandomFlameGenerator 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);
flame.setPixelsPerUnit(200);
layer.getFinalXForms().clear();
layer.getXForms().clear();
// init
double scaleX = Math.random() * 0.04 + 0.04;
if (Math.random() > 0.75) {
scaleX = 0 - scaleX;
}
double scaleY = Math.random() * 0.04 + 0.04;
if (Math.random() > 0.75) {
scaleY = 0 - scaleY;
} else if (Math.random() < 0.25) {
scaleY = scaleX;
}
double freqX, freqY;
if (Math.random() < 0.5) {
freqX = Math.random() * 2.0 + 2.0;
if (Math.random() > 0.5) {
freqY = freqX;
} else {
freqY = Math.random() * 2.0 + 2.0;
}
} else {
freqX = -Math.random() * 2.0 + 2.0;
if (Math.random() > 0.5) {
freqY = freqX;
} else {
freqY = -Math.random() * 2.0 + 16.0;
}
}
double blurAmount = 0.0025 * Math.random();
if (Math.random() < 0.33) {
blurAmount = 0.0 - blurAmount;
}
double wavesWeight = Math.random() * 15 + 135;
double _2ndWeight = 0.5;
double _3rdWeight = 0.5;
double symmetry = 0.7 + Math.random() * 0.3;
int sides = (int) (Math.random() * 8.0 + 3.0);
// 1st XForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(wavesWeight);
VariationFunc w2 = Math.random() > 0.89 ? createWaves2Variation(scaleX, scaleY, freqX, freqY) : createWaves2BVariation(scaleX, scaleY, freqX, freqY);
xForm.addVariation(1 + Math.random() * 0.001, w2);
String[] varLst = { "blur", "cos", "exp", "exponential", "lazysusan", "ngon", "sech", "sinh", "epispiral_wf", "tanh", "twintrian", "epispiral" };
String varName = Math.random() > 0.25 ? varLst[(int) (Math.random() * varLst.length)] : VariationFuncList.getRandomVariationname();
xForm.addVariation(blurAmount, VariationFuncList.getVariationFuncInstance(varName, true));
xForm.setColorSymmetry(symmetry);
xForm.setColor(0.9);
if (Math.random() > 0.5) {
XFormTransformService.scale(xForm, 0.995, true, true);
}
double angle, tx, ty;
switch(sides) {
case 3:
angle = -120;
tx = Math.random() * 8 - 4;
ty = Math.random() * 8 - 4;
break;
case 4:
angle = -90;
tx = Math.random() * 8 - 4;
ty = Math.random() * 8 - 4;
break;
case 5:
angle = -72;
tx = Math.random() * 7 - 3.5;
ty = Math.random() * 7 - 3.5;
break;
case 6:
angle = -60;
tx = Math.random() * 7 - 3.5;
ty = Math.random() * 7 - 3.5;
break;
case 7:
angle = -51.42857;
tx = Math.random() * 6 - 3;
ty = Math.random() * 6 - 3;
break;
case 8:
angle = -135;
tx = Math.random() * 6 - 3;
ty = Math.random() * 6 - 3;
break;
case 9:
angle = -40;
tx = Math.random() * 5 - 2.5;
ty = Math.random() * 5 - 2.5;
break;
case 10:
angle = -36;
tx = Math.random() * 4 - 2;
ty = Math.random() * 4 - 2;
break;
default:
throw new IllegalStateException();
}
XFormTransformService.rotate(xForm, angle);
XFormTransformService.localTranslate(xForm, tx * 1.5, ty * 1.5);
}
// 2nd XForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(_2ndWeight);
int f = Tools.randomInt(3);
switch(f) {
case 0:
xForm.addVariation(Math.random() * 0.37 + 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
break;
case 1:
xForm.addVariation(Math.random() * 0.37 + 0.3, VariationFuncList.getVariationFuncInstance("bubble", true));
xForm.addVariation(Math.random() * 0.37 + 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
break;
case 2:
xForm.addVariation(Math.random() * 0.1, VariationFuncList.getVariationFuncInstance("radial_blur", true));
JuliaNFunc juliaN = (JuliaNFunc) VariationFuncList.getVariationFuncInstance("julian", true);
juliaN.setParameter("power", 50 - Math.random() * 100);
juliaN.setParameter("dist", Math.random() * 10 - 2);
xForm.addVariation(Math.random() * 0.06 + 0.1, juliaN);
break;
default:
// nothing to do
break;
}
xForm.setColorSymmetry(-1);
}
// 3rd XForm
if (Math.random() > 0.75) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(_3rdWeight);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
XFormTransformService.rotate(xForm, 180 - Math.random() * 360.0);
XFormTransformService.localTranslate(xForm, 1.0 - 2.0 * Math.random(), 1.0 - 2.0 * Math.random());
xForm.setColorSymmetry(-1);
}
return flame;
}
Aggregations