Version 2.0 have a iterators for eaver one of teh newton objects.
The one for rigid body I beleive is lik this
- Code: Select all
NewtonBody* NewtonWorldGetFirstBody (const NewtonWorld* world);
NewtonBody* NewtonWorldGetNextBody (const NewtonWorld* world, const NewtonBody* curBody);
you can use after the Newton Update like this
- Code: Select all
for (BewtonBody* bodyPtr = NewtonWorldGetFirstBody (world); bodyPtr; bodyPtr = NewtonWorldGetNextBody (world, bodyPtr) {
// do what you want.
}
However ever you do not even need to do that at all.
Netwon only update the bodies that have change position since the last frame.
so if you write your callbacks right, then you do not even have to worrie about update matrixces at all.
if you matrix buffer is in Video Memory you could use a bouble buffer, for example
- Code: Select all
MatrixBuffe* ptr0;
MatrixBuffe* ptr1;
MatrixBuffe* currentBuffet;
MainLoop()
{
currentBuffer = SwapBuffet()
LockBuffer (currentBuffet)
NewtonUpdate ();
UnlocBuffer();
//do the render teh oteh Buffer (one frame behind)
}
Then you write the Matriccallback to place teh Matrix in teh CorrentBuffer, using an Index stored in teh body, or the vidual object;
I hope this is clear the clear?
done it right you can even have the Phisics running asyncronous in a separate thread that do not have anything to do with your Game loop.
Yes there will be a documentaion, but we are still woking on it.