当前位置: 首页>>代码示例>>C++>>正文


C++ PxBounds3类代码示例

本文整理汇总了C++中PxBounds3的典型用法代码示例。如果您正苦于以下问题:C++ PxBounds3类的具体用法?C++ PxBounds3怎么用?C++ PxBounds3使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PxBounds3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PxU32

void Sc::ParticleSystemSim::visualizeInteractions(Cm::RenderOutput& out)
{
	out << PxU32(PxDebugColor::eARGB_GREEN) << Cm::RenderOutput::LINES;
	for(PxU32 i=0; i < mParticlePacketShapes.size(); i++)
	{
		ParticlePacketShape* particleShape = mParticlePacketShapes[i];

		ParticleElementRbElementInteraction** interactions = particleShape->getInteractions();
		PxU32 nbInteractions = particleShape->getInteractionsCount();

		while(nbInteractions--)
		{
			ParticleElementRbElementInteraction* interaction = *interactions++;

			PX_ASSERT(interaction->getType() == InteractionType::ePARTICLE_BODY);

			const PxBounds3 bounds = particleShape->getBounds();

			PX_ALIGN(16, PxTransform absPos);
			interaction->getRbShape().getAbsPoseAligned(&absPos);

			out << bounds.getCenter() << absPos.p;
		}
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:25,代码来源:ScParticleSystemSim.cpp

示例2: 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);
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:29,代码来源:PxsFluidCollisionMesh.cpp

示例3:

Bounds3 Bounds3::ToManaged(PxBounds3 bounds)
{
	PxVec3 center = bounds.getCenter();
	PxVec3 extents = bounds.getExtents();

	return Bounds3(MathUtil::PxVec3ToVector3(center - extents), MathUtil::PxVec3ToVector3(center + extents));
}
开发者ID:stilldesign,项目名称:PhysX.Net,代码行数:7,代码来源:Bounds3.cpp

示例4: PX_ASSERT

void physx::Pt::collideCellsWithStaticMesh(ParticleCollData* collData, const LocalCellHash& localCellHash,
                                           const GeometryUnion& meshShape, const PxTransform& world2Shape,
                                           const PxTransform& shape2World, PxReal /*cellSize*/,
                                           PxReal /*collisionRange*/, PxReal proxRadius, const PxVec3& /*packetCorner*/)
{
	PX_ASSERT(collData);
	PX_ASSERT(localCellHash.isHashValid);
	PX_ASSERT(localCellHash.numParticles <= PT_SUBPACKET_PARTICLE_LIMIT_COLLISION);
	PX_ASSERT(localCellHash.numHashEntries <= PT_LOCAL_HASH_SIZE_MESH_COLLISION);

	const PxTriangleMeshGeometryLL& meshShapeData = meshShape.get<const PxTriangleMeshGeometryLL>();

	const TriangleMesh* meshData = meshShapeData.meshData;
	PX_ASSERT(meshData);

	// mesh bounds in world space (conservative)
	const PxBounds3 shapeBounds =
	    meshData->getLocalBoundsFast().transformSafe(world2Shape.getInverse() * meshShapeData.scale);

	const bool idtScaleMesh = meshShapeData.scale.isIdentity();

	Cm::FastVertex2ShapeScaling meshScaling;
	if(!idtScaleMesh)
		meshScaling.init(meshShapeData.scale);

	// process the particle cells
	for(PxU32 c = 0; c < localCellHash.numHashEntries; c++)
	{
		const ParticleCell& cell = localCellHash.hashEntries[c];

		if(cell.numParticles == PX_INVALID_U32)
			continue;

		PxBounds3 cellBounds;

		cellBounds.setEmpty();
		PxBounds3 cellBoundsNew(PxBounds3::empty());

		PxU32* it = localCellHash.particleIndices + cell.firstParticle;
		const PxU32* end = it + cell.numParticles;
		for(; it != end; it++)
		{
			const ParticleCollData& particle = collData[*it];
			cellBounds.include(particle.oldPos);
			cellBoundsNew.include(particle.newPos);
		}
		PX_ASSERT(!cellBoundsNew.isEmpty());
		cellBoundsNew.fattenFast(proxRadius);
		cellBounds.include(cellBoundsNew);

		if(!cellBounds.intersects(shapeBounds))
			continue; // early out if (inflated) cell doesn't intersect mesh bounds

		// opcode query: cell bounds against shape bounds in unscaled mesh space
		PxcContactCellMeshCallback callback(collData, &(localCellHash.particleIndices[cell.firstParticle]),
		                                    cell.numParticles, *meshData, meshScaling, proxRadius, NULL, shape2World);
		testBoundsMesh(*meshData, world2Shape, meshScaling, idtScaleMesh, cellBounds, callback);
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:59,代码来源:PtCollisionMesh.cpp

示例5: PX_ASSERT

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);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:10,代码来源:ScClothCore.cpp

示例6: CAST_U8

PxBounds3 RTree::refitAll(CallbackRefit& cb)
{
	PxU8* treeNodes8 = PX_IS_X64 ? CAST_U8(get64BitBasePage()) : CAST_U8((mFlags & IS_DYNAMIC) ? NULL : mPages);
	PxBounds3 meshBounds = refitRecursive(treeNodes8, 0, NULL, 0, cb);
	for (PxU32 j = 1; j<mNumRootPages; j++)
		meshBounds.include(   refitRecursive(treeNodes8, j, NULL, 0, cb)   );

#ifdef PX_CHECKED
	validate(&cb);
#endif
	return meshBounds;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:12,代码来源:GuRTree.cpp

示例7: NP_READ_CHECK

PxBounds3 NpCloth::getWorldBounds(float inflation) const
{
	NP_READ_CHECK(NpActor::getOwnerScene(*this));

	const PxBounds3 bounds = mCloth.getWorldBounds();
	PX_ASSERT(bounds.isValid());

	// PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents.
	const PxVec3 center = bounds.getCenter();
	const PxVec3 inflatedExtents = bounds.getExtents() * inflation;
	return PxBounds3::centerExtents(center, inflatedExtents);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:12,代码来源:NpCloth.cpp

示例8: overlap

void NpSpatialIndex::overlap(const PxBounds3& aabb, 
							 PxSpatialOverlapCallback& callback) const
{
	PX_SIMD_GUARD;
	PX_CHECK_AND_RETURN(aabb.isValid(),			"PxSpatialIndex::overlap: aabb is not valid.");

	flushUpdates();
	OverlapCallback cb(callback);
	PxBoxGeometry boxGeom(aabb.getExtents());
	PxTransform xf(aabb.getCenter());
	Sq::ShapeData shapeData(boxGeom, xf, 0.0f); // temporary rvalue not compatible with PX_NOCOPY 
	mPruner->overlap(shapeData, cb);
}
开发者ID:Eorgregix,项目名称:Destruction,代码行数:13,代码来源:NpSpatialIndex.cpp

示例9: NP_READ_CHECK

PxBounds3 NpArticulation::getWorldBounds(float inflation) const
{
	NP_READ_CHECK(getOwnerScene());
	PxBounds3 bounds = PxBounds3::empty();

	for(PxU32 i=0; i < mArticulationLinks.size(); i++)
	{
		bounds.include(mArticulationLinks[i]->getWorldBounds());
	}
	PX_ASSERT(bounds.isValid());

	// PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents.
	const PxVec3 center = bounds.getCenter();
	const PxVec3 inflatedExtents = bounds.getExtents() * inflation;
	return PxBounds3::centerExtents(center, inflatedExtents);
}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:16,代码来源:NpArticulation.cpp

示例10: ComputeGlobalBox

bool AABBTreeOfVerticesBuilder::ComputeGlobalBox(const PxU32* primitives, PxU32 nb_prims, PxBounds3& global_box) const
{
	// Checkings
	if(!primitives || !nb_prims)	return false;

	// Initialize global box
	global_box.setEmpty();

	// Loop through vertices
	for(PxU32 i=0;i<nb_prims;i++)
	{
		// Update global box
		global_box.include(mVertexArray[primitives[i]]);
	}
	return true;
}
开发者ID:rudysnow,项目名称:SimbiconPlatform,代码行数:16,代码来源:OPC_TreeBuilders.cpp

示例11: tessellateTriangle

static void tessellateTriangle(PxU32& nbNewTris, const PxTriangle& tr, PxU32 index, TriArray& worldTriangles, IntArray& triIndicesArray, const PxBounds3& cullingBox, const CCTParams& params, PxU16& nbTessellation)
{
	TessParams tp;
	tp.nbNewTris			= 0;
	tp.index				= index;
	tp.worldTriangles		= &worldTriangles;
	tp.triIndicesArray		= &triIndicesArray;
	tp.cullingBoxCenter		= cullingBox.getCenter();
	tp.cullingBoxExtents	= cullingBox.getExtents();
	tp.maxEdgeLength2		= params.mMaxEdgeLength2;
	tp.nbTessellation		= 0;
	tessellateTriangle(&tp, tr.verts[0], tr.verts[1], tr.verts[2]);

	nbNewTris += tp.nbNewTris;
	nbTessellation += tp.nbTessellation;
//	nbTessellation += PxU16(tp.nbNewTris);
}
开发者ID:Eorgregix,项目名称:Destruction,代码行数:17,代码来源:CctCharacterControllerCallbacks.cpp

示例12: refitRecursive

PxBounds3 RTree::refitRecursive(PxU8* treeNodes8, PxU32 top, RTreePage* parentPage, PxU32 parentSubIndex, CallbackRefit& cb)
{
	const PxReal eps = RTREE_INFLATION_EPSILON;
	RTreePage* tn = (RTreePage*)(treeNodes8 + top);
	PxBounds3 pageBound;
	for (PxU32 i = 0; i < RTREE_PAGE_SIZE; i++)
	{
		if (tn->isEmpty(i))
			continue;
		PxU32 ptr = tn->ptrs[i];
		Vec3V childMn, childMx;
		PxBounds3 childBound;
		if (ptr & 1)
		{
			// (ptr-1) clears the isLeaf bit (lowest bit)
			cb.recomputeBounds(ptr-1, childMn, childMx); // compute the bound around triangles
			V3StoreU(childMn, childBound.minimum);
			V3StoreU(childMx, childBound.maximum);
			// AP: doesn't seem worth vectorizing because of transposed layout
			tn->minx[i] = childBound.minimum.x - eps; // update page bounds for this leaf
			tn->miny[i] = childBound.minimum.y - eps;
			tn->minz[i] = childBound.minimum.z - eps;
			tn->maxx[i] = childBound.maximum.x + eps;
			tn->maxy[i] = childBound.maximum.y + eps;
			tn->maxz[i] = childBound.maximum.z + eps;
		} else
			childBound = refitRecursive(treeNodes8, ptr, tn, i, cb);
		if (i == 0)
			pageBound = childBound;
		else
			pageBound.include(childBound);
	}

	if (parentPage)
	{
		parentPage->minx[parentSubIndex] = pageBound.minimum.x - eps;
		parentPage->miny[parentSubIndex] = pageBound.minimum.y - eps;
		parentPage->minz[parentSubIndex] = pageBound.minimum.z - eps;
		parentPage->maxx[parentSubIndex] = pageBound.maximum.x + eps;
		parentPage->maxy[parentSubIndex] = pageBound.maximum.y + eps;
		parentPage->maxz[parentSubIndex] = pageBound.maximum.z + eps;
	}

	return pageBound;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:45,代码来源:GuRTree.cpp

示例13: update

void NpSpatialIndex::update(PxSpatialIndexItemId id,
							const PxBounds3& bounds)
{
	PX_SIMD_GUARD;
	PX_CHECK_AND_RETURN(bounds.isValid(),		"PxSpatialIndex::update: bounds are not valid.");

	mPruner->updateObjects(&id, &bounds);
	mPendingUpdates = true;
}
开发者ID:Eorgregix,项目名称:Destruction,代码行数:9,代码来源:NpSpatialIndex.cpp

示例14: sweep

void NpSpatialIndex::sweep(const PxBounds3& aabb, 
						   const PxVec3& unitDir, 
						   PxReal maxDist, 
						   PxSpatialLocationCallback& callback) const
{
	PX_SIMD_GUARD;

	PX_CHECK_AND_RETURN(aabb.isValid(),									"PxSpatialIndex::sweep: aabb is not valid.");
	PX_CHECK_AND_RETURN(unitDir.isFinite() && unitDir.isNormalized(),	"PxSpatialIndex::sweep: unitDir is not valid.");
	PX_CHECK_AND_RETURN(maxDist > 0.0f,									"PxSpatialIndex::sweep: distance must be positive");

	flushUpdates();
	LocationCallback cb(callback);
	PxBoxGeometry boxGeom(aabb.getExtents());
	PxTransform xf(aabb.getCenter());
	Sq::ShapeData shapeData(boxGeom, xf, 0.0f); // temporary rvalue not compatible with PX_NOCOPY 
	mPruner->sweep(shapeData, unitDir, maxDist, cb);
}
开发者ID:Eorgregix,项目名称:Destruction,代码行数:18,代码来源:NpSpatialIndex.cpp

示例15: computeMassAndDiagInertia

static bool computeMassAndDiagInertia(Ext::InertiaTensorComputer& inertiaComp, 
		PxVec3& diagTensor, PxQuat& orient, PxReal& massOut, PxVec3& coM, bool lockCOM, const PxRigidBody& body, const char* errorStr)
{
	// The inertia tensor and center of mass is relative to the actor at this point. Transform to the
	// body frame directly if CoM is specified, else use computed center of mass
	if (lockCOM)
	{
		inertiaComp.translate(-coM);  // base the tensor on user's desired center of mass.
	}
	else
	{
		//get center of mass - has to be done BEFORE centering.
		coM = inertiaComp.getCenterOfMass();

		//the computed result now needs to be centered around the computed center of mass:
		inertiaComp.center();
	}
	// The inertia matrix is now based on the body's center of mass desc.massLocalPose.p
	
	massOut = inertiaComp.getMass();
	diagTensor = PxDiagonalize(inertiaComp.getInertia(), orient);

	if ((diagTensor.x > 0.0f) && (diagTensor.y > 0.0f) && (diagTensor.z > 0.0f))
		return true;
	else
	{
		Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, 
								"%s: inertia tensor has negative components (ill-conditioned input expected). Approximation for inertia tensor will be used instead.", errorStr);

		// keep center of mass but use the AABB as a crude approximation for the inertia tensor
		PxBounds3 bounds = body.getWorldBounds();
		PxTransform pose = body.getGlobalPose();
		bounds = PxBounds3::transformFast(pose.getInverse(), bounds);
		Ext::InertiaTensorComputer it(false);
		it.setBox(bounds.getExtents());
		it.scaleDensity(massOut / it.getMass());
		PxMat33 inertia = it.getInertia();
		diagTensor = PxVec3(inertia.column0.x, inertia.column1.y, inertia.column2.z);
		orient = PxQuat(PxIdentity);

		return true;
	}
}
开发者ID:flair2005,项目名称:Spacetime-Optimization-of-Articulated-Character-Motion,代码行数:43,代码来源:ExtRigidBodyExt.cpp


注:本文中的PxBounds3类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。