///////////////////////////////////////////////////////////////////// cook convex mesh from given desc, save the results into stream
| 263 | ////////////////////////////////////////////////////////////////////////// |
| 264 | // cook convex mesh from given desc, save the results into stream |
| 265 | bool 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 |
no test coverage detected