Package org.jwildfire.create.tina.base

Examples of org.jwildfire.create.tina.base.XForm


        refreshXFormUI(getCurrXForm(XFormType.BOTH));
        refreshFlameImage(false);
      }
    }
    else {
      XForm xForm = getCurrXForm(XFormType.NORMAL);
      if (xForm != null) {
        saveUndoPoint();
        xForm.resetModColorEffects();
        refreshXFormUI(xForm);
        refreshFlameImage(false);
      }
    }
  }
View Full Code Here


            }
          }
        }

        if (crackle == null) {
          XForm xform = new XForm();
          xform.setWeight(0.5);
          layer.getXForms().add(xform);
          crackle = xform.addVariation(1.0, VariationFuncList.getVariationFuncInstance(CrackleFunc.VAR_NAME));
          crackle.getFunc().setParameter(CrackleFunc.PARAM_SCALE, 0.0);
        }

        crackle.setAmount(1.0 + Math.random() * 2.0);
        crackle.getFunc().setParameter(CrackleFunc.PARAM_DISTORT, 1.5 + Math.random() * 1.5);
 
View Full Code Here

    pSB.append("    layer.setVisible(" + pLayer.isVisible() + ");\n");
    pSB.append("    // create a random gradient\n");
    pSB.append("    new RandomGradientMutation().execute(layer);\n");

    for (int i = 0; i < pLayer.getXForms().size(); i++) {
      XForm xForm = pLayer.getXForms().get(i);
      addXForm(pSB, xForm, i, false);
    }
    for (int i = 0; i < pLayer.getFinalXForms().size(); i++) {
      XForm xForm = pLayer.getFinalXForms().get(i);
      addXForm(pSB, xForm, i, true);
    }
    //    sb.append("  // create the gradient\n");
    //    for (int i = 0; i < RGBPalette.PALETTE_SIZE; i++) {
    //      RGBColor color = layer.getPalette().getColor(i);
