use of org.jwildfire.create.tina.base.Layer in project JWildfire by thargor6.
the class SolidJulia3DRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCamRoll(0);
flame.setCamPitch(90.0 - Math.random() * 180.0);
flame.setCamYaw(30.0 - Math.random() * 60.0);
flame.setCamPerspective(Math.random() * 0.2);
flame.setWidth(601);
flame.setHeight(338);
flame.setPixelsPerUnit(92.48366013);
flame.setCamZoom(0.3 + Math.random() * 0.5);
randomizeSolidRenderingSettings(flame);
layer.getFinalXForms().clear();
layer.getXForms().clear();
// create transform 1
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.setColor(0.16556899);
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.5 + Math.random() * 2.0, getRandom3DShape());
}
// variation 2
if (Math.random() > 0.75) {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("pre_wave3D_wf", true);
varFunc.setParameter("wavelen", 0.75 + Math.random() * 0.5);
varFunc.setParameter("phase", 0.5 + Math.random());
varFunc.setParameter("damping", 0.01);
Variation variation = xForm.addVariation(0.2 + Math.random() * 0.2, varFunc);
variation.setPriority(0);
}
// 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(0.5);
xForm.setColor(0.02637356);
xForm.setColorSymmetry(0);
xForm.setMaterial(0);
xForm.setMaterialSpeed(0);
// a
xForm.setXYCoeff00(0.53041695);
// b
xForm.setXYCoeff10(-0.14810786);
// e
xForm.setXYCoeff20(2.09422612);
// c
xForm.setXYCoeff01(0.14810786);
// d
xForm.setXYCoeff11(0.53041695);
// f
xForm.setXYCoeff21(0.23893855);
xForm.setXYPostCoeff00(1);
xForm.setXYPostCoeff10(0);
xForm.setXYPostCoeff01(0);
xForm.setXYPostCoeff11(1);
xForm.setXYPostCoeff20(0);
xForm.setXYPostCoeff21(0);
xForm.setYZCoeff00(1);
xForm.setYZCoeff10(0);
xForm.setYZCoeff20(0.01405521);
xForm.setYZCoeff01(0);
xForm.setYZCoeff11(1);
xForm.setYZCoeff21(-0.01405521);
xForm.setYZPostCoeff00(1);
xForm.setYZPostCoeff10(0);
xForm.setYZPostCoeff01(0);
xForm.setYZPostCoeff11(1);
xForm.setYZPostCoeff20(0);
xForm.setYZPostCoeff21(0);
xForm.setZXCoeff00(0.74081053);
xForm.setZXCoeff10(-0.04366518);
xForm.setZXCoeff20(-0.07027604);
xForm.setZXCoeff01(0.04366518);
xForm.setZXCoeff11(0.74081053);
xForm.setZXCoeff21(-0.14055209);
xForm.setZXPostCoeff00(1);
xForm.setZXPostCoeff10(0);
xForm.setZXPostCoeff01(0);
xForm.setZXPostCoeff11(1);
xForm.setZXPostCoeff20(0);
xForm.setZXPostCoeff21(0);
// variation 1
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
// variation 2
xForm.addVariation(-0.524, VariationFuncList.getVariationFuncInstance("zscale", 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);
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("julia3Dq", true);
varFunc.setParameter("power", Tools.FTOI(3 + Math.random() * 4.0));
varFunc.setParameter("divisor", Math.random() > 0.5 ? 2 : 1.0 + Math.random() * 2.0);
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);
}
return flame;
}
use of org.jwildfire.create.tina.base.Layer in project JWildfire by thargor6.
the class SolidLabyrinthRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCamRoll(0);
flame.setCamPitch(30.0 + Math.random() * 40.0);
flame.setCamYaw(30.0 - Math.random() * 60.0);
flame.setCamPerspective(Math.random() * 0.2);
flame.setWidth(601);
flame.setHeight(338);
flame.setPixelsPerUnit(92.48366013);
flame.setCamZoom(0.75 + Math.random() * 0.5);
randomizeSolidRenderingSettings(flame);
layer.getFinalXForms().clear();
layer.getXForms().clear();
embedSubFlame(flame, createSubFlame());
return flame;
}
use of org.jwildfire.create.tina.base.Layer in project JWildfire by thargor6.
the class SolidLabyrinthRandomFlameGenerator method createSubFlame.
private Flame createSubFlame() {
Flame flame = new Flame();
flame.getLayers().clear();
flame.setCamRoll(0);
flame.setCamPitch(0);
flame.setCamYaw(0);
flame.setCamPerspective(0);
flame.setWidth(711);
flame.setHeight(400);
flame.setPixelsPerUnit(38.88427164);
flame.setCamZoom(1);
// create layer 1
{
Layer layer = new Layer();
flame.getLayers().add(layer);
layer.setWeight(1);
layer.setVisible(true);
// create a random gradient
new RandomGradientMutation().execute(layer);
// create transform 1
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
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);
if (Math.random() < 0.15) {
if (Math.random() < 0.85) {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("dc_crackle_wf", true);
varFunc.setParameter("cellsize", 0.15 + Math.random() * 0.5);
varFunc.setParameter("power", 0.2 + Math.random() * 1.2);
varFunc.setParameter("distort", Math.random() > 0.2 ? Math.random() * 0.5 : 0.0);
varFunc.setParameter("scale", Math.random() > 0.667 ? 1.06 - Math.random() * 0.12 : 1.0);
varFunc.setParameter("z", Math.random() * 0.5);
varFunc.setParameter("color_scale", 0.5);
varFunc.setParameter("color_offset", 0);
xForm.addVariation(1.0 + Math.random() * 2.0, varFunc);
} else {
{
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("truchet", true);
varFunc.setParameter("extended", Math.random() < 0.25 ? 1 : 0);
varFunc.setParameter("exponent", 0.2 + Math.random() * 1.3);
varFunc.setParameter("arc_width", 0.5 + Math.random() * 0.5);
varFunc.setParameter("rotation", 0);
varFunc.setParameter("size", 0.4 + Math.random() * 0.3);
varFunc.setParameter("seed", 50.0 + Math.random() * 50.0);
varFunc.setParameter("direct_color", 1);
xForm.addVariation(1, varFunc);
}
xForm.addVariation(2.0 + Math.random() * 2.0, VariationFuncList.getVariationFuncInstance("pre_blur", true));
}
} else {
VariationFunc varFunc = VariationFuncList.getVariationFuncInstance("dc_perlin", true);
varFunc.setParameter("shape", (int) (Math.random() * 3.0));
varFunc.setParameter("map", Math.random() < 0.15 ? (int) (Math.random() * 6.0) : 2);
varFunc.setParameter("select_centre", 0);
varFunc.setParameter("select_range", 1);
varFunc.setParameter("centre", 0.25 + Math.random() * 0.5);
varFunc.setParameter("range", 0.25 + Math.random() * 0.5);
varFunc.setParameter("edge", 0);
varFunc.setParameter("scale", 1.0 + Math.random() * 5.0);
varFunc.setParameter("octaves", Math.random() < 0.33 ? Tools.FTOI(2 + Math.random() * 2.0) : 2);
varFunc.setParameter("amps", Math.random() < 0.33 ? Tools.FTOI(2 + Math.random() * 2.0) : 2);
varFunc.setParameter("freqs", Math.random() < 0.33 ? Tools.FTOI(2 + Math.random() * 2.0) : 2);
varFunc.setParameter("z", 0);
varFunc.setParameter("select_bailout", 10);
xForm.addVariation(3.0 + Math.random() * 4.0, 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.base.Layer in project JWildfire by thargor6.
the class SolidLabyrinthRandomFlameGenerator method embedSubFlame.
public void embedSubFlame(Flame flame, Flame subFlame) {
Layer layer = flame.getFirstLayer();
layer.getFinalXForms().clear();
layer.getXForms().clear();
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
try {
SubFlameWFFunc var = new SubFlameWFFunc();
String flameXML = new FlameWriter().getFlameXML(subFlame);
var.setRessource("flame", flameXML.getBytes());
var.setParameter("color_mode", 0);
double cs = (1.5 - Math.random() * 3.0);
if (MathLib.fabs(cs) < 0.4) {
cs = (Math.random() < 0.5 ? -0.3 - Math.random() : 0.3 + Math.random());
}
var.setParameter("colorscale_z", cs);
xForm.addVariation(1, var);
} catch (Exception ex) {
ex.printStackTrace();
Unchecker.rethrow(ex);
}
xForm.setColor(0);
xForm.setColorSymmetry(-0.22);
}
}
use of org.jwildfire.create.tina.base.Layer in project JWildfire by thargor6.
the class SolidStunningRandomFlameGenerator method prepareFlame.
@Override
public Flame prepareFlame(RandomFlameGeneratorState pState) {
Flame flame = new Flame();
Layer layer = flame.getFirstLayer();
flame.setCamRoll(0);
flame.setCamPitch(90.0 - Math.random() * 180.0);
flame.setCamYaw(30.0 - Math.random() * 60.0);
flame.setCamPerspective(Math.random() * 0.2);
flame.setWidth(601);
flame.setHeight(338);
flame.setPixelsPerUnit(92.48366013);
flame.setCamZoom(0.3 + Math.random() * 0.5);
randomizeSolidRenderingSettings(flame);
layer.getFinalXForms().clear();
layer.getXForms().clear();
// create transform 1
{
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.setColor(Math.random());
xForm.setColorSymmetry(1.0 - 2 * Math.random());
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);
if (Math.random() > 0.125) {
xForm.setDrawMode(DrawMode.HIDDEN);
}
// variation 1
xForm.addVariation(0.2 + Math.random(), getRandom3DShape());
// set default edit plane
flame.setEditPlane(Math.random() > 0.666 ? EditPlane.XY : Math.random() < 0.5 ? EditPlane.YZ : EditPlane.ZX);
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);
if (Math.random() > 0.5) {
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(0.5);
xForm.setColor(0);
xForm.setColorSymmetry(0);
xForm.setMaterial(0);
xForm.setMaterialSpeed(0);
// a
xForm.setXYCoeff00(0.54625622);
// b
xForm.setXYCoeff10(0.26758811);
// e
xForm.setXYCoeff20(0);
// c
xForm.setXYCoeff01(-0.26758811);
// d
xForm.setXYCoeff11(0.54625622);
// f
xForm.setXYCoeff21(0);
xForm.setXYPostCoeff00(1);
xForm.setXYPostCoeff10(0);
xForm.setXYPostCoeff01(0);
xForm.setXYPostCoeff11(1);
xForm.setXYPostCoeff20(0);
xForm.setXYPostCoeff21(0);
xForm.setYZCoeff00(0.46864442);
xForm.setYZCoeff10(-0.17017929);
xForm.setYZCoeff20(1.21536218);
xForm.setYZCoeff01(0.17017929);
xForm.setYZCoeff11(0.46864442);
xForm.setYZCoeff21(-0.02558657);
xForm.setYZPostCoeff00(1);
xForm.setYZPostCoeff10(0);
xForm.setYZPostCoeff01(0);
xForm.setYZPostCoeff11(1);
xForm.setYZPostCoeff20(0);
xForm.setYZPostCoeff21(0);
xForm.setZXCoeff00(0.81078767);
xForm.setZXCoeff10(0.12035676);
xForm.setZXCoeff20(0.21748586);
xForm.setZXCoeff01(-0.12035676);
xForm.setZXCoeff11(0.81078767);
xForm.setZXCoeff21(-0.05117314);
xForm.setZXPostCoeff00(1);
xForm.setZXPostCoeff10(0);
xForm.setZXPostCoeff01(0);
xForm.setZXPostCoeff11(1);
xForm.setZXPostCoeff20(0);
xForm.setZXPostCoeff21(0);
// variation 1
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
// set default edit plane
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);
if (Math.random() > 0.666) {
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
if (Math.random() > 0.666) {
XForm xForm = new XForm();
layer.getXForms().add(xForm);
xForm.setWeight(0.5);
xForm.setColor(0);
xForm.setColorSymmetry(0);
xForm.setMaterial(0);
xForm.setMaterialSpeed(0);
// a
xForm.setXYCoeff00(0.54625622);
// b
xForm.setXYCoeff10(0.26758811);
// e
xForm.setXYCoeff20(0);
// c
xForm.setXYCoeff01(-0.26758811);
// d
xForm.setXYCoeff11(0.54625622);
// f
xForm.setXYCoeff21(0);
xForm.setXYPostCoeff00(1);
xForm.setXYPostCoeff10(0);
xForm.setXYPostCoeff01(0);
xForm.setXYPostCoeff11(1);
xForm.setXYPostCoeff20(0);
xForm.setXYPostCoeff21(0);
xForm.setYZCoeff00(0.46864442);
xForm.setYZCoeff10(-0.17017929);
xForm.setYZCoeff20(1.21536218);
xForm.setYZCoeff01(0.17017929);
xForm.setYZCoeff11(0.46864442);
xForm.setYZCoeff21(-0.02558657);
xForm.setYZPostCoeff00(1);
xForm.setYZPostCoeff10(0);
xForm.setYZPostCoeff01(0);
xForm.setYZPostCoeff11(1);
xForm.setYZPostCoeff20(0);
xForm.setYZPostCoeff21(0);
xForm.setZXCoeff00(0.59207155);
xForm.setZXCoeff10(-0.56684538);
xForm.setZXCoeff20(1.31770847);
xForm.setZXCoeff01(0.56684538);
xForm.setZXCoeff11(0.59207155);
xForm.setZXCoeff21(-0.84435688);
xForm.setZXPostCoeff00(1);
xForm.setZXPostCoeff10(0);
xForm.setZXPostCoeff01(0);
xForm.setZXPostCoeff11(1);
xForm.setZXPostCoeff20(0);
xForm.setZXPostCoeff21(0);
// variation 1
xForm.addVariation(1, VariationFuncList.getVariationFuncInstance("linear3D", true));
// set default edit plane
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);
if (Math.random() > 0.5) {
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
if (Math.random() > 0.42) {
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
xForm.addVariation(0.75 + Math.random() * 0.25, getRandomVariation());
// variation 2
if (Math.random() > 0.5) {
xForm.addVariation(0.25 + Math.random() * 0.25, VariationFuncList.getVariationFuncInstance("linear3D", true));
}
// set default edit plane
flame.setEditPlane(EditPlane.XY);
if (Math.random() > 0.5) {
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);
}
if (Math.random() > 0.5) {
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