Code: Select all

`TriangleIndexVertexArray trSh = new TriangleIndexVertexArray(mod.faces.size(), inBuf, 4 * 3, mod.vertices.size(), veBuf, 4 * 3);`

Code: Select all

`shape = new BvhTriangleMeshShape(trSh, true);`

inBuf and veBuf are both just ByteBuffers of all the vertex and index data. I don't think there's anything wrong there.

Code: Select all

```
// There are 3 floats needed for each vertex (x,y,z)
int vbufferSize = sh.size() * 3 * Float.SIZE;
FloatBuffer verticesBuffer = ByteBuffer.allocateDirect( vbufferSize ).order( ByteOrder.nativeOrder() ).asFloatBuffer();
// Copy the values from the list to the direct float buffer
for ( Vector3f v : sh )
verticesBuffer.put( v.x ).put( v.y ).put( v.z );
// There are 3 floats needed for each vertex (x,y,z)
int fbufferSize = sh.size() * 3 * Float.SIZE;
FloatBuffer facesBuffer = ByteBuffer.allocateDirect( fbufferSize ).order( ByteOrder.nativeOrder() ).asFloatBuffer();
// Copy the values from the list to the direct float buffer
for ( Face v : mod.getFaces() ){
int[] ind = v.getVertexIndices();
facesBuffer.put( ind[0] ).put( ind[1] ).put( ind[2] );
}
ByteBuffer veBuf = (ByteBuffer) ((sun.nio.ch.DirectBuffer)verticesBuffer).attachment();
ByteBuffer inBuf = (ByteBuffer) ((sun.nio.ch.DirectBuffer)facesBuffer).attachment();
```

Code: Select all

`//TriangleIndexVertexArray indexVertexArrays=new TriangleIndexVertexArray(Bunny.NUM_TRIANGLES,Bunny.getIndexBuffer(),4 * 3,Bunny.NUM_VERTICES,Bunny.getVertexBuffer(),4 * 3);`

Code: Select all

`mod.faces.size()`

Code: Select all

`mod.vertices.size()`

I cannot find any proper documentation, so I am hoping someone can help me: What am I parsing wrongly to the TriangleIndexVertexArray?

Thanks!