示例#1
0
void VisualDebugger::setupSceneConnection(Scb::Scene& s)
{
	physx::debugger::comm::PvdDataStream* conn = mPvdConnectionFactory ? &mPvdConnectionFactory->createDataStream() : NULL;
	if(conn)
	s.getSceneVisualDebugger().setPvdConnection(conn, mPvdConnectionFactory ? mPvdConnectionFactory->getConnectionType() : physx::debugger::TConnectionFlagsType(0));
	s.getSceneVisualDebugger().setCreateContactReports(conn ? getTransmitContactsFlag() : false);
}
示例#2
0
void NpRigidDynamic::release()
{
    NP_WRITE_CHECK(NpActor::getOwnerScene(*this));

    NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, userData);

    Scb::Scene* s = mBody.getScbSceneForAPI();

    bool noSim = mBody.isSimDisabledInternally();
    // important to check the non-buffered flag because it tells what the current internal state of the object is
    // (someone might switch to non-simulation and release all while the sim is running).
    if (s && noSim)
    {
        // need to do it here because the Np-shape buffer will not be valid anymore after the release below
        // and unlike simulation objects, there is no shape buffer in the simulation controller
        getShapeManager().clearShapesOnRelease(*s, *this);
    }

    NpRigidDynamicT::release();

    // Remove from scene should happen at the end because the base class still needs to know whether the object was in the scene (implicit constraint removal etc.)
    if (s)
    {
        s->removeRigidBody(mBody, true, noSim);
        static_cast<NpScene*>(s->getPxScene())->removeFromRigidActorList(mIndex);
    }

    mBody.destroy();
}
void VisualDebugger::setupSceneConnection(Scb::Scene& s)
{
	PVD::PvdDataStream* conn = mPvdConnectionFactory ? mPvdConnectionFactory->createDataStream() : NULL;
	if(conn)
		conn->setNamespace(getPhysxNamespace());
	s.getSceneVisualDebugger().setPvdConnection(conn, mPvdConnectionFactory ? mPvdConnectionFactory->getConnectionType() : PVD::TConnectionFlagsType(0));
	s.getSceneVisualDebugger().setCreateContactReports(conn ? getTransmitContactsFlag() : false);
}
SceneQueryManager::SceneQueryManager(	Scb::Scene& scene, PxPruningStructureType::Enum staticStructure, 
										PxPruningStructureType::Enum dynamicStructure, PxU32 dynamicTreeRebuildRateHint,
										const PxSceneLimits& limits) :
	mScene		(scene)
{
	mPrunerExt[PruningIndex::eSTATIC].init(staticStructure, scene.getContextId());
	mPrunerExt[PruningIndex::eDYNAMIC].init(dynamicStructure, scene.getContextId());

	setDynamicTreeRebuildRateHint(dynamicTreeRebuildRateHint);

	preallocate(limits.maxNbStaticShapes, limits.maxNbDynamicShapes);

	mDynamicBoundsSync.mPruner = mPrunerExt[PruningIndex::eDYNAMIC].pruner();
	mDynamicBoundsSync.mTimestamp = &mPrunerExt[PruningIndex::eDYNAMIC].mTimestamp;
}
void NpConstraint::updateConstants()
{
	if(!mIsDirty)
		return;

	//ML - we can't just set dirty to false because this fails with constraints that were created while the scene was buffering!
	if(mConstraint.updateConstants(mConstraint.getPxConnector()->prepareData()))
		mIsDirty = false;
#if PX_SUPPORT_PVD
	Scb::Scene* scbScene = mConstraint.getScbSceneForAPI();
	//Changed to use the visual scenes update system which respects
	//the debugger's connection type flag.
	if( scbScene && !scbScene->isPhysicsBuffering() )
		scbScene->getScenePvdClient().updatePvdProperties( &mConstraint );
#endif
}
void NpShapeManager::clearShapesOnRelease(Scb::Scene& s, PxRigidActor& r)
{
	PX_ASSERT(static_cast<Scb::RigidObject&>(NpActor::getScbFromPxActor(r)).isSimDisabledInternally());
	
	const PxU32 nbShapes = getNbShapes();
	NpShape*const* PX_RESTRICT shapes = getShapes();

	for(PxU32 i=0;i<nbShapes;i++)
	{
		Scb::Shape& scbShape = shapes[i]->getScbShape();
		scbShape.checkUpdateOnRemove<false>(&s);
#if PX_SUPPORT_PVD
		s.getScenePvdClient().releasePvdInstance(&scbShape, r);
#else
		PX_UNUSED(r);
#endif
	}
}