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

Method resolveReferences

deps/physx/physx/source/physx/src/NpShape.cpp:141–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void NpShape::resolveReferences(PxDeserializationContext& context)
142{
143 // getMaterials() only works after material indices have been patched.
144 // in order to get to the new material indices, we need access to the new materials.
145 // this only leaves us with the option of acquiring the material through the context given an old material index (we do have the mapping)
146 {
147 PxU32 nbIndices = mShape.getScShape().getNbMaterialIndices();
148 const PxU16* indices = mShape.getScShape().getMaterialIndices();
149
150 for (PxU32 i=0; i < nbIndices; i++)
151 {
152 PxBase* base = context.resolveReference(PX_SERIAL_REF_KIND_MATERIAL_IDX, size_t(indices[i]));
153 PX_ASSERT(base && base->is<PxMaterial>());
154
155 NpMaterial& material = *static_cast<NpMaterial*>(base);
156 getScbShape().getScShape().resolveMaterialReference(i, material.getHandle());
157 }
158 }
159
160 context.translatePxBase(mActor);
161
162 getScbShape().getScShape().resolveReferences(context);
163
164
165 incMeshRefCount();
166
167 // Increment materials' refcounts in a second pass. Works better in case of failure above.
168 PxU32 nbMaterials = mShape.getNbMaterials();
169 for (PxU32 i=0; i < nbMaterials; i++)
170 {
171 NpMaterial* mat = static_cast<NpMaterial*>(mShape.getMaterial(i));
172 mat->incRefCount();
173 }
174}
175
176NpShape* NpShape::createObject(PxU8*& address, PxDeserializationContext& context)
177{

Callers 5

createObjectMethod · 0.45
createObjectMethod · 0.45
createObjectMethod · 0.45
createObjectMethod · 0.45
createObjectMethod · 0.45

Calls 9

getNbMaterialIndicesMethod · 0.80
resolveReferenceMethod · 0.80
translatePxBaseMethod · 0.80
getMaterialIndicesMethod · 0.45
getHandleMethod · 0.45
getNbMaterialsMethod · 0.45
getMaterialMethod · 0.45
incRefCountMethod · 0.45

Tested by

no test coverage detected