Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Categories
- All Discussions1,524
- General534
- Graphics109
- GPU Computing419
- Mobile141
- Pro Graphics163
- Tools158
In this Discussion
- Hai Loc Lu February 10
Tags in this Discussion
- physx 272
- 3dsmax 19
- physx-plugin 15
PxCollection or RepXCollection for RepX file
-
Hi!
I would like to load a .repx file and create actors from it. Can I use a PxCollection to deserialize the data in .repX? If not how use RepXCollection and instanciateCollection()? Unfortunately I didn't find many documentations on how loading a .repx and any examples on RepXCollection.
Thanks. -
1 Comment sorted by
-
#include "RepXUtility.h"
// Do your pre-processing here before adding RepX actors to your scene
struct MyOwnRepXCoreItemAdder
{
PxScene* mScene;
MyOwnRepXCoreItemAdder( PxScene* inScene) : mScene( inScene ) {}
void operator()( const void* inId, PxConvexMesh* ) {}
void operator()( const void* inId, PxTriangleMesh* ) {}
void operator()( const void* inId, PxHeightField* ) {}
void operator()( const void* inId, PxClothFabric* ) {}
void operator()( const void* inId, PxMaterial* inData ) {}
void operator()( const void* inId, PxRigidStatic* ) {}
void operator()( const void* inId, PxRigidDynamic* inActor )
{
mScene->addActor( *inActor );
}
void operator()( const void* inId, PxArticulation* inArticulation ) { mScene->addArticulation( *inArticulation ); }
void operator()( const void* inId, PxCloth* inData ) { mScene->addActor( *inData ); }
void operator()( const void* inId, PxParticleSystem* inActor ) { mScene->addActor( *inActor ); }
void operator()( const void* inId, PxParticleFluid* inActor ) { mScene->addActor( *inActor ); }
void operator()( const void* inId, PxJoint* inJoint ) {}
void operator()( const void* inId, PxAggregate* inData ) { mScene->addAggregate( *inData ); }
};
PxStringTable* stringTable = &PxStringTableExt::createStringTable( getFoundation().getAllocator() );
PxToolkit::FileInputData data(getFilename("YourRepXFile.repx"));
RepXCollection* collection = createCollection(data, getFoundation().getAllocator());
//addObjectsToScene(collection, &getFramework().getPhysics(), &getFramework().getCooking(), &getFramework().getActiveScene(), stringTable);
repx::RepXIdToRepXObjectMap* theIdMap( PxToolkit::createIdMap() );
physx::repx::instantiateCollection( collection, theIdMap, &getPhysics(), &getCooking(), stringTable, true, MyOwnRepXCoreItemAdder(&getActiveScene()) );
theIdMap->destroy();
collection->destroy();
stringTable->release();