MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / setMaterials

Method setMaterials

deps/physx/physx/source/physx/src/NpShape.cpp:399–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

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