Exemple #1
0
 /** Draw the shape into an arbitrary PGraphics. */
 void draw(PGraphics pg) {
   if (iFrame.isEyeFrame()) return;
   if (shift != null)
     if (pg.is3D()) pg.translate(shift.x(), shift.y(), shift.z());
     else pg.translate(shift.x(), shift.y());
   // The shape part took verbatim from Processing, see:
   // https://github.com/processing/processing/blob/master/core/src/processing/core/PGraphics.java
   if (shp != null) {
     // don't do expensive matrix ops if invisible
     if (shp.isVisible() && !iFrame.isEyeFrame()) {
       pg.flush();
       if (pg.shapeMode == PApplet.CENTER) {
         pg.pushMatrix();
         pg.translate(-shp.getWidth() / 2, -shp.getHeight() / 2);
       }
       shp.draw(pg); // needs to handle recorder too
       if (pg.shapeMode == PApplet.CENTER) {
         pg.popMatrix();
       }
     }
   } else if (mth != null && obj != null) {
     try {
       mth.invoke(obj, new Object[] {pg});
     } catch (Exception e1) {
       try {
         mth.invoke(obj, new Object[] {iFrame, pg});
       } catch (Exception e2) {
         PApplet.println("Something went wrong when invoking your " + mth.getName() + " method");
       }
     }
   }
 }
Exemple #2
0
    // --------------------------------------------------------
    public PShape form() {

      PShape f;

      f = createShape();
      f.beginShape();
      f.noFill();
      f.stroke(0, 255, 0);
      f.strokeWeight(5);
      f.strokeJoin(ROUND);
      f.curveVertex(position.get(0).x, position.get(0).y);

      for (PVector p : position) f.curveVertex(p.x, p.y);

      f.curveVertex(position.get(position.size() - 1).x, position.get(position.size() - 1).y);
      f.endShape();

      return f;
    }
  public void render() {
    // FlŠche

    p5.pushMatrix();
    p5.translate(x, y);

    if (mouseOver() && p5.setZTimeAxis) {
      mover.fill(p5.cBorderHover);
    } else {
      mover.fill(p5.cTagDark);
    }
    p5.shape(mover);

    // Icon
    p5.imageMode(PConstants.CORNER);
    p5.image(p5.cameraImg, h, 0, h, h);

    p5.popMatrix();
  }
  public CamMover(TagExplorerProcessing2 p5, int x, int y, int chooserH) {
    super(x, y);

    this.p5 = p5;

    h = 36;
    w = h * 2;

    this.x = x;
    this.y =
        y
            - h; // startY    	// + p5.timeline.mapExpCam(p5.cam_eyetargetpos.z - (p5.height / 2.0f)
                 // / p5.tan(PConstants.PI * 30.0f / 180.0f), h) - hFeld;

    minY = this.y - chooserH;
    maxY = this.y;

    // MinTime Feld
    mover = p5.createShape();
    mover.fill(p5.cTagDark);
    mover.noStroke();

    mover.vertex(0 + h, 0);
    mover.vertex(0 + w, 0);
    mover.vertex(0 + w, h);
    mover.vertex(0, h);

    mover.end();
  }
Exemple #5
0
    // -------------------------------------------
    public PShape createForm() {

      PShape s = createShape();

      s.beginShape();
      s.noStroke();
      s.fill(0xffFF5757);

      for (PVector p : pointForm) s.curveVertex(p.x, p.y);

      // TO CLOSE THE FORM
      s.curveVertex(pointForm.get(0).x, pointForm.get(0).y);
      s.curveVertex(pointForm.get(1).x, pointForm.get(1).y);
      s.curveVertex(pointForm.get(2).x, pointForm.get(2).y);

      s.endShape();

      return s;
    }
Exemple #6
0
    // -----------------------------------------------
    public PShape complexLeaf() {

      PShape s = createShape();

      s.beginShape();
      s.fill(0xffFF5757);
      s.noStroke();
      s.scale(ratio);

      s.rotate(angle);

      // First point
      s.curveVertex(skeleton.position.get(0).x, skeleton.position.get(0).y);
      s.curveVertex(skeleton.position.get(0).x, skeleton.position.get(0).y);

      // Middle points
      for (int i = 1; i < skeleton.position.size() - 1; i++) {

        float x = skeleton.position.get(i).x;
        float y = skeleton.position.get(i).y;

        float a = skeleton.angle.get(i);
        ;
        x += cos(a - angleVeins) * sizeVeins;
        y += sin(a - angleVeins) * sizeVeins;

        s.curveVertex(x, y);

        Veins v = new Veins(skeleton.position.get(i), new PVector(x, y));
        veins.add(v);
      }

      // Peak point
      s.curveVertex(
          skeleton.position.get(skeleton.position.size() - 1).x,
          skeleton.position.get(skeleton.position.size() - 1).y);

      // Return Middle points
      for (int i = skeleton.position.size() - 2; i >= 1; i--) {

        float x = skeleton.position.get(i).x;
        float y = skeleton.position.get(i).y;

        float a = skeleton.angle.get(i);
        x += cos(a - PI + angleVeins) * sizeVeins;
        y += sin(a - PI + angleVeins) * sizeVeins;

        s.curveVertex(x, y);

        Veins v = new Veins(skeleton.position.get(i), new PVector(x, y));
        veins.add(v);
      }

      // Last point
      s.curveVertex(skeleton.position.get(0).x, skeleton.position.get(0).y);
      s.curveVertex(skeleton.position.get(0).x, skeleton.position.get(0).y);

      s.endShape();

      return s;
    }
Exemple #7
0
    // -----------------------------------------------
    public PShape stem() {

      PShape s = createShape();

      s.beginShape();
      s.noFill();
      s.stroke(255);
      s.strokeWeight(1);
      s.scale(ratio);

      s.rotate(angle);

      // First point
      s.curveVertex(skeleton.position.get(0).x, skeleton.position.get(0).y);

      // Middle points
      for (PVector p : skeleton.position) s.curveVertex(p.x, p.y);

      // Last point
      s.curveVertex(
          skeleton.position.get(skeleton.position.size() - 1).x,
          skeleton.position.get(skeleton.position.size() - 1).y);

      s.endShape();
      return s;
    }
Exemple #8
0
    // -----------------------------------------------
    public PShape simpleLeaf(float ratio) {

      PShape s = createShape();

      s = createShape();
      s.beginShape();
      s.fill(c);
      s.noStroke();

      s.rotate(angle);
      s.curveVertex(0, 0);
      s.curveVertex(0, 0);
      s.curveVertex(30, -50);
      s.curveVertex(0, -100);
      s.curveVertex(-30, -50);
      s.curveVertex(0, 0);
      s.curveVertex(0, 0);
      s.scale(ratio);

      s.endShape();

      return s;
    }
Exemple #9
0
    // -----------------------------------------------
    public PShape leafveins() {

      PShape master = createShape(GROUP);

      for (Veins v : veins) {

        PShape s = createShape();
        s.beginShape();
        s.noFill();
        s.stroke(255);
        s.strokeWeight(1);
        s.scale(ratio);

        s.rotate(angle);
        s.vertex(v.begin.x, v.begin.y);
        s.vertex(v.begin.x, v.begin.y);
        s.vertex(v.end.x, v.end.y);
        s.vertex(v.end.x, v.end.y);
        s.endShape();

        master.addChild(s);
      }

      return master;
    }