use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class TileBallRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
flame.setCentreX(0.1 - Math.random() * 0.2);
flame.setCentreY(-0.6 + Math.random() * 0.3);
flame.setPixelsPerUnit(200);
flame.setCamZoom(1.0 + Math.random() * 0.5);
flame.setCamPitch(25.0 + Math.random() * 40.0);
flame.setCamPerspective(0.1 + Math.random() * 0.2);
flame.setPreserveZ(true);
Layer layer = flame.getFirstLayer();
layer.getFinalXForms().clear();
layer.getXForms().clear();
double tileSpacing = 0.5;
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
xForm.addVariation(1.5 + Math.random() * 1.5, VariationFuncList.getVariationFuncInstance("ztranslate", true));
xForm.setColor(Math.random());
xForm.setColorSymmetry(1.0);
xForm.getModifiedWeights()[10] = 0.0;
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
xForm.setColorSymmetry(1.0);
XFormTransformService.localTranslate(xForm, 0, tileSpacing);
xForm.getModifiedWeights()[10] = 0.0;
}
// 3rd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
xForm.setColorSymmetry(1.0);
XFormTransformService.localTranslate(xForm, tileSpacing, tileSpacing);
xForm.getModifiedWeights()[10] = 0.0;
}
// 4th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
xForm.setColorSymmetry(1.0);
XFormTransformService.localTranslate(xForm, tileSpacing, 0);
xForm.getModifiedWeights()[10] = 0.0;
}
// 5th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
xForm.setColorSymmetry(1.0);
XFormTransformService.localTranslate(xForm, tileSpacing, -tileSpacing);
xForm.getModifiedWeights()[10] = 0.0;
}
// 6th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
xForm.setColorSymmetry(1.0);
XFormTransformService.localTranslate(xForm, 0, -tileSpacing);
xForm.getModifiedWeights()[10] = 0.0;
}
// 7th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
xForm.setColorSymmetry(1.0);
XFormTransformService.localTranslate(xForm, -tileSpacing, -tileSpacing);
xForm.getModifiedWeights()[10] = 0.0;
}
// 8th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
xForm.setColorSymmetry(1.0);
XFormTransformService.localTranslate(xForm, -tileSpacing, 0);
xForm.getModifiedWeights()[10] = 0.0;
}
// 9th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("linear3D", true));
xForm.setColorSymmetry(1.0);
XFormTransformService.localTranslate(xForm, -tileSpacing, tileSpacing);
xForm.getModifiedWeights()[10] = 0.0;
}
// 10th xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.25 + Math.random() * 1.25);
VariationFunc var = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.2 + Math.random() * 0.6, var);
randomizeParams(var);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("flatten", true));
xForm.setColor(Math.random());
xForm.setColorSymmetry(Math.random());
xForm.getModifiedWeights()[0] = 0.0;
xForm.getModifiedWeights()[1] = 0.0;
xForm.getModifiedWeights()[2] = 0.0;
xForm.getModifiedWeights()[3] = 0.0;
xForm.getModifiedWeights()[4] = 0.0;
xForm.getModifiedWeights()[5] = 0.0;
xForm.getModifiedWeights()[6] = 0.0;
xForm.getModifiedWeights()[7] = 0.0;
xForm.getModifiedWeights()[8] = 0.0;
xForm.getModifiedWeights()[9] = 0.0;
xForm.getModifiedWeights()[10] = 1.0;
}
// 11st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.25 + Math.random() * 1.25);
VariationFunc var = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
xForm.addVariation(0.1 + Math.random() * 0.3, var);
randomizeParams(var);
xForm.addVariation(1.0, VariationFuncList.getVariationFuncInstance("flatten", true));
xForm.setColor(Math.random());
xForm.setColorSymmetry(Math.random());
xForm.getModifiedWeights()[10] = 0.0;
}
// final xForm
{
XForm xForm = new XForm();
layer.getFinalXForms().add(xForm);
xForm.setWeight(0.8 + Math.random() * 0.5);
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("curl3D", true);
varFunc.setParameter("cx", -0.75 + Math.random() * 1.5);
varFunc.setParameter("cy", 0.8 + Math.random() * 0.4);
varFunc.setParameter("cz", 0.025 + Math.random() * 0.05);
xForm.addVariation(1.0, varFunc);
}
return flame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class MachineRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCentreX(Math.random() - 0.5);
flame.setCentreY(Math.random() - 0.5);
flame.setCamRoll(0);
flame.setCamPitch(0);
flame.setCamYaw(0);
flame.setCamPerspective(0);
flame.setCamZoom(1);
flame.setPixelsPerUnit(200);
layer.getFinalXForms().clear();
layer.getXForms().clear();
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(32.16406573);
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.82382673);
// c
xForm.setCoeff01(0);
// d
xForm.setCoeff11(1);
// f
xForm.setCoeff21(-1.8206164);
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(1, varFunc);
}
flame.setEditPlane(EditPlane.XY);
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);
}
// 2nd xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(257.3608644);
xForm.setColor(0.90312262);
xForm.setColorSymmetry(0.95);
xForm.setMaterial(0);
xForm.setMaterialSpeed(0);
// a
xForm.setCoeff00(0.82496229);
// b
xForm.setCoeff10(0.55902149);
// e
xForm.setCoeff20(0.05455807);
// c
xForm.setCoeff01(-0.55902149);
// d
xForm.setCoeff11(0.82496229);
// f
xForm.setCoeff21(0.73105973);
xForm.setPostCoeff00(1);
xForm.setPostCoeff10(0);
xForm.setPostCoeff01(0);
xForm.setPostCoeff11(1);
xForm.setPostCoeff20(0);
xForm.setPostCoeff21(0);
// change relative weights
xForm.getModifiedWeights()[0] = 0.54127492;
// variation 1
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("yin_yang", true);
varFunc.setParameter("radius", 0.25 + Math.random() * 0.5);
varFunc.setParameter("ang1", 0);
varFunc.setParameter("ang2", 0.1 + Math.random() * 0.5);
varFunc.setParameter("dual_t", 1);
varFunc.setParameter("outside", 1);
xForm.addVariation(0.75 + Math.random() * 0.5, varFunc);
}
flame.setEditPlane(EditPlane.XY);
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);
}
flame.getFirstLayer().randomizeColors();
return flame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class MandelbrotRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCentreX(0.0);
flame.setCentreY(0.45);
flame.setCamPitch(49.0);
flame.setCamRoll(00.0);
flame.setCamYaw(0.0);
flame.setCamZoom(1.0);
flame.setGamma(2.0);
flame.setCamPerspective(0.05 + Math.random() * 0.12);
flame.setPixelsPerUnit(200);
flame.setPreserveZ(true);
layer.getFinalXForms().clear();
layer.getXForms().clear();
VariationFunc varFunc;
// 1st xForm
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
int varId = Tools.randomInt(6);
switch(varId) {
case 0:
varFunc = VariationFuncList.getVariationFuncInstance("fract_dragon_wf", true);
varFunc.setParameter("scale", 2.0);
varFunc.setParameter("xmin", -2.0);
varFunc.setParameter("xmax", 2.0);
varFunc.setParameter("ymin", -2.0);
varFunc.setParameter("ymax", 2.0);
varFunc.setParameter("xseed", -1.0 + 2.0 * Math.random());
varFunc.setParameter("yseed", -1.0 + 2.0 * Math.random());
break;
case 1:
varFunc = VariationFuncList.getVariationFuncInstance("fract_julia_wf", true);
varFunc.setParameter("scale", 2.0);
varFunc.setParameter("xmin", -2.0);
varFunc.setParameter("xmax", 2.0);
varFunc.setParameter("ymin", -2.0);
varFunc.setParameter("ymax", 2.0);
varFunc.setParameter("xseed", -1.0 + 2.0 * Math.random());
varFunc.setParameter("yseed", -1.0 + 2.0 * Math.random());
break;
case 2:
varFunc = VariationFuncList.getVariationFuncInstance("fract_pearls_wf", true);
varFunc.setParameter("scale", 2.0);
varFunc.setParameter("xmin", -2.0);
varFunc.setParameter("xmax", 2.0);
varFunc.setParameter("ymin", -2.0);
varFunc.setParameter("ymax", 2.0);
varFunc.setParameter("xseed", -1.0 + 2.0 * Math.random());
varFunc.setParameter("yseed", -1.0 + 2.0 * Math.random());
break;
case 3:
varFunc = VariationFuncList.getVariationFuncInstance("fract_salamander_wf", true);
varFunc.setParameter("scale", 2.0);
varFunc.setParameter("xmin", -2.0);
varFunc.setParameter("xmax", 2.0);
varFunc.setParameter("ymin", -2.0);
varFunc.setParameter("ymax", 2.0);
varFunc.setParameter("xseed", -1.0 + 2.0 * Math.random());
varFunc.setParameter("yseed", -1.0 + 2.0 * Math.random());
break;
case 4:
varFunc = VariationFuncList.getVariationFuncInstance("fract_mandelbrot_wf", true);
break;
default:
varFunc = VariationFuncList.getVariationFuncInstance("fract_meteors_wf", true);
break;
}
if (Math.random() < 0.8) {
double scale = 3 + Math.random() * 3;
double xmin = -1.0 + 2.0 * Math.random();
double ymin = -1.0 + 2.0 * Math.random();
double xmax = xmin + 4.0 / scale;
double ymax = ymin + 4.0 / scale;
varFunc.setParameter("xmin", xmin);
varFunc.setParameter("xmax", xmax);
varFunc.setParameter("ymin", ymin);
varFunc.setParameter("ymax", ymax);
varFunc.setParameter("offsetx", -(xmax - xmin) * 0.5);
varFunc.setParameter("offsety", -(ymax - ymin) * 0.5);
varFunc.setParameter("scale", 2.0 * scale);
}
varFunc.setParameter("scalez", 1.0 + Math.random() * 10.0);
xForm.addVariation(1.0, varFunc);
}
// final
if (Math.random() < 0.75) {
XForm xForm = new XForm();
layer.getFinalXForms().add(xForm);
varFunc = VariationFuncList.getVariationFuncInstance(FNCLST_FINAL[(int) (Math.random() * FNCLST_FINAL.length)], true);
xForm.addVariation(1.0, varFunc);
}
flame.getFirstLayer().randomizeColors();
return flame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class SolidShadowsRandomFlameGenerator method postProcessFlameAfterRendering.
@Override
protected Flame postProcessFlameAfterRendering(RandomFlameGeneratorState pState, Flame pFlame) {
pFlame.setCamZoom(0.5 + Math.random() * 0.25);
pFlame.setCamPerspective(0.05 + Math.random() * 0.15);
pFlame.setCamPitch(-5.0 - Math.random() * 30.0);
pFlame.setCamYaw(-25.0 + Math.random() * 50.0);
pFlame.setCamRoll(0.0);
XForm xform0 = pFlame.getFirstLayer().getXForms().get(0);
Variation var0 = xform0.getVariation(0);
var0.setAmount(var0.getAmount() * (0.25 + Math.random() * 0.25));
Layer layer = new Layer();
layer.setWeight(0.25 + Math.random() * 0.5);
pFlame.getLayers().add(layer);
new RandomGradientMutation().execute(layer);
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
if (Math.random() < 0.5) {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("plane_wf", true);
varFunc.setParameter("axis", 2);
varFunc.setParameter("position", Math.random() * 2.0 - 0.25);
varFunc.setParameter("color_mode", Tools.FTOI(4 * Math.random()));
xForm.addVariation(1.0 + Math.random(), varFunc);
} else {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("checkerboard_wf", true);
varFunc.setParameter("axis", 2);
varFunc.setParameter("position", Math.random() * 2.0 - 0.25);
varFunc.setParameter("checker_size", 0.05 + Math.random() * 0.1);
varFunc.setParameter("displ_amount", 0.005 + Math.random() * 0.03);
varFunc.setParameter("with_sides", Math.random() > 0.25 ? 1 : 0);
xForm.addVariation(1.0 + Math.random(), varFunc);
}
}
pFlame.getSolidRenderSettings().setShadowType(Math.random() < 0.5 ? ShadowType.SMOOTH : ShadowType.FAST);
return pFlame;
}
use of org.jwildfire.create.tina.variation.VariationFunc in project JWildfire by thargor6.
the class XenomorphRandomFlameGenerator 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();
// create transform 1
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.1 + Math.random() * 0.4);
xForm.setColor(0.74488914);
xForm.setColorSymmetry(0);
// a
xForm.setCoeff00(0.75610133);
// b
xForm.setCoeff10(-0.74186252);
// e
xForm.setCoeff20(5.25778565);
// c
xForm.setCoeff01(0.74186252);
// d
xForm.setCoeff11(0.75610133);
// f
xForm.setCoeff21(-0.34949139);
xForm.setPostCoeff00(-0.42606416);
xForm.setPostCoeff10(0.44290131);
xForm.setPostCoeff01(-0.10610689);
xForm.setPostCoeff11(-0.40885976);
xForm.setPostCoeff20(-2.81712);
xForm.setPostCoeff21(7.390367);
// variation 1
xForm.addVariation(1.43, VariationFuncList.getVariationFuncInstance("bubble", true));
// variation 2
xForm.addVariation(0.012, VariationFuncList.getVariationFuncInstance("linear", true));
// variation 3
if (Math.random() > 0.6) {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("radial_blur", true);
varFunc.setParameter("angle", 0.609835);
xForm.addVariation(-0.249, varFunc);
} else {
xForm.addVariation(Math.random() < 0.5 ? -0.249 : 0.5 - Math.random(), VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true));
}
// variation 4
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("power", true));
// 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(10.0 + Math.random() * 8.0);
xForm.setColor(0.90312262);
xForm.setColorSymmetry(0.95);
// a
xForm.setCoeff00(-0.85421287);
// b
xForm.setCoeff10(-0.63343313);
// e
xForm.setCoeff20(1.09379129);
// c
xForm.setCoeff01(-0.63343313);
// d
xForm.setCoeff11(0.85421287);
// f
xForm.setCoeff21(-0.20406326);
xForm.setPostCoeff00(0.84389756);
xForm.setPostCoeff10(-0.35800434);
xForm.setPostCoeff01(0.43174917);
xForm.setPostCoeff11(0.89637273);
xForm.setPostCoeff20(-0.945758);
xForm.setPostCoeff21(-0.4502584);
// change relative weights
xForm.getModifiedWeights()[0] = 2.05;
xForm.getModifiedWeights()[1] = 1.25;
xForm.getModifiedWeights()[2] = 0.9;
// variation 1
xForm.addVariation(0.008, VariationFuncList.getVariationFuncInstance("linear", true));
// variation 2
xForm.addVariation(10.72, VariationFuncList.getVariationFuncInstance("spherical", true));
// random affine transforms (uncomment to play around)
XFormTransformService.scale(xForm, 1.25 - Math.random() * 0.5, true, true, false);
XFormTransformService.rotate(xForm, 36.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(0.7);
xForm.setColor(0.47272985);
xForm.setColorSymmetry(0);
// a
xForm.setCoeff00(0.68724662);
// b
xForm.setCoeff10(-0.72642418);
// e
xForm.setCoeff20(-2.14812602);
// c
xForm.setCoeff01(0.72642418);
// d
xForm.setCoeff11(0.68724662);
// f
xForm.setCoeff21(2.39994214);
xForm.setPostCoeff00(0.60646395);
xForm.setPostCoeff10(0.79511098);
xForm.setPostCoeff01(-0.79511098);
xForm.setPostCoeff11(0.60646395);
xForm.setPostCoeff20(-1.06135064);
xForm.setPostCoeff21(-0.6369509);
// variation 1
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("bipolar", true);
varFunc.setParameter("shift", 0);
xForm.addVariation(1, varFunc);
}
// 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;
}
Aggregations