本文整理汇总了C++中PxBounds3::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ PxBounds3::isEmpty方法的具体用法?C++ PxBounds3::isEmpty怎么用?C++ PxBounds3::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxBounds3
的用法示例。
在下文中一共展示了PxBounds3::isEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testBoundsMesh
void testBoundsMesh(
const Gu::InternalTriangleMeshData& meshData,
const PxTransform& world2Shape,
const PxTransform& s2w,
const Cm::FastVertex2ShapeScaling& meshScaling,
bool idtScaleMesh,
const PxBounds3& worldBounds,
PxcContactCellMeshCallback& callback)
{
// Find colliding triangles.
// Setup an OBB for the fluid particle cell (in local space of shape)
// assuming uniform scaling in most cases, using the pose as box rotation
// if scaling is non-uniform, the bounding box is conservative
PxBounds3 boundsInMesh;
PX_ASSERT(!worldBounds.isEmpty());
boundsInMesh = PxBounds3::transformFast(world2Shape, worldBounds);
Gu::Box vertexSpaceOBB(boundsInMesh.getCenter(), boundsInMesh.getExtents(), PxMat33(PxIdentity));
if(!idtScaleMesh)
meshScaling.transformQueryBounds(vertexSpaceOBB.center, vertexSpaceOBB.extents);
// Set collider flags (has to be done each time again!)
Gu::RTreeMidphaseData hmd;
meshData.mCollisionModel.getRTreeMidphaseData(hmd);
MPT_SET_CONTEXT("flui", s2w, meshScaling); PX_UNUSED(s2w);
Gu::MeshRayCollider::collideOBB(vertexSpaceOBB, true, hmd, callback);
}
示例2:
PxBounds3 Sc::ClothCore::getWorldBounds() const
{
const PxVec3& center = reinterpret_cast<const PxVec3&>(mLowLevelCloth->getBoundingBoxCenter());
const PxVec3& extent = reinterpret_cast<const PxVec3&>(mLowLevelCloth->getBoundingBoxScale());
PxBounds3 localBounds = PxBounds3::centerExtents(center, extent);
PX_ASSERT(!localBounds.isEmpty());
return PxBounds3::transformFast(getGlobalPose(), localBounds);
}
示例3: hfUtil
void physx::Pt::collideWithStaticHeightField(ParticleCollData* particleCollData, PxU32 numCollData,
const GeometryUnion& heightFieldShape, PxReal proxRadius,
const PxTransform& shape2World)
{
PX_ASSERT(particleCollData);
const PxHeightFieldGeometryLL& hfGeom = heightFieldShape.get<const PxHeightFieldGeometryLL>();
const HeightFieldUtil hfUtil(hfGeom);
for(PxU32 p = 0; p < numCollData; p++)
{
ParticleCollData& collData = particleCollData[p];
PxBounds3 particleBounds = PxBounds3::boundsOfPoints(collData.localOldPos, collData.localNewPos);
PX_ASSERT(!particleBounds.isEmpty());
particleBounds.fattenFast(proxRadius);
HeightFieldAabbTest test(particleBounds, hfUtil);
HeightFieldAabbTest::Iterator itBegin = test.begin();
HeightFieldAabbTest::Iterator itEnd = test.end();
PxVec3 triangle[3];
collData.localDcNum = 0.0f;
collData.localSurfaceNormal = PxVec3(0);
collData.localSurfacePos = PxVec3(0);
bool hasCC = (collData.localFlags & ParticleCollisionFlags::CC) > 0;
PxVec3 tmpSurfaceNormal(0.0f);
PxVec3 tmpSurfacePos(0.0f);
PxVec3 tmpProxSurfaceNormal(0.0f);
PxVec3 tmpProxSurfacePos(0.0f);
PxReal tmpCCTime(collData.ccTime);
PxReal tmpDistOldToSurface(0.0f);
for(HeightFieldAabbTest::Iterator it = itBegin; it != itEnd; ++it)
{
it.getTriangleVertices(triangle);
const PxVec3& origin = triangle[0];
PxVec3 e0, e1;
e0 = triangle[1] - origin;
e1 = triangle[2] - origin;
PxU32 tmpFlags =
collideWithMeshTriangle(tmpSurfaceNormal, tmpSurfacePos, tmpProxSurfaceNormal, tmpProxSurfacePos,
tmpCCTime, tmpDistOldToSurface, collData.localOldPos, collData.localNewPos,
origin, e0, e1, hasCC, collData.restOffset, proxRadius);
updateCollShapeData(collData, hasCC, tmpFlags, tmpCCTime, tmpDistOldToSurface, tmpSurfaceNormal,
tmpSurfacePos, tmpProxSurfaceNormal, tmpProxSurfacePos, shape2World);
}
}
}
示例4: collideWithConvex
/**
input scaledPlaneBuf needs a capacity of the number of planes in convexShape
*/
void physx::collideWithConvex(PxPlane* scaledPlaneBuf, PxsParticleCollData* particleCollData, PxU32 numCollData,
const Gu::GeometryUnion& convexShape, const PxReal proxRadius)
{
PX_ASSERT(scaledPlaneBuf);
PX_ASSERT(particleCollData);
const PxConvexMeshGeometryLL& convexShapeData = convexShape.get<const PxConvexMeshGeometryLL>();
const Gu::ConvexHullData* convexHullData = convexShapeData.hullData;
PX_ASSERT(convexHullData);
// convex bounds in local space
PxMat33 scaling = convexShapeData.scale.toMat33(), invScaling;
invScaling = scaling.getInverse();
PX_ASSERT(!convexHullData->mAABB.isEmpty());
PxBounds3 shapeBounds = PxBounds3::transformFast(scaling, convexHullData->mAABB);
PX_ASSERT(!shapeBounds.isEmpty());
shapeBounds.fattenFast(proxRadius);
bool scaledPlanes = false;
#if PXS_FLUID_USE_SIMD_CONVEX_COLLISION
const Vec3V boundMin = V3LoadU(shapeBounds.minimum);
const Vec3V boundMax = V3LoadU(shapeBounds.maximum);
const Vec4V boundMinX = V4SplatElement<0>(Vec4V_From_Vec3V(boundMin));
const Vec4V boundMinY = V4SplatElement<1>(Vec4V_From_Vec3V(boundMin));
const Vec4V boundMinZ = V4SplatElement<2>(Vec4V_From_Vec3V(boundMin));
const Vec4V boundMaxX = V4SplatElement<0>(Vec4V_From_Vec3V(boundMax));
const Vec4V boundMaxY = V4SplatElement<1>(Vec4V_From_Vec3V(boundMax));
const Vec4V boundMaxZ = V4SplatElement<2>(Vec4V_From_Vec3V(boundMax));
PxsParticleCollDataV4 collDataV4;
const VecU32V u4Zero = VecU32VLoadXYZW(0,0,0,0);
const VecU32V u4One = VecU32VLoadXYZW(1,1,1,1);
PX_ALIGN(16, PxsParticleCollData fakeCsd);
fakeCsd.localOldPos = PxVec3(FLT_MAX, FLT_MAX, FLT_MAX);
fakeCsd.localNewPos = PxVec3(FLT_MAX, FLT_MAX, FLT_MAX);
PX_ALIGN(16, PxU32 overlapArray[128]);
PxU32 start = 0;
while(start < numCollData)
{
const PxU32 batchSize = PxMin(numCollData-start, (PxU32)128);
PxU32 v4Count = 0;
PxsParticleCollData* particleCollDataIt = &particleCollData[start];
for(PxU32 i=0; i<batchSize; i+=4)
{
PxsParticleCollData* collData[4];
collData[0] = particleCollDataIt++;
collData[1] = (i+1 < numCollData) ? particleCollDataIt++ : &fakeCsd;
collData[2] = (i+2 < numCollData) ? particleCollDataIt++ : &fakeCsd;
collData[3] = (i+3 < numCollData) ? particleCollDataIt++ : &fakeCsd;
Vec4V oldPosV0 = V4LoadU((PxF32*)&collData[0]->localOldPos);
Vec4V newPosV0 = V4LoadU((PxF32*)&collData[0]->localNewPos);
Vec4V oldPosV1 = V4LoadU((PxF32*)&collData[1]->localOldPos);
Vec4V newPosV1 = V4LoadU((PxF32*)&collData[1]->localNewPos);
Vec4V oldPosV2 = V4LoadU((PxF32*)&collData[2]->localOldPos);
Vec4V newPosV2 = V4LoadU((PxF32*)&collData[2]->localNewPos);
Vec4V oldPosV3 = V4LoadU((PxF32*)&collData[3]->localOldPos);
Vec4V newPosV3 = V4LoadU((PxF32*)&collData[3]->localNewPos);
Vec4V particleMin0 = V4Min(oldPosV0, newPosV0);
Vec4V particleMax0 = V4Max(oldPosV0, newPosV0);
Vec4V particleMin1 = V4Min(oldPosV1, newPosV1);
Vec4V particleMax1 = V4Max(oldPosV1, newPosV1);
Vec4V particleMin2 = V4Min(oldPosV2, newPosV2);
Vec4V particleMax2 = V4Max(oldPosV2, newPosV2);
Vec4V particleMin3 = V4Min(oldPosV3, newPosV3);
Vec4V particleMax3 = V4Max(oldPosV3, newPosV3);
Mat44V particleMin44(particleMin0, particleMin1, particleMin2, particleMin3);
const Mat44V particleMinTrans44 = M44Trnsps(particleMin44);
Mat44V particleMax44(particleMax0, particleMax1, particleMax2, particleMax3);
const Mat44V particleMaxTrans44 = M44Trnsps(particleMax44);
BoolV mask = V4IsGrtr(boundMaxX, particleMinTrans44.col0);
mask = BAnd(V4IsGrtr(boundMaxY, particleMinTrans44.col1), mask);
mask = BAnd(V4IsGrtr(boundMaxZ, particleMinTrans44.col2), mask);
mask = BAnd(V4IsGrtr(particleMaxTrans44.col0, boundMinX), mask);
mask = BAnd(V4IsGrtr(particleMaxTrans44.col1, boundMinY), mask);
mask = BAnd(V4IsGrtr(particleMaxTrans44.col2, boundMinZ), mask);
VecU32V overlap4 = V4U32Sel(mask, u4One, u4Zero);
V4U32StoreAligned(overlap4,(VecU32V*)&overlapArray[i]);
}
particleCollDataIt = &particleCollData[start];
for(PxU32 k=0; k<batchSize; k++, ++particleCollDataIt)
{
if (overlapArray[k])
{
if(!scaledPlanes)
{
scalePlanes(scaledPlaneBuf, convexHullData, invScaling);
scaledPlanes = true;
}
//.........这里部分代码省略.........