/** * returns the Index Buffer for the Collision World * * @return */ public ByteBuffer getIndexBuffer(MTTriangleMesh mesh) { short[] indices = mesh.getGeometryInfo().getIndices(); ByteBuffer buf = ByteBuffer.allocateDirect(indices.length * 4).order(ByteOrder.nativeOrder()); for (int i = 0; i < indices.length; i++) { buf.putInt(indices[i]); } buf.flip(); return buf; }
/** * returns the Vertex Buffer for the Collision World * * @return Vertex Buffer */ public ByteBuffer getVertexBuffer(MTTriangleMesh mesh) { Vertex[] vertices = mesh.getGeometryInfo().getVertices(); ByteBuffer buf = ByteBuffer.allocateDirect(vertices.length * 4 * 3).order(ByteOrder.nativeOrder()); for (int i = 0; i < vertices.length; i++) { // vertices[i].scaleLocal(scale); buf.putFloat(vertices[i].x); buf.putFloat(vertices[i].y); buf.putFloat(vertices[i].z); } buf.flip(); return buf; }