26 #pragma warning(disable: 4324) // Padding was added at the end of a structure because of a __declspec(align) value.
29 #define PXC_CONTACT_NO_FACE_INDEX 0xffffffff
39 eHAS_FACE_INDICES = 1,
41 eFORCE_NO_RESPONSE = 4,
42 eHAS_MODIFIED_MASS_RATIOS = 8,
43 eHAS_TARGET_VELOCITY = 16,
276 : zero(0.f), streamSize(size), nbContactsInPatch(0), currentContact(0)
282 bool faceIndices =
false;
283 bool response =
false;
286 PxU32 patchHeaderSize = 0;
307 contactsWereModifiable = (
PxU32)modify;
308 hasFaceIndices = (
PxU32)faceIndices;
309 forceNoResponse = (
PxU32)!response;
311 contactPatchHeaderSize = patchHeaderSize;
312 contactPointSize = pointSize;
325 return ((
PxU32)(patchEnd - reinterpret_cast<const PxU8*>(header))) < streamSize;
334 return header->totalContactCount;
342 const PxU8* start = patchEnd;
345 if(((
PxU32)(start - (reinterpret_cast<const PxU8*>(header)))) < streamSize)
347 const PxU32 numContactsInPatch = *(
reinterpret_cast<const PxU16*
>(patchStart));
348 nbContactsInPatch = numContactsInPatch;
350 patchEnd = start + contactPatchHeaderSize + numContactsInPatch * contactPointSize;
351 currPtr = start + contactPatchHeaderSize;
366 return currentContact < nbContactsInPatch;
374 PX_ASSERT(currentContact < nbContactsInPatch);
377 currPtr += contactPointSize;
386 return contactsWereModifiable ? getModifiableContact().normal : getContactPatch().normal;
395 return contactsWereModifiable ? getModifiableContactHeader().invMassScale0 : 1.f;
404 return contactsWereModifiable ? getModifiableContactHeader().invMassScale1 : 1.f;
413 return contactsWereModifiable ? getModifiableContactHeader().invInertiaScale0 : 1.f;
422 return contactsWereModifiable ? getModifiableContactHeader().invInertiaScale1 : 1.f;
431 return contactsWereModifiable ? getModifiableContact().maxImpulse :
PX_MAX_REAL;
440 return contactsWereModifiable ? getModifiableContact().targetVel : zero;
449 return contactStart->contact;
458 return contactStart->separation;
485 return contactsWereModifiable ? getModifiableContact().staticFriction : getContactPatch().staticFriction;
494 return contactsWereModifiable ? getModifiableContact().dynamicFriction : getContactPatch().dynamicFriction;
503 return contactsWereModifiable ? getModifiableContact().restitution : getContactPatch().restitution;
512 return contactsWereModifiable ? getModifiableContact().flags : getContactPatch().flags;
521 return contactsWereModifiable ? getModifiableContact().materialIndex0 : getContactPatch().materialIndex0;
530 return contactsWereModifiable ? getModifiableContact().materialIndex1 : getContactPatch().materialIndex1;
536 bool advanceToIndex(
const PxU32 initialIndex)
538 PX_ASSERT(currPtr == (reinterpret_cast<const PxU8*>(header + 1)));
540 PxU32 numToAdvance = initialIndex;
542 if(numToAdvance == 0)
551 while(hasNextPatch())
554 PxU32 patchSize = nbContactsInPatch;
555 if(numToAdvance <= patchSize)
557 while(hasNextContact())
560 if(numToAdvance == 0)
567 numToAdvance -= patchSize;