Ejemplo n.º 1
0
  public void setup() {

    mFont = createFont("ArialRoundedMTBold-36", 48);
    size(1440, 900, OPENGL);
    background(0);
    frameRate(120);
    //  model   = new OBJModel(this, "alyson_laugh.obj", "absolute", TRIANGLES);
    model = new OBJModel(this, "alyson_scared.obj", "absolute", TRIANGLES);
    //  model   = new OBJModel(this, "alyson_crying.obj", "absolute", TRIANGLES);

    smooth();
    colorMode(HSB);
    strokeWeight(4);

    model.scale(800);
    model.translateToCenter();

    detailValue = 3;
    scaleValue = 10;
    vertices = new ArrayList();
    ps = new ParticleSystem(this, scaleValue);

    PVector averagePosition = new PVector(0, 0, 0);

    for (int i = 0; i < model.getVertexCount(); i += detailValue) {
      PVector destinationPoint = model.getVertex(i);

      vertices.add(destinationPoint);

      averagePosition.add(destinationPoint);
    }

    averagePosition.div(vertices.size());

    for (int i = 0; i < vertices.size(); i++) {
      PVector destination = (PVector) vertices.get(i);
      Particle p = new Particle(this, averagePosition, destination);
      ps.addParticle(p);
    }
  }
Ejemplo n.º 2
0
 public AnimatedShape(PApplet pApplet, String s) {
   this.pApplet = pApplet;
   model = new OBJModel(pApplet, s, "relative", PConstants.POLYGON);
   model.scale(200);
   model.translateToCenter();
 }