本文整理汇总了C++中PxGeometry::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ PxGeometry::getType方法的具体用法?C++ PxGeometry::getType怎么用?C++ PxGeometry::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxGeometry
的用法示例。
在下文中一共展示了PxGeometry::getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkOverlapOBB_sphereGeom
bool Gu::checkOverlapOBB_sphereGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Box& box)
{
PX_ASSERT(geom.getType() == PxGeometryType::eSPHERE);
const PxSphereGeometry& sphereGeom = static_cast<const PxSphereGeometry&>(geom);
return intersectSphereBox(Gu::Sphere(pose.p, sphereGeom.radius), box);
}
示例2: writeGeom
static void writeGeom(BatchQueryStream& stream, const PxGeometry& geom)
{
PxGeometryType::Enum geomType = geom.getType();
stream.write<PxU32>(PxU32(geomType));
switch (geomType)
{
case PxGeometryType::eCAPSULE:
stream.write<PxCapsuleGeometry>(static_cast<const PxCapsuleGeometry&>(geom));
break;
case PxGeometryType::eSPHERE:
stream.write<PxSphereGeometry>(static_cast<const PxSphereGeometry&>(geom));
break;
case PxGeometryType::eCONVEXMESH:
stream.write<PxConvexMeshGeometry>(static_cast<const PxConvexMeshGeometry&>(geom));
break;
case PxGeometryType::eBOX:
stream.write<PxBoxGeometry>(static_cast<const PxBoxGeometry&>(geom));
break;
case PxGeometryType::ePLANE:
case PxGeometryType::eTRIANGLEMESH:
case PxGeometryType::eHEIGHTFIELD:
case PxGeometryType::eGEOMETRY_COUNT:
case PxGeometryType::eINVALID:
PX_ALWAYS_ASSERT_MESSAGE("Unsupported geometry type in writeGeom");
}
}
示例3: MaterialIndicesStruct
// PT: TODO: optimize all these data copies
void Gu::GeometryUnion::set(const PxGeometry& g)
{
switch(g.getType())
{
case PxGeometryType::eBOX:
{
reinterpret_cast<PxBoxGeometry&>(mGeometry) = static_cast<const PxBoxGeometry&>(g);
}
break;
case PxGeometryType::eCAPSULE:
{
reinterpret_cast<PxCapsuleGeometry&>(mGeometry) = static_cast<const PxCapsuleGeometry&>(g);
}
break;
case PxGeometryType::eSPHERE:
{
reinterpret_cast<PxSphereGeometry&>(mGeometry) = static_cast<const PxSphereGeometry&>(g);
reinterpret_cast<PxCapsuleGeometry&>(mGeometry).halfHeight = 0.0f; //AM: make sphere geometry also castable as a zero height capsule.
}
break;
case PxGeometryType::ePLANE:
{
reinterpret_cast<PxPlaneGeometry&>(mGeometry) = static_cast<const PxPlaneGeometry&>(g);
}
break;
case PxGeometryType::eCONVEXMESH:
{
reinterpret_cast<PxConvexMeshGeometry&>(mGeometry) = static_cast<const PxConvexMeshGeometry&>(g);
reinterpret_cast<PxConvexMeshGeometryLL&>(mGeometry).hullData = &(::getConvexMesh(get<PxConvexMeshGeometryLL>().convexMesh).getHull());
reinterpret_cast<PxConvexMeshGeometryLL&>(mGeometry).gpuCompatible = ::getConvexMesh(get<PxConvexMeshGeometryLL>().convexMesh).isGpuCompatible();
}
break;
case PxGeometryType::eTRIANGLEMESH:
{
reinterpret_cast<PxTriangleMeshGeometry&>(mGeometry) = static_cast<const PxTriangleMeshGeometry&>(g);
reinterpret_cast<PxTriangleMeshGeometryLL&>(mGeometry).meshData = &(::getTriangleMesh(get<PxTriangleMeshGeometryLL>().triangleMesh));
reinterpret_cast<PxTriangleMeshGeometryLL&>(mGeometry).materialIndices = (::getTriangleMesh(get<PxTriangleMeshGeometryLL>().triangleMesh).getMaterials());
reinterpret_cast<PxTriangleMeshGeometryLL&>(mGeometry).materials = MaterialIndicesStruct();
}
break;
case PxGeometryType::eHEIGHTFIELD:
{
reinterpret_cast<PxHeightFieldGeometry&>(mGeometry) = static_cast<const PxHeightFieldGeometry&>(g);
reinterpret_cast<PxHeightFieldGeometryLL&>(mGeometry).heightFieldData = &::getHeightField(get<PxHeightFieldGeometryLL>().heightField).getData();
reinterpret_cast<PxHeightFieldGeometryLL&>(mGeometry).materials = MaterialIndicesStruct();
}
break;
case PxGeometryType::eGEOMETRY_COUNT:
case PxGeometryType::eINVALID:
PX_ALWAYS_ASSERT_MESSAGE("geometry type not handled");
break;
}
}
示例4: checkOverlapCapsule_sphereGeom
bool Gu::checkOverlapCapsule_sphereGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Capsule& worldCapsule)
{
PX_ASSERT(geom.getType() == PxGeometryType::eSPHERE);
const PxSphereGeometry& sphereGeom = static_cast<const PxSphereGeometry&>(geom);
return intersectSphereCapsule(Gu::Sphere(pose.p, sphereGeom.radius), worldCapsule);
}
示例5:
void RenderPhysX3Debug::addGeometry(const PxGeometry& geom, const PxTransform& tr, const RendererColor& color, PxU32 renderFlags)
{
switch(geom.getType())
{
case PxGeometryType::eBOX:
{
addBox(static_cast<const PxBoxGeometry&>(geom), tr, color, renderFlags);
}
break;
case PxGeometryType::eSPHERE:
{
addSphere(static_cast<const PxSphereGeometry&>(geom), tr, color, renderFlags);
}
break;
case PxGeometryType::eCAPSULE:
{
addCapsule(static_cast<const PxCapsuleGeometry&>(geom), tr, color, renderFlags);
}
break;
case PxGeometryType::eCONVEXMESH:
{
addConvex(static_cast<const PxConvexMeshGeometry&>(geom), tr, color, renderFlags);
}
break;
case PxGeometryType::ePLANE:
case PxGeometryType::eTRIANGLEMESH:
case PxGeometryType::eHEIGHTFIELD:
default:
{
PX_ASSERT(!"Not supported!");
break;
}
}
}
示例6: SweepCapsuleTriangles
bool Gu::GeometryQuery::sweep(const PxVec3& unitDir,
const PxReal distance,
const PxGeometry& geom,
const PxTransform& pose,
PxU32 triangleCount,
const Gu::Triangle* triangles,
PxSweepHit& sweepHit,
PxSceneQueryFlags hintFlags,
const PxU32* triangleFlags,
const Gu::Triangle* triangleEdgeNormals,
const PxU32* cachedIndex)
{
PX_CHECK_VALID(pose.p);
PX_CHECK_VALID(pose.q);
PX_CHECK_VALID(unitDir);
PX_CHECK_VALID(distance);
PX_CHECK_AND_RETURN_VAL(distance > 0, "PxGeometryQuery::sweep(): sweep distance must be greater than 0.", false);
switch (geom.getType())
{
case PxGeometryType::eSPHERE :
{
const PxSphereGeometry& sphereGeom = static_cast<const PxSphereGeometry&>(geom);
PxCapsuleGeometry capsuleGeom;
capsuleGeom.radius = sphereGeom.radius;
capsuleGeom.halfHeight = 0.0f;
return Gu::SweepCapsuleTriangles( triangleCount, triangles, triangleFlags, capsuleGeom, pose, unitDir, distance,
cachedIndex, sweepHit.impact, sweepHit.normal, sweepHit.distance, sweepHit.faceIndex);
}
break;
case PxGeometryType::eCAPSULE :
{
const PxCapsuleGeometry& capsGeom = static_cast<const PxCapsuleGeometry&>(geom);
return Gu::SweepCapsuleTriangles( triangleCount, triangles, triangleFlags, capsGeom, pose, unitDir, distance,
cachedIndex, sweepHit.impact, sweepHit.normal, sweepHit.distance, sweepHit.faceIndex);
}
break;
case PxGeometryType::eBOX :
{
const PxBoxGeometry& boxGeom = static_cast<const PxBoxGeometry&>(geom);
return Gu::SweepBoxTriangles( triangleCount, triangles, triangleEdgeNormals, triangleFlags, boxGeom, pose,
unitDir, distance, sweepHit.impact, sweepHit.normal, sweepHit.distance, sweepHit.faceIndex, cachedIndex);
}
break;
default :
PX_CHECK_AND_RETURN_VAL(false, "PxGeometryQuery::sweep(): geometry object parameter must be sphere, capsule or box geometry.", false);
break;
}
return false;
}
示例7: checkOverlapCapsule_planeGeom
bool Gu::checkOverlapCapsule_planeGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Capsule& worldCapsule)
{
PX_ASSERT(geom.getType() == PxGeometryType::ePLANE);
PX_UNUSED(geom);
// const PxPlaneGeometry& planeGeom = static_cast<const PxPlaneGeometry&>(geom);
const PxPlane plane = getPlane(pose);
return intersectPlaneCapsule(worldCapsule, plane);
}
示例8: checkOverlapOBB_boxGeom
bool Gu::checkOverlapOBB_boxGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Box& box)
{
PX_ASSERT(geom.getType() == PxGeometryType::eBOX);
const PxBoxGeometry& boxGeom = static_cast<const PxBoxGeometry&>(geom);
return Gu::intersectOBBOBB( boxGeom.halfExtents, pose.p, PxMat33(pose.q),
box.extents, box.center, box.rot,
true);
}
示例9: checkOverlapSphere_capsuleGeom
bool Gu::checkOverlapSphere_capsuleGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Sphere& sphere)
{
PX_ASSERT(geom.getType() == PxGeometryType::eCAPSULE);
const PxCapsuleGeometry& capsuleGeom = static_cast<const PxCapsuleGeometry&>(geom);
Gu::Capsule capsule;
getCapsule(capsule, capsuleGeom, pose);
return intersectSphereCapsule(sphere, capsule);
}
示例10: checkOverlapSphere_planeGeom
bool Gu::checkOverlapSphere_planeGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Sphere& sphere)
{
PX_ASSERT(geom.getType() == PxGeometryType::ePLANE);
PX_UNUSED(geom);
// const PxPlaneGeometry& planeGeom = static_cast<const PxPlaneGeometry&>(geom);
const PxPlane plane = getPlane(pose);
return plane.distance(sphere.center) - sphere.radius <= 0.0f;
}
示例11: checkOverlapSphere_boxGeom
bool Gu::checkOverlapSphere_boxGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Sphere& sphere)
{
PX_ASSERT(geom.getType() == PxGeometryType::eBOX);
const PxBoxGeometry& boxGeom = static_cast<const PxBoxGeometry&>(geom);
Gu::Box obb;
buildFrom(obb, pose.p, boxGeom.halfExtents, pose.q);
return intersectSphereBox(sphere, obb);
}
示例12: checkOverlapOBB_planeGeom
bool Gu::checkOverlapOBB_planeGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Box& box)
{
PX_ASSERT(geom.getType() == PxGeometryType::ePLANE);
PX_UNUSED(geom);
// const PxPlaneGeometry& planeGeom = static_cast<const PxPlaneGeometry&>(geom);
const PxPlane plane = getPlane(pose);
return intersectPlaneBox(plane, box);
}
示例13: checkOverlapCapsule_boxGeom
bool Gu::checkOverlapCapsule_boxGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Capsule& worldCapsule)
{
PX_ASSERT(geom.getType() == PxGeometryType::eBOX);
const PxBoxGeometry& boxGeom = static_cast<const PxBoxGeometry&>(geom);
Gu::Box box;
buildFrom(box, pose.p, boxGeom.halfExtents, pose.q);
return intersectBoxCapsule(box, worldCapsule);
}
示例14: checkOverlapOBB_capsuleGeom
bool Gu::checkOverlapOBB_capsuleGeom(const PxGeometry& geom, const PxTransform& pose, const Gu::Box& box)
{
PX_ASSERT(geom.getType() == PxGeometryType::eCAPSULE);
const PxCapsuleGeometry& capsuleGeom = static_cast<const PxCapsuleGeometry&>(geom);
Gu::Capsule capsule;
getCapsule(capsule, capsuleGeom, pose);
return intersectBoxCapsule(box, capsule);
}
示例15: setGeometry
void PhysXMeshCollider::setGeometry(const PxGeometry& geometry)
{
PxShape* shape = getInternal()->_getShape();
if (shape->getGeometryType() != geometry.getType())
{
PxShape* newShape = gPhysX().getPhysX()->createShape(geometry, *gPhysX().getDefaultMaterial(), true);
getInternal()->_setShape(newShape);
}
else
getInternal()->_getShape()->setGeometry(geometry);
}