| 40 | |
| 41 | |
| 42 | MeshBuilder::MeshBuilder(SampleLargeWorld& sample, const char* filename) |
| 43 | : mSampleLargeWorld(&sample) |
| 44 | , mPhysics(sample.getPhysics()) |
| 45 | , mScene(sample.getActiveScene()) |
| 46 | , mCooking(sample.getCooking()) |
| 47 | , mMaterial(sample.getDefaultMaterial()) |
| 48 | , mStringTable(sample.mStringTable) |
| 49 | { |
| 50 | PxDefaultFileInputData inputStream(filename); |
| 51 | PxSerializationRegistry* sr = PxSerialization::createSerializationRegistry(mPhysics); |
| 52 | |
| 53 | PxCollection* c = PxSerialization::createCollectionFromXml(inputStream, mCooking, *sr, NULL, mStringTable); |
| 54 | PX_ASSERT( c ); |
| 55 | |
| 56 | c->add( mMaterial, MATERIAL_ID ); |
| 57 | PxSerialization::complete(*c, *sr); |
| 58 | |
| 59 | PxU32 count = c->getNbObjects(); |
| 60 | for(PxU32 i = 0; i < count; i++) |
| 61 | { |
| 62 | PxBase* object = &c->getObject(i); |
| 63 | switch ( object->getConcreteType() ) |
| 64 | { |
| 65 | case PxConcreteType::eCONVEX_MESH: |
| 66 | { |
| 67 | PxConvexMesh* j = static_cast<PxConvexMesh*>(object); |
| 68 | mConvexMeshes.push_back( j ); |
| 69 | break; |
| 70 | } |
| 71 | case PxConcreteType::eTRIANGLE_MESH_BVH33: |
| 72 | case PxConcreteType::eTRIANGLE_MESH_BVH34: |
| 73 | { |
| 74 | PxTriangleMesh* j = static_cast<PxTriangleMesh*>(object); |
| 75 | mTriMeshes.push_back(j); |
| 76 | break; |
| 77 | } |
| 78 | default: |
| 79 | break; |
| 80 | } |
| 81 | } |
| 82 | c->release(); |
| 83 | sr->release(); |
| 84 | } |
| 85 | |
| 86 | void MeshBuilder::addObjMeshToPxCollection( |
| 87 | PxPhysics& physics, |
nothing calls this directly
no test coverage detected