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;
		}
	}
}
Exemplo n.º 2
0
void Sc::ParticleSystemSim::visualizeBroadPhaseBounds(Cm::RenderOutput& out)
{
	for (PxU32 i = 0; i < mParticlePacketShapes.size(); i++)
	{
		ParticlePacketShape* particleShape = mParticlePacketShapes[i];
		PxBounds3 bounds = particleShape->getBounds();
		out << PxU32(PxDebugColor::eARGB_BLUE) << Cm::DebugBox(bounds);
	}
}
Exemplo n.º 3
0
void Sc::ParticleSystemSim::onRbShapeChange(const ParticlePacketShape& particleShape, const ShapeSim& shape)
{
	PX_ASSERT(mLLSim);
//	const PxsShapeCore& shapeCore = shape.getCore().getCore();
	const PxsBodyCore* bodyCore = shape.getBodySim() ? &shape.getBodySim()->getBodyCore().getCore() : NULL;
	
	mLLSim->onRbShapeChangeV(*particleShape.getLowLevelParticleShape(), (PxvShapeHandle)&shape.getCore().getCore(), (PxvBodyHandle)bodyCore);
}
Exemplo n.º 4
0
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];

		Cm::Range<ParticleElementRbElementInteraction*const> interactions = particleShape->getPacketShapeInteractions();
		for (; !interactions.empty(); interactions.popFront())
		{
			ParticleElementRbElementInteraction*const interaction = interactions.front();

			PX_ASSERT(interaction->getType() == PX_INTERACTION_TYPE_PARTICLE_BODY);

			PxBounds3 bounds = particleShape->getBounds();
			out << bounds.getCenter() << interaction->getRbShape().getAbsPose().p;
		}
	}
}
Exemplo n.º 5
0
void Sc::ParticleSystemSim::visualizeSpatialGrid(Cm::RenderOutput& out)
{
	PxReal packetSize = getCore().getGridSize();

	for (PxU32 i = 0; i < mParticlePacketShapes.size(); i++)
	{
		ParticlePacketShape* particleShape = mParticlePacketShapes[i];

		PxBounds3 bounds = particleShape->getBounds();
		PxVec3 centerGridSpace = bounds.getCenter() / packetSize;		
		
		for (PxU32 d = 0; d < 3; d++)
			bounds.minimum[d] = Ps::floor(centerGridSpace[d]) * packetSize;
		for (PxU32 d = 0; d < 3; d++)
			bounds.maximum[d] = Ps::ceil(centerGridSpace[d]) * packetSize;

		out << PxU32(PxDebugColor::eARGB_BLUE) << Cm::DebugBox(bounds);
	}
}
Exemplo n.º 6
0
void Sc::ParticleSystemSim::removeInteraction(const ParticlePacketShape& particleShape, const ShapeSim& shape, bool isDyingRb, const PxU32 ccdPass) 
{
	PX_ASSERT(mLLSim);
	const PxsShapeCore& shapeCore = shape.getCore().getCore();
	bool isDynamic = shape.actorIsDynamic();
	PxsRigidCore& rigidCore = shape.getPxsRigidCore();
	if(isDynamic)
		getInteractionScene().getLowLevelContext()->getBodyTransformVault().removeBody(static_cast<PxsBodyCore&>(rigidCore));
	
	mLLSim->removeInteractionV(*particleShape.getLowLevelParticleShape(), (PxvShapeHandle)&shapeCore, (PxvBodyHandle)&rigidCore, isDynamic, isDyingRb, (ccdPass > 0));
	mInteractionCount--; 
}
void Sc::ParticleSystemSim::addInteraction(const ParticlePacketShape& particleShape, const ShapeSim& shape, const PxU32 ccdPass)
{
	PX_ASSERT(mLLSim);
	const PxsShapeCore& shapeCore = shape.getCore().getCore();
	bool isDynamic = shape.actorIsDynamic();
	PxsRigidCore& rigidCore = shape.getPxsRigidCore();
	if(isDynamic)
		getScene().getParticleContext()->getBodyTransformVaultFast().addBody(static_cast<PxsBodyCore&>(rigidCore));
		
	mLLSim->addInteractionV(*particleShape.getLowLevelParticleShape(), size_t(&shapeCore), size_t(&rigidCore), isDynamic, (ccdPass > 0));
	mInteractionCount++; 
}
void Sc::ParticleSystemSim::onRbShapeChange(const ParticlePacketShape& particleShape, const ShapeSim& shape)
{
	PX_ASSERT(mLLSim);
	mLLSim->onRbShapeChangeV(*particleShape.getLowLevelParticleShape(), size_t(&shape.getCore().getCore()));
}