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

Method setMaterials

physx/source/physx/src/NpShape.cpp:396–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394///////////////////////////////////////////////////////////////////////////////
395
396void NpShape::setMaterials(PxMaterial*const* materials, PxU16 materialCount)
397{
398 NP_WRITE_CHECK(getOwnerScene());
399 PX_CHECK_AND_RETURN(isWritable(), "PxShape::setMaterials: shared shapes attached to actors are not writable.");
400
401#if PX_CHECKED
402 if (!NpShape::checkMaterialSetup(mShape.getGeometry(), "PxShape::setMaterials()", materials, materialCount))
403 return;
404#endif
405
406 PxU32 oldMaterialCount = mShape.getNbMaterials();
407 PX_ALLOCA(oldMaterials, PxMaterial*, oldMaterialCount);
408 PxU32 tmp = mShape.getMaterials(oldMaterials, oldMaterialCount);
409 PX_ASSERT(tmp == oldMaterialCount);
410 PX_UNUSED(tmp);
411
412 if (mShape.setMaterials(materials, materialCount))
413 {
414 for(PxU32 i=0; i < materialCount; i++)
415 static_cast<NpMaterial*>(materials[i])->incRefCount();
416
417 for(PxU32 i=0; i < oldMaterialCount; i++)
418 static_cast<NpMaterial*>(oldMaterials[i])->decRefCount();
419 }
420}
421
422PxU16 NpShape::getNbMaterials() const
423{

Callers 5

createGeometricTowerMethod · 0.45
createTwistTowerMethod · 0.45
createLegMethod · 0.45

Calls 6

PX_UNUSEDFunction · 0.85
getGeometryMethod · 0.45
getNbMaterialsMethod · 0.45
getMaterialsMethod · 0.45
incRefCountMethod · 0.45
decRefCountMethod · 0.45

Tested by

no test coverage detected