View Full Code Here

    boolean invert = Math.random() > 0.5;
    VariationFunc varFunc;

    // 1st xForm
    XForm xForm1;
    {
      XForm xForm = xForm1 = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(1.0 + 4.0 * Math.random());

      varFunc = VariationFuncList.getVariationFuncInstance("spherical3D_wf", true);
      if (invert) {
        varFunc.setParameter("invert", 1);
      }
      xForm.addVariation(1.0, varFunc);
      XFormTransformService.rotate(xForm, Math.random() < 0.5 ? 90.0 : -90.0, false);
      XFormTransformService.globalTranslate(xForm, 1.0, 0.0, false);

      xForm.setColor(1.0);
      xForm.setColorSymmetry(0.9 + Math.random() * 0.1);
    }
    // 2nd xForm
    XForm xForm2;
    {
      XForm xForm = xForm2 = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5 + Math.random() * 4.5);
      varFunc = VariationFuncList.getVariationFuncInstance("spherical3D_wf", true);
      if (invert) {
        varFunc.setParameter("invert", 1);
      }
      xForm.addVariation(1.0, varFunc);
      XFormTransformService.rotate(xForm, 90.0, false);
      xForm.setColor(0.5);
      xForm.setColorSymmetry(0.9 + Math.random() * 0.1);
    }

    String cylinderVar = Math.random() < 0.5 ? "cylinder" : "cylinder_apo";

    // 3rd xForm
    String fncList[] = { "bipolar", "blade", "blur", "blur3D", "cannabiscurve_wf", "crackle", "cylinder", "cylinder_apo", "edisc", "flower", "glynnSim2",
        "julia3D", "mandelbrot", "modulus", "noise", "parabola", "pie", "pie3D", "checks", "pre_subflame_wf", "radial_blur", "rays",
        "rings", "rose_wf", "secant2", "sinusoidal", "spiral", "spirograph", "splits", "square", "twintrian", "wedge_julia" };
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5);
      xForm.addVariation(0.25 + 0.25 * Math.random(), VariationFuncList.getVariationFuncInstance("pre_blur", true));
      xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance("ztranslate", true));
      String fnc = Math.random() < 0.66 ? cylinderVar : fncList[(int) (Math.random() * fncList.length)];
      xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance(fnc, true));
      XFormTransformService.scale(xForm, 5.0, false, true, true);
      xForm.setColor(1.0);
      xForm.setColorSymmetry(-1.0);
    }

    // 4th xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5);
      xForm.addVariation(0.025 + 0.025 * Math.random(), VariationFuncList.getVariationFuncInstance("pre_blur", true));
      xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance("ztranslate", true));
      String fnc = Math.random() < 0.33 ? cylinderVar : fncList[(int) (Math.random() * fncList.length)];
      xForm.addVariation(0.01 + Math.random() * 0.39, VariationFuncList.getVariationFuncInstance(fnc, true));
      XFormTransformService.scale(xForm, 3.0, false, true, true);
      xForm.setColor(1.0);
      xForm.setColorSymmetry(-1.0);
    }

    // 5th xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.1);
      xForm.addVariation(0.005 + Math.random() * 0.005, VariationFuncList.getVariationFuncInstance("gaussian_blur", true));
      xForm.addVariation(0.005 + Math.random() * 0.005, VariationFuncList.getVariationFuncInstance("ztranslate", true));
      XFormTransformService.globalTranslate(xForm, 0.3, 0.0, true);
      xForm.setColor(1.0);
      xForm.setColorSymmetry(-1.0);
    }
    // 6th (final) xForm
    if (Math.random() < 0.5) {
      XForm xForm = new XForm();
      layer.getFinalXForms().add(xForm);
      xForm.setWeight(0.1);
      int power;
      int style = (int) (3 * Math.random());
      switch (style) {
        case 0:
        case 1:
          varFunc = VariationFuncList.getVariationFuncInstance(style == 1 ? "julia3D" : "julia3Dz", true);
          power = -4 + (int) (Math.random() * 9.0);
          varFunc.setParameter("power", power != 0 ? power : 0);
          if (Math.random() > 0.5) {
            xForm.addVariation(0.005 + Math.random() * 0.5, VariationFuncList.getVariationFuncInstance("linear3D", true));
          }
          break;
        default:
          varFunc = VariationFuncList.getVariationFuncInstance("spherical3D_wf", true);
          if (Math.random() < 0.5) {
            varFunc.setParameter("invert", 1);
          }
      }
      xForm.addVariation(0.25 + Math.random() * 0.75, varFunc);

      XFormTransformService.rotate(xForm, 45.0, false);
      XFormTransformService.globalTranslate(xForm, 0.0, 0.25, false);
      XFormTransformService.globalTranslate(xForm, 0.0, -0.25, true);
      xForm.setColor(1.0);
      xForm.setColorSymmetry(0.5 + Math.random() * 0.5);

    }
    if (Math.random() > 0.5) {
      xForm1.getModifiedWeights()[3] = 0;
      xForm1.getModifiedWeights()[4] = 0;
View Full Code Here

    flame.setPreserveZ(true);

    VariationFunc varFunc;
    // 1st xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5);
      int varId = (int) (Math.random() * 6.0);
      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;
  }
View Full Code Here

      flame.setCamDOF(0.1 + Math.random() * 0.2);
    }

    Layer layer = flame.getFirstLayer();

    XForm xForm = new XForm();
    layer.getFinalXForms().add(xForm);
    xForm.addVariation(0.25 + Math.random() * 0.25, VariationFuncList.getVariationFuncInstance("linear3D", true));
    VariationFunc post_dcztransl = VariationFuncList.getVariationFuncInstance(PostDCZTranslFunc.VARNAME, true);
    xForm.addVariation(0.75 + Math.random() * 0.25, post_dcztransl);
    double factor = 0.5 + Math.random() * 2.0;
    if (Math.random() < 0.42) {
      factor = 0.0 - factor;
    }
    post_dcztransl.setParameter("factor", factor);
View Full Code Here

    String[] fnc = ExperimentalSimpleRandomFlameGenerator.FNCLST_EXPERIMENTAL;

    double scl = 1.0;
    for (int y = 0; y < maxXFormsY; y++) {
      for (int x = 0; x < maxXFormsX; x++) {
        XForm xForm = new XForm();
        xForm.setWeight(0.5 + Math.random() * 99.5);
        layer.getXForms().add(xForm);
        XFormTransformService.globalTranslate(xForm, xMin + x, yMin + y, false);
        if (Math.random() < 0.5) {
          XFormTransformService.rotate(xForm, 360.0 * Math.random(), true);
        }
        else {
          XFormTransformService.rotate(xForm, -360.0 * Math.random(), true);
        }
        XFormTransformService.localTranslate(xForm, -1.0 + 2.0 * Math.random(), -1.0 + 2.0 * Math.random(), true);
        scl *= 0.75 + Math.random() / 4;
        XFormTransformService.scale(xForm, scl, true, true, true);
        int fncIdx = (int) (Math.random() * fnc.length);
        xForm.addVariation(Math.random() * 0.9 + 0.1, VariationFuncList.getVariationFuncInstance(Math.random() > 0.25 ? fnc[fncIdx] : "linear3D", true));
        xForm.setColor(Math.random());
      }
    }
    return flame;
  }
