Destroy and release everything that has been allocated
| 132 | |
| 133 | // Destroy and release everything that has been allocated |
| 134 | void PhysicsCommon::release() { |
| 135 | |
| 136 | // Destroy the physics worlds |
| 137 | for (auto it = mPhysicsWorlds.begin(); it != mPhysicsWorlds.end(); ++it) { |
| 138 | deletePhysicsWorld(*it); |
| 139 | } |
| 140 | mPhysicsWorlds.clear(); |
| 141 | |
| 142 | // Destroy the sphere shapes |
| 143 | for (auto it = mSphereShapes.begin(); it != mSphereShapes.end(); ++it) { |
| 144 | deleteSphereShape(*it); |
| 145 | } |
| 146 | mSphereShapes.clear(); |
| 147 | |
| 148 | // Destroy the box shapes |
| 149 | for (auto it = mBoxShapes.begin(); it != mBoxShapes.end(); ++it) { |
| 150 | deleteBoxShape(*it); |
| 151 | } |
| 152 | mBoxShapes.clear(); |
| 153 | |
| 154 | // Destroy the capsule shapes |
| 155 | for (auto it = mCapsuleShapes.begin(); it != mCapsuleShapes.end(); ++it) { |
| 156 | deleteCapsuleShape(*it); |
| 157 | } |
| 158 | mCapsuleShapes.clear(); |
| 159 | |
| 160 | // Destroy the convex mesh shapes |
| 161 | for (auto it = mConvexMeshShapes.begin(); it != mConvexMeshShapes.end(); ++it) { |
| 162 | deleteConvexMeshShape(*it); |
| 163 | } |
| 164 | mConvexMeshShapes.clear(); |
| 165 | |
| 166 | // Destroy the heigh-field shapes |
| 167 | for (auto it = mHeightFieldShapes.begin(); it != mHeightFieldShapes.end(); ++it) { |
| 168 | deleteHeightFieldShape(*it); |
| 169 | } |
| 170 | mHeightFieldShapes.clear(); |
| 171 | |
| 172 | // Destroy the concave mesh shapes |
| 173 | for (auto it = mConcaveMeshShapes.begin(); it != mConcaveMeshShapes.end(); ++it) { |
| 174 | deleteConcaveMeshShape(*it); |
| 175 | } |
| 176 | mConcaveMeshShapes.clear(); |
| 177 | |
| 178 | // Destroy the convex mesh |
| 179 | for (auto it = mConvexMeshes.begin(); it != mConvexMeshes.end(); ++it) { |
| 180 | deleteConvexMesh(*it); |
| 181 | } |
| 182 | mConvexMeshes.clear(); |
| 183 | |
| 184 | // Destroy the triangle mesh |
| 185 | for (auto it = mTriangleMeshes.begin(); it != mTriangleMeshes.end(); ++it) { |
| 186 | deleteTriangleMesh(*it); |
| 187 | } |
| 188 | mTriangleMeshes.clear(); |
| 189 | |
| 190 | // Destroy the height-field mesh |
| 191 | for (auto it = mHeightFields.begin(); it != mHeightFields.end(); ++it) { |
no test coverage detected