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

Method setGeometry

physx/source/physx/src/NpShape.cpp:246–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246void NpShape::setGeometry(const PxGeometry& g)
247{
248 NP_WRITE_CHECK(getOwnerScene());
249 PX_CHECK_AND_RETURN(isWritable(), "PxShape::setGeometry: shared shapes attached to actors are not writable.");
250 PX_SIMD_GUARD;
251
252 // PT: fixes US2117
253 if(g.getType() != getGeometryTypeFast())
254 {
255 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxShape::setGeometry(): Invalid geometry type. Changing the type of the shape is not supported.");
256 return;
257 }
258
259#if PX_CHECKED
260 bool isValid = false;
261 switch(g.getType())
262 {
263 case PxGeometryType::eSPHERE:
264 isValid = static_cast<const PxSphereGeometry&>(g).isValid();
265 break;
266
267 case PxGeometryType::ePLANE:
268 isValid = static_cast<const PxPlaneGeometry&>(g).isValid();
269 break;
270
271 case PxGeometryType::eCAPSULE:
272 isValid = static_cast<const PxCapsuleGeometry&>(g).isValid();
273 break;
274
275 case PxGeometryType::eBOX:
276 isValid = static_cast<const PxBoxGeometry&>(g).isValid();
277 break;
278
279 case PxGeometryType::eCONVEXMESH:
280 isValid = static_cast<const PxConvexMeshGeometry&>(g).isValid();
281 break;
282
283 case PxGeometryType::eTRIANGLEMESH:
284 isValid = static_cast<const PxTriangleMeshGeometry&>(g).isValid();
285 break;
286
287 case PxGeometryType::eHEIGHTFIELD:
288 isValid = static_cast<const PxHeightFieldGeometry&>(g).isValid();
289 break;
290
291 case PxGeometryType::eGEOMETRY_COUNT:
292 case PxGeometryType::eINVALID:
293 break;
294 }
295
296 if(!isValid)
297 {
298 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxShape::setGeometry(): Invalid geometry!");
299 return;
300 }
301#endif
302
303 decMeshRefCount();

Callers 6

PxScaleRigidActorFunction · 0.45
setPxShape_GeometryFunction · 0.45
setRadiusMethod · 0.45
setHeightMethod · 0.45
updateKinematicProxyMethod · 0.45

Calls 3

errorMethod · 0.80
getTypeMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected