void ModuleClothing::ClothingBackendFactory::releaseCookedInstances(NxParameterized::Interface* _cookedData, bool tetraMesh) { if (_cookedData != NULL) { PX_ASSERT(strcmp(_cookedData->className(), ClothingCookedParam::staticClassName()) == 0); ClothingCookedParam* cookedData = static_cast<ClothingCookedParam*>(_cookedData); #if NX_SDK_VERSION_MAJOR == 2 NxPhysicsSDK* pSDK = NiGetApexSDK()->getPhysXSDK(); #endif for (PxI32 i = 0; i < cookedData->convexMeshPointers.arraySizes[0]; i++) { #if NX_SDK_VERSION_MAJOR == 2 NxConvexMesh* convexMesh = reinterpret_cast<NxConvexMesh*>(cookedData->convexMeshPointers.buf[i]); if (convexMesh != NULL) { pSDK->releaseConvexMesh(*convexMesh); } #elif NX_SDK_VERSION_MAJOR == 3 PX_ALWAYS_ASSERT(); #endif cookedData->convexMeshPointers.buf[i] = NULL; } for (PxI32 i = 0; i < cookedData->cookedPhysicalSubmeshes.arraySizes[0]; i++) { if (tetraMesh) { #if NX_SDK_VERSION_MAJOR == 2 NxSoftBodyMesh* mesh = reinterpret_cast<NxSoftBodyMesh*>(cookedData->cookedPhysicalSubmeshes.buf[i].deformableMeshPointer); if (mesh != NULL) { pSDK->releaseSoftBodyMesh(*mesh); } #elif NX_SDK_VERSION_MAJOR == 3 PX_ALWAYS_ASSERT(); #endif } else { #if NX_SDK_VERSION_MAJOR == 2 NxClothMesh* mesh = reinterpret_cast<NxClothMesh*>(cookedData->cookedPhysicalSubmeshes.buf[i].deformableMeshPointer); if (mesh != NULL) { pSDK->releaseClothMesh(*mesh); } #elif NX_SDK_VERSION_MAJOR == 3 PX_ALWAYS_ASSERT(); #endif } cookedData->cookedPhysicalSubmeshes.buf[i].deformableMeshPointer = NULL; PX_ASSERT(cookedData->cookedPhysicalSubmeshes.buf[i].deformableMeshPointer == NULL); } } }
virtual ~CNxPhysConvexMesh() { m_pPhysicsSDK->releaseConvexMesh(*m_pNxConvexMesh); }