View Full Code Here

    flame.setPixelsPerUnit(200);
    layer.getFinalXForms().clear();
    layer.getXForms().clear();
    // 1st xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(0.5 + Math.random());
      xForm.addVariation(1.5 + Math.random(), VariationFuncList.getVariationFuncInstance(Math.random() < 0.12 ? VariationFuncList.getRandomVariationname() : "spherical", true));
      xForm.setColorSymmetry(-0.5);

      XFormTransformService.localTranslate(xForm, 0.75 - 5.50 * Math.random(), 0.75 - 1.50 * Math.random(), false);
      XFormTransformService.rotate(xForm, -60.0 + Math.random() * 30.0, false);
      XFormTransformService.scale(xForm, 0.1 + Math.random() * 0.4, true, true, false);

    }
    // 2nd xForm
    {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(1.0 + Math.random() * 100.0);

      VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(Math.random() < 0.8 ? "juliascope" : "julian", true);
      varFunc.setParameter("power", Math.random() < 0.8 ? 2 : 2 + Math.random() * 10.0);
      varFunc.setParameter("dist", Math.random() < 0.8 ? 1.0 : -2.0 + 4.0 * Math.random());
      xForm.addVariation(0.5 + Math.random(), varFunc);
      xForm.setColorSymmetry(0.5);

      XFormTransformService.rotate(xForm, Math.random() * 360.0, false);
      XFormTransformService.localTranslate(xForm, 1.75 - 3.50 * Math.random(), 0.75 - 5.50 * Math.random(), false);
      XFormTransformService.scale(xForm, 1.1 + Math.random() * 2.0, true, true, false);
    }

    layer.getXForms().get(0).getModifiedWeights()[0] = 0.0;
    layer.getXForms().get(0).getModifiedWeights()[1] = 1.0;

    if (Math.random() > 0.667) {
      XForm xForm = new XForm();
      layer.getXForms().add(xForm);
      xForm.setWeight(1.0 + Math.random() * 100.0);
      VariationFunc varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
      xForm.addVariation(0.25 + 1.25 * Math.random(), varFunc);

      XFormTransformService.rotate(xForm, -12.0 + Math.random() * 24.0, true);
      XFormTransformService.localTranslate(xForm, -0.125 + Math.random() * 0.25, -0.125 + Math.random() * 0.25, true);
      XFormTransformService.scale(xForm, 0.9 + Math.random() * 0.2, true, true, true);

      layer.getXForms().get(0).getModifiedWeights()[1] = 0.0;
      layer.getXForms().get(1).getModifiedWeights()[2] = 0.0;
      layer.getXForms().get(2).getModifiedWeights()[2] = 0.0;

      if (Math.random() > 0.667) {
        xForm = new XForm();
        layer.getXForms().add(xForm);
        xForm.setWeight(0.50 + Math.random() * 50.0);
        varFunc = VariationFuncList.getVariationFuncInstance(VariationFuncList.getRandomVariationname(), true);
        xForm.addVariation(0.125 + 0.75 * Math.random(), varFunc);

        XFormTransformService.rotate(xForm, -24.0 + Math.random() * 48.0, true);
        XFormTransformService.localTranslate(xForm, -0.25 + Math.random() * 0.5, -0.25 + Math.random() * 0.5, true);
        XFormTransformService.scale(xForm, 0.5 + Math.random() * 0.25, true, true, true);

View Full Code Here

    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 + (int) (Math.random() * 10.0));
        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;
  }
View Full Code Here

    }

    protected void addSliceVariation(Flame pFlame, boolean pWithRandomFill) {
      InternalSliceRangeIndicatorWFFunc sliceVar = new InternalSliceRangeIndicatorWFFunc();
      if (pFlame.getFirstLayer().getFinalXForms().size() == 0) {
        XForm xform = new XForm();
        xform.addVariation(1.0, new Linear3DFunc());
        xform.addVariation(1.0, sliceVar);
        pFlame.getFirstLayer().getFinalXForms().add(xform);
      }
      else {
        pFlame.getFirstLayer().getFinalXForms().get(pFlame.getFirstLayer().getFinalXForms().size() - 1).addVariation(1.0, sliceVar);
      }
View Full Code Here

TOP

Related Classes of org.jwildfire.create.tina.base.XForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.