MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / MeshBuilder

Method MeshBuilder

deps/physx/physx/samples/samplelargeworld/MeshBuilder.cpp:42–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41
42MeshBuilder::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
86void MeshBuilder::addObjMeshToPxCollection(
87 PxPhysics& physics,

Callers

nothing calls this directly

Calls 6

getObjectMethod · 0.80
addMethod · 0.45
getNbObjectsMethod · 0.45
getConcreteTypeMethod · 0.45
push_backMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected