MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / GenerateConvex

Function GenerateConvex

physx/samples/samplebase/PhysXSample.cpp:186–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186static PxConvexMesh* GenerateConvex(PxPhysics& sdk, PxCooking& cooking, PxU32 nbVerts, const PxVec3* verts, bool recenterVerts=false)
187{
188 PxVec3Alloc* tmp = NULL;
189 if(recenterVerts)
190 {
191 PxVec3 center(0);
192 for(PxU32 i=0;i<nbVerts;i++)
193 center += verts[i];
194 center /= PxReal(nbVerts);
195
196 tmp = SAMPLE_NEW(PxVec3Alloc)[nbVerts];
197 PxVec3* recentered = tmp;
198 for(PxU32 i=0;i<nbVerts;i++)
199 recentered[i] = verts[i] - center;
200 }
201
202 PxConvexMesh* convexMesh = PxToolkit::createConvexMesh(sdk, cooking, recenterVerts ? tmp : verts, nbVerts, PxConvexFlag::eCOMPUTE_CONVEX);
203
204 DELETEARRAY(tmp);
205
206 return convexMesh;
207}
208
209static PxConvexMesh* GenerateConvex(PxPhysics& sdk, PxCooking& cooking, float scale, bool large=false, bool randomize=true)
210{

Callers 1

createConvexMethod · 0.85

Calls 3

GenerateCirclePtsFunction · 0.85
createConvexMeshFunction · 0.50
randMethod · 0.45

Tested by

no test coverage detected