本文整理汇总了C++中PCZone::_addNode方法的典型用法代码示例。如果您正苦于以下问题:C++ PCZone::_addNode方法的具体用法?C++ PCZone::_addNode怎么用?C++ PCZone::_addNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PCZone
的用法示例。
在下文中一共展示了PCZone::_addNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _checkNodeAgainstPortals
void DefaultZone::_checkNodeAgainstPortals(PCZSceneNode * pczsn, Portal * ignorePortal)
{
if (pczsn == mEnclosureNode ||
pczsn->allowedToVisit() == false)
{
// don't do any checking of enclosure node versus portals
return;
}
PCZone * connectedZone;
for ( PortalList::iterator it = mPortals.begin(); it != mPortals.end(); ++it )
{
Portal * p = *it;
//Check if the portal intersects the node
if (p != ignorePortal &&
p->intersects(pczsn) != Portal::NO_INTERSECT)
{
// node is touching this portal
connectedZone = p->getTargetZone();
// add zone to the nodes visiting zone list unless it is the home zone of the node
if (connectedZone != pczsn->getHomeZone() &&
!pczsn->isVisitingZone(connectedZone))
{
pczsn->addZoneToVisitingZonesMap(connectedZone);
// tell the connected zone that the node is visiting it
connectedZone->_addNode(pczsn);
//recurse into the connected zone
connectedZone->_checkNodeAgainstPortals(pczsn, p->getTargetPortal());
}
}
}
}
示例2: _updateHomeZone
/* The following function checks if a node has left it's current home zone.
* This is done by checking each portal in the zone. If the node has crossed
* the portal, then the current zone is no longer the home zone of the node. The
* function then recurses into the connected zones. Once a zone is found where
* the node does NOT cross out through a portal, that zone is the new home zone.
* When this function is done, the node should have the correct home zone already
* set. A pointer is returned to this zone as well.
*
* NOTE: If the node does not have a home zone when this function is called on it,
* the function will do its best to find the proper zone for the node using
* bounding box volume testing. This CAN fail to find the correct zone in
* some scenarios, so it is best for the user to EXPLICITLY set the home
* zone of the node when the node is added to the scene using
* PCZSceneNode::setHomeZone()
*/
void PCZSceneManager::_updateHomeZone( PCZSceneNode * pczsn, bool allowBackTouches )
{
// Skip if root PCZoneTree has been destroyed (shutdown conditions)
if (!mDefaultZone)
return;
PCZone * startzone;
PCZone * newHomeZone;
// start with current home zone of the node
startzone = pczsn->getHomeZone();
if (startzone)
{
if (!pczsn->isAnchored())
{
newHomeZone = startzone->updateNodeHomeZone(pczsn, false);
}
else
{
newHomeZone = startzone;
}
if (newHomeZone != startzone)
{
// add the node to the home zone
newHomeZone->_addNode(pczsn);
}
}
else
{
// the node hasn't had it's home zone set yet, so do our best to
// find the home zone using volume testing.
Vector3 nodeCenter = pczsn->_getDerivedPosition();
PCZone * bestZone = findZoneForPoint(nodeCenter);
// set the best zone as the node's home zone
pczsn->setHomeZone(bestZone);
// add the node to the zone
bestZone->_addNode(pczsn);
}
return;
}