本文整理汇总了C++中PCZone类的典型用法代码示例。如果您正苦于以下问题:C++ PCZone类的具体用法?C++ PCZone怎么用?C++ PCZone使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PCZone类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/** Delete a anti portal instance by name */
void PCZSceneManager::destroyAntiPortal(const String& portalName)
{
// find the anti portal from the master portal list
AntiPortal* p;
AntiPortal* thePortal = 0;
AntiPortalList::iterator it = mAntiPortals.begin();
while (it != mAntiPortals.end())
{
p = *it;
if (p->getName() == portalName)
{
thePortal = p;
// erase entry in the master list
mAntiPortals.erase(it);
break;
}
it++;
}
if (thePortal)
{
// remove the Portal from it's home zone
PCZone* homeZone = thePortal->getCurrentHomeZone();
if (homeZone)
{
// inform zone of portal change
homeZone->setPortalsUpdated(true);
homeZone->_removeAntiPortal(thePortal);
}
// delete the portal instance
OGRE_DELETE thePortal;
}
}
示例2:
/* Find the best (smallest) zone that contains a point
*/
PCZone * PCZSceneManager::findZoneForPoint(Vector3 & point)
{
PCZone * zone;
PCZone * bestZone = mDefaultZone;
Real bestVolume = Ogre::Math::POS_INFINITY;
ZoneMap::iterator zit = mZones.begin();
while ( zit != mZones.end() )
{
zone = zit->second;
AxisAlignedBox aabb;
zone->getAABB(aabb);
SceneNode * enclosureNode = zone->getEnclosureNode();
if (enclosureNode != 0)
{
// since this is the "local" AABB, add in world translation of the enclosure node
aabb.setMinimum(aabb.getMinimum() + enclosureNode->_getDerivedPosition());
aabb.setMaximum(aabb.getMaximum() + enclosureNode->_getDerivedPosition());
}
if (aabb.contains(point))
{
if (aabb.volume() < bestVolume)
{
// this zone is "smaller" than the current best zone, so make it
// the new best zone
bestZone = zone;
bestVolume = aabb.volume();
}
}
// proceed to next zone in the list
++zit;
}
return bestZone;
}
示例3: _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());
}
}
}
}
示例4: if
bool PCZSceneManager::setOption( const String & key, const void * val )
{
if ( key == "ShowBoundingBoxes" )
{
mShowBoundingBoxes = * static_cast < const bool * > ( val );
return true;
}
else if ( key == "ShowPortals" )
{
mShowPortals = * static_cast < const bool * > ( val );
return true;
}
// send option to each zone
ZoneMap::iterator i;
PCZone * zone;
for (i = mZones.begin(); i != mZones.end(); i++)
{
zone = i->second;
if (zone->setOption(key, val ) == true)
{
return true;
}
}
// try regular scenemanager option
return SceneManager::setOption( key, val );
}
示例5: destroyPortal
// delete a portal instance by pointer
void PCZSceneManager::destroyPortal(Portal * p)
{
// remove the portal from it's target portal
Portal * targetPortal = p->getTargetPortal();
if (targetPortal)
{
targetPortal->setTargetPortal(0); // the targetPortal will still have targetZone value, but targetPortal will be invalid
}
// remove the Portal from it's home zone
PCZone * homeZone = p->getCurrentHomeZone();
if (homeZone)
{
// inform zone of portal change. Do here since PCZone is abstract
homeZone->setPortalsUpdated(true);
homeZone->_removePortal(p);
}
// remove the portal from the master portal list
PortalList::iterator it = std::find( mPortals.begin(), mPortals.end(), p );
if (it != mPortals.end())
{
mPortals.erase(it);
}
// delete the portal instance
OGRE_DELETE p;
}
示例6: OGRE_EXCEPT
// Create a camera for the scene
Camera * PCZSceneManager::createCamera( const String &name )
{
// Check name not used
if (mCameras.find(name) != mCameras.end())
{
OGRE_EXCEPT(
Exception::ERR_DUPLICATE_ITEM,
"A camera with the name " + name + " already exists",
"PCZSceneManager::createCamera" );
}
Camera * c = OGRE_NEW PCZCamera( name, this );
mCameras.insert( CameraList::value_type( name, c ) );
// create visible bounds aab map entry
mCamVisibleObjectsMap[c] = VisibleObjectsBoundsInfo();
// tell all the zones about the new camera
ZoneMap::iterator i;
PCZone * zone;
for (i = mZones.begin(); i != mZones.end(); i++)
{
zone = i->second;
zone->notifyCameraCreated( c );
}
return c;
}
示例7: getRenderQueue
// main visibility determination & render queue filling routine
// over-ridden from base/default scene manager. This is *the*
// main call.
void PCZSceneManager::_findVisibleObjects(Camera* cam,
VisibleObjectsBoundsInfo* visibleBounds,
bool onlyShadowCasters)
{
// clear the render queue
getRenderQueue()->clear();
// if we are re-rendering the scene again with the same camera, we can just use the cache.
// this helps post processing compositors.
unsigned long frameCount = Root::getSingleton().getNextFrameNumber();
if (mLastActiveCamera == cam && mFrameCount == frameCount)
{
RenderQueue* queue = getRenderQueue();
size_t count = mVisible.size();
for (size_t i = 0; i < count; ++i)
{
((PCZSceneNode*)mVisible[i])->_addToRenderQueue(
cam, queue, onlyShadowCasters, visibleBounds);
}
return;
}
// increment the visibility frame counter
mFrameCount = frameCount;
mLastActiveCamera = cam;
// clear the list of visible nodes
mVisible.clear();
// turn off sky
enableSky(false);
// remove all extra culling planes
((PCZCamera*)cam)->removeAllExtraCullingPlanes();
// update the camera
((PCZCamera*)cam)->update();
// get the home zone of the camera
PCZone* cameraHomeZone = ((PCZSceneNode*)(cam->getParentSceneNode()))->getHomeZone();
// walk the zones, starting from the camera home zone,
// adding all visible scene nodes to the mVisibles list
cameraHomeZone->setLastVisibleFrame(mFrameCount);
cameraHomeZone->findVisibleNodes((PCZCamera*)cam,
mVisible,
getRenderQueue(),
visibleBounds,
onlyShadowCasters,
mDisplayNodes,
mShowBoundingBoxes);
}
示例8: createZoneSpecificNodeData
// create any zone-specific data necessary for all zones for the given node
void PCZSceneManager::createZoneSpecificNodeData(PCZSceneNode * node)
{
ZoneMap::iterator i;
PCZone * zone;
for (i = mZones.begin(); i != mZones.end(); i++)
{
zone = i->second;
if (zone->requiresZoneSpecificNodeData())
{
zone->createNodeZoneData(node);
}
}
}
示例9: updateZones
//-----------------------------------------------------------------------
void PCZLight::updateZones(PCZone * defaultZone, unsigned long frameCount)
{
//update the zones this light affects
PCZone * homeZone;
affectedZonesList.clear();
mAffectsVisibleZone = false;
PCZSceneNode * sn = (PCZSceneNode*)(this->getParentSceneNode());
if (sn)
{
// start with the zone the light is in
homeZone = sn->getHomeZone();
if (homeZone)
{
affectedZonesList.push_back(homeZone);
if (homeZone->getLastVisibleFrame() == frameCount)
{
mAffectsVisibleZone = true;
}
}
else
{
// error - scene node has no homezone!
// just say it affects the default zone and leave it at that.
affectedZonesList.push_back(defaultZone);
if (defaultZone->getLastVisibleFrame() == frameCount)
{
mAffectsVisibleZone = true;
}
return;
}
}
else
{
// ERROR! not connected to a scene node,
// just say it affects the default zone and leave it at that.
affectedZonesList.push_back(defaultZone);
if (defaultZone->getLastVisibleFrame() == frameCount)
{
mAffectsVisibleZone = true;
}
return;
}
// now check visibility of each portal in the home zone. If visible to
// the light then add the target zone of the portal to the list of
// affected zones and recurse into the target zone
static PCZFrustum portalFrustum;
Vector3 v = getDerivedPosition();
portalFrustum.setOrigin(v);
homeZone->_checkLightAgainstPortals(this, frameCount, &portalFrustum, 0);
}
示例10: _renderScene
/** Overridden from SceneManager */
void PCZSceneManager::_renderScene(Camera* cam, Viewport *vp, bool includeOverlays)
{
// notify all the zones that a scene render is starting
ZoneMap::iterator i;
PCZone * zone;
for (i = mZones.begin(); i != mZones.end(); i++)
{
zone = i->second;
zone->notifyBeginRenderScene();
}
// do the regular _renderScene
SceneManager::_renderScene(cam, vp, includeOverlays);
}
示例11: _dirtyNodeByMovingPortals
/** Mark nodes dirty for every zone with moving portal in the scene */
void PCZSceneManager::_dirtyNodeByMovingPortals(void)
{
PCZone * zone;
ZoneMap::iterator zit = mZones.begin();
while ( zit != mZones.end() )
{
zone = zit->second;
// this call mark nodes dirty base on moving portals
zone->dirtyNodeByMovingPortals();
// proceed to next zone in the list
++zit;
}
}
示例12: _updatePortalZoneData
void PCZSceneManager::_updatePortalZoneData(void)
{
PCZone * zone;
ZoneMap::iterator zit = mZones.begin();
while ( zit != mZones.end() )
{
zone = zit->second;
// this callchecks for portal zone changes & applies zone data changes as necessary
zone->updatePortalsZoneData();
// proceed to next zone in the list
++zit;
}
}
示例13: setWorldGeometryRenderQueue
/** Overridden from SceneManager */
void PCZSceneManager::setWorldGeometryRenderQueue(uint8 qid)
{
// tell all the zones about the new WorldGeometryRenderQueue
ZoneMap::iterator i;
PCZone * zone;
for (i = mZones.begin(); i != mZones.end(); i++)
{
zone = i->second;
zone->notifyWorldGeometryRenderQueue( qid );
}
// call the regular scene manager version
SceneManager::setWorldGeometryRenderQueue(qid);
}
示例14: setZoneGeometry
void PCZSceneManager::setZoneGeometry(const String & zoneName,
PCZSceneNode * parentNode,
const String & filename)
{
ZoneMap::iterator i;
PCZone * zone;
i = mZones.find(zoneName);
if (i != mZones.end())
{
zone = i->second;
zone->setZoneGeometry( filename, parentNode );
return;
}
}
示例15: destroyAntiPortal
/** Delete a anti portal instance by pointer */
void PCZSceneManager::destroyAntiPortal(AntiPortal * p)
{
// remove the Portal from it's home zone
PCZone* homeZone = p->getCurrentHomeZone();
if (homeZone)
{
// inform zone of portal change. Do here since PCZone is abstract
homeZone->setPortalsUpdated(true);
homeZone->_removeAntiPortal(p);
}
// remove the portal from the master portal list
AntiPortalList::iterator it = std::find(mAntiPortals.begin(), mAntiPortals.end(), p);
if (it != mAntiPortals.end()) mAntiPortals.erase(it);
// delete the portal instance
OGRE_DELETE p;
}