本文整理汇总了C++中NxScene::getNbActors方法的典型用法代码示例。如果您正苦于以下问题:C++ NxScene::getNbActors方法的具体用法?C++ NxScene::getNbActors怎么用?C++ NxScene::getNbActors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxScene
的用法示例。
在下文中一共展示了NxScene::getNbActors方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateDetectorsInScene
void plSimulationMgr::UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3& pos, bool entering)
{
// search thru the actors in a scene looking for convex hull detectors and see if the avatar is inside it
// ... and then send appropiate collision message if needed
NxScene* scene = GetScene(world);
plSceneObject* avObj = plSceneObject::ConvertNoRef(avatar->ObjectIsLoaded());
const plCoordinateInterface* ci = avObj->GetCoordinateInterface();
hsPoint3 soPos = ci->GetWorldPos();
if (scene)
{
uint32_t numActors = scene->getNbActors();
NxActor** actors = scene->getActors();
for (int i = 0; i < numActors; i++)
{
plPXPhysical* physical = (plPXPhysical*)actors[i]->userData;
if (physical && physical->DoDetectorHullWorkaround())
{
if ( physical->IsObjectInsideHull(pos) )
{
physical->SetInsideConvexHull(entering);
// we are entering this world... say we entered this detector
ISendCollisionMsg(physical->GetObjectKey(), avatar, entering);
}
}
}
}
}
示例2: ReleaseScene
void plSimulationMgr::ReleaseScene(plKey world)
{
if (!world)
world = GetKey();
SceneMap::iterator it = fScenes.find(world);
hsAssert(it != fScenes.end(), "Unknown scene");
if (it != fScenes.end())
{
NxScene* scene = it->second;
if (scene->getNbActors() == 0)
{
fSDK->releaseScene(*scene);
fScenes.erase(it);
}
}
}
示例3: UpdateAvatarInDetector
void plSimulationMgr::UpdateAvatarInDetector(plKey world, plPXPhysical* detector)
{
// search thru the actors in a scene looking for avatars that might be in the newly enabled detector region
// ... and then send appropiate collision message if needed
if ( detector->DoDetectorHullWorkaround() )
{
NxScene* scene = GetScene(world);
if (scene)
{
uint32_t numActors = scene->getNbActors();
NxActor** actors = scene->getActors();
for (int i = 0; i < numActors; i++)
{
if ( actors[i]->userData == nil )
{
// we go a controller
bool isController;
plPXPhysicalControllerCore* controller = plPXPhysicalControllerCore::GetController(*actors[i],&isController);
if (controller && controller->IsEnabled())
{
plKey avatar = controller->GetOwner();
plSceneObject* avObj = plSceneObject::ConvertNoRef(avatar->ObjectIsLoaded());
const plCoordinateInterface* ci;
if ( avObj && ( ci = avObj->GetCoordinateInterface() ) )
{
if ( detector->IsObjectInsideHull(ci->GetWorldPos()) )
{
detector->SetInsideConvexHull(true);
// we are entering this world... say we entered this detector
ISendCollisionMsg(detector->GetObjectKey(), avatar, true);
}
}
}
}
}
}
}
}
示例4:
~Data()
{
removeFluidContainmentSphere();
#ifdef PROJECT_CLAW_PROTO
unitMaterial = NULL;
#endif
if(physicslib_fluid_containment_actor != NULL)
{
if(scene && physicslib_fluid_containment_actor)
{
assert(scene->isWritable());
scene->releaseActor(*physicslib_fluid_containment_actor);
}
physicslib_fluid_containment_actor = NULL;
physicslib_fluid_containment_shape = NULL;
}
if(sdk && scene)
{
#ifndef NDEBUG
int actors = scene->getNbActors();
assert(actors == 1 || actors == 2);
#ifndef NX_DISABLE_FLUIDS
int fluids = scene->getNbFluids();
assert(fluids == 0);
#endif
#endif
scene->shutdownWorkerThreads();
sdk->releaseScene(*scene);
}
if(sdk)
sdk->release();
}
示例5: ISendUpdates
void plSimulationMgr::ISendUpdates()
{
for (CollisionVec::iterator it = fCollideMsgs.begin(); it != fCollideMsgs.end(); ++it)
{
plCollideMsg* pMsg = *it;
DetectorLogYellow("Collision: %s was triggered by %s. Sending an %s msg", pMsg->GetReceiver(0)->GetName().c_str(),
pMsg->fOtherKey ? pMsg->fOtherKey->GetName().c_str() : "(nil)" , pMsg->fEntering ? "'enter'" : "'exit'");
plgDispatch::Dispatch()->MsgSend(pMsg);
}
fCollideMsgs.clear();
SceneMap::iterator it = fScenes.begin();
for (; it != fScenes.end(); it++)
{
NxScene* scene = it->second;
uint32_t numActors = scene->getNbActors();
NxActor** actors = scene->getActors();
for (int i = 0; i < numActors; i++)
{
plPXPhysical* physical = (plPXPhysical*)actors[i]->userData;
if (physical)
{
// apply any hit forces
physical->ApplyHitForce();
if (physical->GetSceneNode())
{
physical->SendNewLocation();
}
else
{
// if there's no scene node, it's not active (probably about to be collected)
const plKey physKey = physical->GetKey();
if (physKey)
{
const plString &physName = physical->GetKeyName();
if (!physName.IsNull())
{
plSimulationMgr::Log("Removing physical <%s> because of missing scene node.\n", physName.c_str());
}
}
// Remove(physical);
}
}
}
// // iterate through the db types, which are powers-of-two enums.
// for( plLOSDB db = static_cast<plLOSDB>(1) ;
// db < plSimDefs::kLOSDBMax;
// db = static_cast<plLOSDB>(db << 1) )
// {
// fLOSSolvers[db]->Resolve(fSubspace);
// }
// if(fNeedLOSCullPhase)
// {
// for( plLOSDB db = static_cast<plLOSDB>(1) ;
// db < plSimDefs::kLOSDBMax;
// db = static_cast<plLOSDB>(db << 1) )
// {
// fLOSSolvers[db]->Resolve(fSubspace);
// }
// fNeedLOSCullPhase = false;
// }
}
}
示例6: Destroy
CVoid CScene::Destroy()
{
NxScene* tempScene = gPhysXscene/*gPhysicsSDK->getScene(i)*/;
if(tempScene && !g_clickedNew && !g_clickedOpen)
{
for( CUInt i = 0; i < m_instanceGeometries.size(); i++ )
{
CInstanceGeometry* m_instanceGeo = m_instanceGeometries[i];
if( tempScene )
{
for( CUInt j = 0; j < tempScene->getNbActors(); j++ )
{
CChar actorName[MAX_NAME_SIZE];
if( !tempScene->getActors()[j]->getName() ) continue;
Cpy( actorName, tempScene->getActors()[j]->getName() );
if( !Cmp(m_instanceGeo->m_physXName, "\n" ) && Cmp( actorName, m_instanceGeo->m_physXName ) )
{
for(CInt nItem =0 ; nItem < ex_pVandaEngine1Dlg->m_listBoxPhysXElements.GetItemCount(); nItem++)
{
CString strText = ex_pVandaEngine1Dlg->m_listBoxPhysXElements.GetItemText(nItem, 0);
char charPtr[MAX_NAME_SIZE];
sprintf(charPtr, "%s", strText);
if(Cmp( m_instanceGeo->m_physXName, charPtr ) )
{
ex_pVandaEngine1Dlg->m_listBoxPhysXElements.DeleteItem(nItem);
ex_pVandaEngine1Dlg->SortPhysXList();
}
}
tempScene->releaseActor( *tempScene->getActors()[j] );
g_multipleView->m_nx->gControllers->reportSceneChanged();
m_instanceGeo->m_hasPhysX = CFalse;
Cpy( m_instanceGeo->m_physXName, "\n" );
}
}
}
}
}
//while(!m_cfxMaterials.empty())
//{
//std::map<std::string, cfxMaterial*>::iterator iter = m_cfxMaterials.begin();
//CDelete(iter->second);
//m_cfxMaterials.erase(iter);
//}
//m_cfxEffects.clear();
//while(!m_cfxEffects.empty())
//{
//std::map<std::string, cfxEffect*>::iterator iter = m_cfxEffects.begin();
//CDelete(iter->second);
//m_cfxEffects.erase(iter);
//}
//m_cfxEffects.clear();
//delete all the geometries
m_textureList.clear(); //save functions
m_prefabList.clear(); //save functions
if (g_editorMode == eMODE_PREFAB)
{
while (!m_geometries.empty())
{
CDelete(m_geometries[0]);
m_geometries.erase(m_geometries.begin());
}
m_geometries.clear();
}
m_instanceGeometries.clear();
//m_instanceControllers.clear();
while(!m_lightInstances.empty())
{
CDelete(m_lightInstances[0]);
m_lightInstances.erase(m_lightInstances.begin());
}
while(!m_lights.empty())
{
CDelete( m_lights[0] );
m_lights.erase(m_lights.begin());
}
while(!m_cameraInstances.empty())
{
for( CUInt size = 0; size < g_cameraInstances.size(); size++ )
{
if( Cmp( m_cameraInstances[0]->m_abstractCamera->GetName(), g_cameraInstances[size]->m_abstractCamera->GetName() ) )
{
if( g_render.GetActiveInstanceCamera() == g_cameraInstances[size] )
{
if (g_multipleView && g_render.GetDefaultInstanceCamera())
{
g_render.SetActiveInstanceCamera(g_render.GetDefaultInstanceCamera());
g_currentCameraType = eCAMERA_DEFAULT_FREE;
g_multipleView->m_lockInput = CFalse;
}
else
{
g_render.SetActiveInstanceCamera(NULL);
}
}
g_cameraInstances.erase( g_cameraInstances.begin() + size );
//.........这里部分代码省略.........
示例7: Destroy
CVoid CScene::Destroy()
{
NxScene* tempScene = gPhysXscene/*gPhysicsSDK->getScene(i)*/;
if(tempScene && !g_clickedNew && !g_clickedOpen)
{
for( CUInt i = 0; i < m_instanceGeometries.size(); i++ )
{
CInstanceGeometry* m_instanceGeo = m_instanceGeometries[i];
if( tempScene )
{
for( CUInt j = 0; j < tempScene->getNbActors(); j++ )
{
CChar actorName[MAX_URI_SIZE];
if( !tempScene->getActors()[j]->getName() ) continue;
Cpy( actorName, tempScene->getActors()[j]->getName() );
if( !Cmp(m_instanceGeo->m_physXName, "\n" ) && Cmp( actorName, m_instanceGeo->m_physXName ) )
{
tempScene->releaseActor( *tempScene->getActors()[j] );
g_nx->gControllers->reportSceneChanged();
m_instanceGeo->m_hasPhysX = CFalse;
Cpy( m_instanceGeo->m_physXName, "\n" );
}
}
}
}
}
//while(!m_cfxMaterials.empty())
//{
// std::map<std::string, cfxMaterial*>::iterator iter = m_cfxMaterials.begin();
// CDelete(iter->second);
// m_cfxMaterials.erase(iter);
//}
//m_cfxEffects.clear();
//while(!m_cfxEffects.empty())
//{
// std::map<std::string, cfxEffect*>::iterator iter = m_cfxEffects.begin();
// CDelete(iter->second);
// m_cfxEffects.erase(iter);
//}
//m_cfxEffects.clear();
//delete all the geometries
//while(!m_geometries.empty())
//{
// CDelete( m_geometries[0] );
// m_geometries.erase( m_geometries.begin() );
//}
//m_geometries.clear();
m_instanceGeometries.clear();
while(!m_lightInstances.empty())
{
CDelete(m_lightInstances[0]);
m_lightInstances.erase(m_lightInstances.begin());
}
while(!m_lights.empty())
{
CDelete( m_lights[0] );
m_lights.erase(m_lights.begin());
}
while(!m_cameraInstances.empty())
{
for( CUInt size = 0; size < g_cameraInstances.size(); size++ )
{
if( Cmp( m_cameraInstances[0]->m_abstractCamera->GetName(), g_cameraInstances[size]->m_abstractCamera->GetName() ) )
{
if( g_render.GetActiveInstanceCamera() == g_cameraInstances[size] )
{
if (g_main && g_render.GetDefaultInstanceCamera())
{
g_render.SetActiveInstanceCamera(g_render.GetDefaultInstanceCamera());
g_currentCameraType = eCAMERA_DEFAULT_FREE;
g_main->m_lockInput = CFalse;
}
else
{
g_render.SetActiveInstanceCamera(NULL);
}
}
g_cameraInstances.erase( g_cameraInstances.begin() + size );
}
}
CDelete(m_cameraInstances[0]);
m_cameraInstances.erase(m_cameraInstances.begin());
}
while(!m_cameras.empty())
{
CDelete( m_cameras[0] );
m_cameras.erase(m_cameras.begin());
}
while(!m_controllers.empty())
{
CDelete( m_controllers[0] );
m_controllers.erase(m_controllers.begin());
}
//Delete all the nodes
CDelete( m_sceneRoot );
m_nodes.clear();
//.........这里部分代码省略.........