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

Method cookConvexMesh

physx/source/physxcooking/src/Cooking.cpp:265–308  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////// cook convex mesh from given desc, save the results into stream

Source from the content-addressed store, hash-verified

263//////////////////////////////////////////////////////////////////////////
264// cook convex mesh from given desc, save the results into stream
265bool Cooking::cookConvexMesh(const PxConvexMeshDesc& desc_, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition) const
266{
267 PX_FPU_GUARD;
268 // choose cooking library if needed
269 ConvexHullLib* hullLib = NULL;
270 PxConvexMeshDesc desc = desc_;
271
272 if(desc_.flags & PxConvexFlag::eCOMPUTE_CONVEX)
273 {
274 const PxU16 gpuMaxVertsLimit = 64;
275
276 // GRB supports 64 verts max
277 if(desc_.flags & PxConvexFlag::eGPU_COMPATIBLE)
278 {
279 desc.vertexLimit = PxMin(desc.vertexLimit, gpuMaxVertsLimit);
280 }
281
282 hullLib = PX_NEW(QuickHullConvexHullLib) (desc, mParams);
283 }
284
285 ConvexMeshBuilder meshBuilder(mParams.buildGPUData);
286 if(!cookConvexMeshInternal(desc,meshBuilder,hullLib , condition))
287 {
288 if(hullLib)
289 PX_DELETE(hullLib);
290 return false;
291 }
292
293 // save the cooked results into stream
294 if(!meshBuilder.save(stream, platformMismatch()))
295 {
296 if (condition)
297 {
298 *condition = PxConvexMeshCookingResult::eFAILURE;
299 }
300 if(hullLib)
301 PX_DELETE(hullLib);
302 return false;
303 }
304
305 if(hullLib)
306 PX_DELETE(hullLib);
307 return true;
308}
309
310//////////////////////////////////////////////////////////////////////////
311// cook convex mesh from given desc, copy the results into internal convex mesh

Callers 8

createRandomConvexFunction · 0.80
createConvexMeshFunction · 0.80
createConvexMeshFunction · 0.80
createConvexMeshSafeMethod · 0.80
objectToFileImplMethod · 0.80
fileToObjectMethod · 0.80
createConvexMeshFunction · 0.80
createPxConvexMeshMethod · 0.80

Calls 2

PxMinFunction · 0.85
saveMethod · 0.45

Tested by

no test coverage detected