Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

How to save cooked geometry data in PhysX?

$
0
0
In PhysX 3.3.4, convexmesh\trianglemesh\heightfield should be cooked before use, and they could be cooked offline or at runtime. According to Geometry, we can cook a geometry in two manners: offline manner by streaming PxDefaultMemoryOutputStream writeBuffer; cooking.cookTriangleMesh(someDescription, writeBuffer); PxDefaultMemoryInputData readBuffer(writeBuffer.getData(), writeBuffer.getSize()); PxTriangleMesh* aTriangleMesh = physics.createTriangleMesh(readBuffer); or runtime manner by cook api PxTriangleMesh* aTriangleMesh = theCooking->createTriangleMesh(meshDesc, thePhysics->getPhysicsInsertionCallback()); I should use the offline manner to achieve the best performance. I read the source code of PhysX and found them identical, except for an extra stream in offline manner containing data generated at cook time. So to speed up performance, should I save the stream to disk and recovery the cooked data at runtime to make cook actually "offline"?However, Serialization says that So the stream generated in the offline cook manner should not be stored at disk. If that is the case, what does the redundancy stream for?If I use the PhysX binary serialization mechanism, how to make the cook procedure offline and achieve the best performance?

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>