Beispiel #1
0
 protected Color newColor(Color aBaseColor) {
   Color res = aBaseColor;
   Integer rnd = NGRandomGenerator.GlobalRandomGenerator.getInteger(0, 2);
   if (rnd == 0) res = aBaseColor.darker();
   else if (rnd == 2) res = aBaseColor.brighter();
   return res;
 }
 public static Cylinder createCylinder(Color c) {
   Cylinder cylinder = new Cylinder(20, 180);
   final PhongMaterial phongMaterial = new PhongMaterial();
   phongMaterial.setDiffuseColor(c.darker());
   phongMaterial.setSpecularColor(c.brighter());
   cylinder.setMaterial(phongMaterial);
   return cylinder;
 }
 public static Sphere createSphere(Color c) {
   Sphere sphere = new Sphere(80);
   final PhongMaterial phongMaterial = new PhongMaterial();
   phongMaterial.setDiffuseColor(c.darker());
   phongMaterial.setSpecularColor(c.brighter());
   sphere.setMaterial(phongMaterial);
   return sphere;
 }
Beispiel #4
0
  public Leaf(Branch parentBranch) {
    super(0, parentBranch.length / 2., 2, parentBranch.length / 2.);
    setScaleX(0); // trick to hide leaves
    setScaleY(0);

    double rand = random() * 0.5 + 0.3;
    AUTUMN_COLOR = Color.color(random() * 0.1 + 0.8, rand, rand / 2);

    Color color = new Color(random() * 0.5, random() * 0.5 + 0.5, 0, 1);
    if (parentBranch.globalH < 400 && random() < 0.8) { // bottom leaf is darker
      color = color.darker();
    }
    setFill(color);
  }