i'm trying create triangleindexvertexarray
jbullet, need parse bytebuffer
of vertices in model.
i have got arraylist<vector3f>
of vertices in model.
how can parse list of vector3f
's bytebuffer
?
you can follow
declaring vertices
arraylist<vector3f> verticesnew = new arraylist<vector3f>();
set vertices
vertices.add( new vector3f(somevertice) );
get float buffer vertices:
// there 3 floats needed each vertex (x,y,z) int buffersize = vertices.size() * 3 * float.size; floatbuffer verticesbuffer = bytebuffer.allocatedirect( buffersize ).order( byteorder.nativeorder() ).asfloatbuffer(); // copy values list direct float buffer ( vector3f v : vertices ) verticesbuffer.put( v.x ).put( v.y ).put( v.z );
Comments
Post a Comment