How to create a Convex mesh

Hello

I’m starting to create a convexMesh but to follow the user guide I find this:

PxToolkit :: MemoryOutputStream buf;
.....
PxToolkit :: MemoryInputData input (buf.getData () buf.getSize ());

The problem is that they are not defined in PxToolkit MemoryOutputStream nor MemoryInputData

thus giving me compile error.

¿Can someone explain from where and MemoryInputData MemoryOutputStream??

I’m looking for examples of codes PhysX but I find it very difficult to find something that can help me understand.

I hope your answer, greetings

You have to create a class that inherit from those PxInputStream and another that inherit from PxOutputStream and implement the required methods. You would then pass and object of your derived class to the cooking function to create the convex mesh. This information is contained in the PhysX Guide. Having an example does go a long way, but the snippet in the Guide was what I used to do my implementation.

Thanks for answering.

When will it mean that “this information is contained in the Guide” is what chapter? because in the chapter on Convex Meshes used directly “PxToolkit::MemoryOutputStream” and “PxToolkit::MemoryInputData”

And regarding the example you say there, Also comes in the guide or examples of code that brings the SDK?. Although the samples SDK brings insurance codijo example that comes to implement these derived classes with their names, but I’ve been watching and the many classes I have not managed to find it.

Please pray for me indicate something, greetings.

I guess the most important question to ask is, “Do you have have the PhysX SDK Guide and API documentation?” . The SDK comes with example code that illustrate most of the basic functionality required for simple simulations. The examples provided with the SDK should serve as a baseline for you implementation and I would not take them as absolute…they are just to provide a guide as how the user could achieve the said functionality. Given an example in the SDK User Guide, along with the API documentation that covers all the data types used by the SDK, it should just be a matter of plugging in your user defined types that inherits from the base PhysX types.

In your given example, PxCooking::cookConvexMesh( const PxConvexMeshDesc& desc, PxOutputStream& stream ) ( this was taken from the API documnetation ), accepts a PxOutputStream reference. Given the PxOutputStream is pure-virtual( again given by the documentation ), all the pure-virtual methods of PxOutputStream will have to be user-implemented. That is exactly what the PxToolKit::MemoryOutputStream and PxToolkit::MemoryInputData does. If getting the provided samples to work is your goal, then I would worry about the PxToolkit classes. Otherwise, write your own implementation of the required classes.

Hi, thanks again for answering.

I’ve seen what you say and I found looking in the API “PxToolkit::PxDefaultMemoryOutputStream” and " PxToolkit::PxDefaultMemoryInputData"

These classes are already implemented? I suspect so, but I’m not sure
Could you clearing that up?

Hello again.

I created a code using “PxToolkit::PxDefaultMemoryOutputStream and PxToolkit::PxDefaultMemoryInputData”
and see that it works perfectly. I’ve managed to create a convexMesh appending it with a mesh graph with Ogre3d graphics engine.

Thank you very much for the help.

Greetings.