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)); } } }
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; } } }