Пример #1
0
  public void setup() {
    super.setup();

    //		_mesh = MeshUtil.meshFromOBJ( p, "../data/models/pointer_cursor_2_hollow.obj", 1.5f );
    //		_mesh = MeshUtil.getExtrudedMesh( MeshUtil.meshFromSVG( p, "../data/svg/diamond.svg", -1, 3,
    // 0.5f ), 20 );
    //		_mesh = MeshUtil.meshFromOBJ( p, "../data/models/cacheflowe-3d.obj", 120f );
    //		_mesh = MeshUtil.meshFromOBJ( p, "../data/models/mode-set.obj", 150f )
    //		_mesh = MeshUtil.meshFromOBJ( p, "../data/models/diamond.obj", 1f );
    //		_mesh = MeshUtil.meshFromImg( p, "../data/images/kacheout/ufo_1.gif", 14f );
    _mesh = new WETriangleMesh();
    _mesh.addMesh((new Sphere(200)).toMesh(25));
    _meshDeform = _mesh.copy();
  }
Пример #2
0
 protected void deformWithTrig() {
   int numVertices = _mesh.getNumVertices();
   for (int i = 0; i < numVertices; i++) {
     if (_mesh.getVertexForID(i) != null) {
       _meshDeform.getVertexForID(i).x =
           _mesh.getVertexForID(i).x + 10 * (0.7f + (float) Math.sin(p.frameCount * i / 1000f));
       _meshDeform.getVertexForID(i).y =
           _mesh.getVertexForID(i).y + 10 * (0.7f + (float) Math.cos(p.frameCount * i / 1000f));
       _meshDeform.getVertexForID(i).z =
           _mesh.getVertexForID(i).z + 10 * (0.7f + (float) Math.sin(p.frameCount * i / 1000f));
     }
   }
 }
Пример #3
0
  protected void deformWithAudio() {
    int numVertices = _mesh.getNumVertices();
    int eqStep = Math.round(512f / (float) numVertices);
    for (int i = 0; i < numVertices; i++) {
      float eq = 1 + p._audioInput.getFFT().spectrum[(i * eqStep) % 512];
      //			eq *= 2f;

      if (_mesh.getVertexForID(i) != null) {
        _meshDeform.getVertexForID(i).x = _mesh.getVertexForID(i).x * eq;
        _meshDeform.getVertexForID(i).y = _mesh.getVertexForID(i).y * eq;
        _meshDeform.getVertexForID(i).z = _mesh.getVertexForID(i).z * eq;
      }
    }
  }