Skip to content

PCZ: range loop refactoring #3376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 54 additions & 54 deletions PlugIns/PCZSceneManager/src/OgreDefaultZone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace Ogre

// this call adds the given node to either the zone's list
// of nodes at home in the zone, or to the list of visiting nodes
// NOTE: The list is decided by the node's homeZone value, so
// NOTE: The list is decided by the node's homeZone value, so
// that must be set correctly before calling this function.
void DefaultZone::_addNode( PCZSceneNode * n )
{
Expand Down Expand Up @@ -95,7 +95,7 @@ namespace Ogre
}
}

/** Indicates whether or not this zone requires zone-specific data for
/** Indicates whether or not this zone requires zone-specific data for
* each scene node
*/
bool DefaultZone::requiresZoneSpecificNodeData(void)
Expand All @@ -107,12 +107,12 @@ namespace Ogre
/* Recursively check for intersection of the given scene node
* with zone portals. If the node touches a portal, then the
* connected zone is assumed to be touched. The zone adds
* the node to its node list and the node adds the zone to
* its visiting zone list.
* the node to its node list and the node adds the zone to
* its visiting zone list.
*
* NOTE: This function assumes that the home zone of the node
* NOTE: This function assumes that the home zone of the node
* is correct. The function "_updateHomeZone" in PCZSceneManager
* takes care of this and should have been called before
* takes care of this and should have been called before
* this function.
*/

Expand Down Expand Up @@ -152,8 +152,8 @@ namespace Ogre
* NOTE: This is the default implementation, which doesn't take advantage
* of any zone-specific optimizations for checking portal visibility
*/
void DefaultZone::_checkLightAgainstPortals(PCZLight *light,
unsigned long frameCount,
void DefaultZone::_checkLightAgainstPortals(PCZLight *light,
unsigned long frameCount,
PCZFrustum *portalFrustum,
Portal * ignorePortal)
{
Expand All @@ -174,7 +174,7 @@ namespace Ogre
// point lights - just check if within illumination range
if (lightToPortal.length() <= light->getAttenuationRange())
{
// if portal is quad portal it must be pointing towards the light
// if portal is quad portal it must be pointing towards the light
if ((p->getType() == Portal::PORTAL_TYPE_QUAD && lightToPortal.dotProduct(p->getDerivedDirection()) < 0.0) ||
(p->getType() != Portal::PORTAL_TYPE_QUAD))
{
Expand All @@ -188,8 +188,8 @@ namespace Ogre
// set culling frustum from the portal
portalFrustum->addPortalCullingPlanes(p);
// recurse into the target zone of the portal
p->getTargetZone()->_checkLightAgainstPortals(light,
frameCount,
p->getTargetZone()->_checkLightAgainstPortals(light,
frameCount,
portalFrustum,
p->getTargetPortal());
// remove the planes added by this portal
Expand All @@ -203,7 +203,7 @@ namespace Ogre
// the direction is facing the portal
if (lightToPortal.dotProduct(light->getDerivedDirection()) >= 0.0)
{
// if portal is quad portal it must be pointing towards the light
// if portal is quad portal it must be pointing towards the light
if ((p->getType() == Portal::PORTAL_TYPE_QUAD && lightToPortal.dotProduct(p->getDerivedDirection()) < 0.0) ||
(p->getType() != Portal::PORTAL_TYPE_QUAD))
{
Expand All @@ -217,8 +217,8 @@ namespace Ogre
// set culling frustum from the portal
portalFrustum->addPortalCullingPlanes(p);
// recurse into the target zone of the portal
p->getTargetZone()->_checkLightAgainstPortals(light,
frameCount,
p->getTargetZone()->_checkLightAgainstPortals(light,
frameCount,
portalFrustum,
p->getTargetPortal());
// remove the planes added by this portal
Expand All @@ -235,7 +235,7 @@ namespace Ogre
// as a future optimisation.
if (lightToPortal.length() <= light->getAttenuationRange())
{
// if portal is quad portal it must be pointing towards the light
// if portal is quad portal it must be pointing towards the light
if ((p->getType() == Portal::PORTAL_TYPE_QUAD && lightToPortal.dotProduct(p->getDerivedDirection()) < 0.0) ||
(p->getType() != Portal::PORTAL_TYPE_QUAD))
{
Expand All @@ -249,8 +249,8 @@ namespace Ogre
// set culling frustum from the portal
portalFrustum->addPortalCullingPlanes(p);
// recurse into the target zone of the portal
p->getTargetZone()->_checkLightAgainstPortals(light,
frameCount,
p->getTargetZone()->_checkLightAgainstPortals(light,
frameCount,
portalFrustum,
p->getTargetPortal());
// remove the planes added by this portal
Expand All @@ -262,7 +262,7 @@ namespace Ogre
}
}
}
}
}
}

/** Update the zone data for the portals in the zone
Expand All @@ -280,11 +280,11 @@ namespace Ogre

Real pRadius = p->getDerivedRadius();

// First we check against portals in the SAME zone (and only if they have a
// First we check against portals in the SAME zone (and only if they have a
// target zone different from the home zone)
// Here we check only against portals that moved and of smaller size.

// We do not need to check portal againts previous portals
// We do not need to check portal againts previous portals
// since it would have been already checked.
// Hence we start with the next portal after the current portal.
PortalList::iterator it2 = it;
Expand Down Expand Up @@ -448,7 +448,7 @@ namespace Ogre
{
default:
case Portal::NO_INTERSECT: // node does not intersect portal - do nothing
case Portal::INTERSECT_NO_CROSS:// node intersects but does not cross portal - do nothing
case Portal::INTERSECT_NO_CROSS:// node intersects but does not cross portal - do nothing
break;
case Portal::INTERSECT_BACK_NO_CROSS:// node intersects but on the back of the portal
if (allowBackTouches)
Expand Down Expand Up @@ -486,10 +486,10 @@ namespace Ogre
/*
// Recursively walk the zones, adding all visible SceneNodes to the list of visible nodes.
*/
void DefaultZone::findVisibleNodes(PCZCamera *camera,
void DefaultZone::findVisibleNodes(PCZCamera *camera,
NodeList & visibleNodeList,
RenderQueue * queue,
VisibleObjectsBoundsInfo* visibleBounds,
VisibleObjectsBoundsInfo* visibleBounds,
bool onlyShadowCasters,
bool displayNodes,
bool showBoundingBoxes)
Expand All @@ -503,12 +503,12 @@ namespace Ogre

// Else, the zone is automatically assumed to be visible since either
// it is the camera the zone is in, or it was reached because
// a connecting portal was deemed visible to the camera.
// a connecting portal was deemed visible to the camera.

// enable sky if called to do so for this zone
if (mHasSky)
{
// enable sky
// enable sky
mPCZSM->enableSky(true);
}

Expand Down Expand Up @@ -618,7 +618,7 @@ namespace Ogre
// tell target zone it's visible this frame
portal->getTargetZone()->setLastVisibleFrame(mLastVisibleFrame);
portal->getTargetZone()->setLastVisibleFromCamera(camera);
// recurse into the connected zone
// recurse into the connected zone
portal->getTargetZone()->findVisibleNodes(camera,
visibleNodeList,
queue,
Expand Down Expand Up @@ -657,8 +657,8 @@ namespace Ogre
}

// --- find nodes which intersect various types of BV's ---
void DefaultZone::_findNodes( const AxisAlignedBox &t,
PCZSceneNodeList &list,
void DefaultZone::_findNodes( const AxisAlignedBox &t,
PCZSceneNodeList &list,
PortalList &visitedPortals,
bool includeVisitors,
bool recurseThruPortals,
Expand Down Expand Up @@ -737,12 +737,12 @@ namespace Ogre
{
// save portal to the visitedPortals list
visitedPortals.push_front(portal);
// recurse into the connected zone
portal->getTargetZone()->_findNodes(t,
list,
// recurse into the connected zone
portal->getTargetZone()->_findNodes(t,
list,
visitedPortals,
includeVisitors,
recurseThruPortals,
includeVisitors,
recurseThruPortals,
exclude);
}
}
Expand All @@ -751,8 +751,8 @@ namespace Ogre
}
}

void DefaultZone::_findNodes(const Sphere &t,
PCZSceneNodeList &list,
void DefaultZone::_findNodes(const Sphere &t,
PCZSceneNodeList &list,
PortalList &visitedPortals,
bool includeVisitors,
bool recurseThruPortals,
Expand Down Expand Up @@ -831,12 +831,12 @@ namespace Ogre
{
// save portal to the visitedPortals list
visitedPortals.push_front(portal);
// recurse into the connected zone
portal->getTargetZone()->_findNodes(t,
list,
// recurse into the connected zone
portal->getTargetZone()->_findNodes(t,
list,
visitedPortals,
includeVisitors,
recurseThruPortals,
includeVisitors,
recurseThruPortals,
exclude);
}
}
Expand All @@ -846,8 +846,8 @@ namespace Ogre

}

void DefaultZone::_findNodes( const PlaneBoundedVolume &t,
PCZSceneNodeList &list,
void DefaultZone::_findNodes( const PlaneBoundedVolume &t,
PCZSceneNodeList &list,
PortalList &visitedPortals,
bool includeVisitors,
bool recurseThruPortals,
Expand Down Expand Up @@ -926,12 +926,12 @@ namespace Ogre
{
// save portal to the visitedPortals list
visitedPortals.push_front(portal);
// recurse into the connected zone
portal->getTargetZone()->_findNodes(t,
list,
// recurse into the connected zone
portal->getTargetZone()->_findNodes(t,
list,
visitedPortals,
includeVisitors,
recurseThruPortals,
includeVisitors,
recurseThruPortals,
exclude);
}
}
Expand All @@ -941,8 +941,8 @@ namespace Ogre

}

void DefaultZone::_findNodes( const Ray &t,
PCZSceneNodeList &list,
void DefaultZone::_findNodes( const Ray &t,
PCZSceneNodeList &list,
PortalList &visitedPortals,
bool includeVisitors,
bool recurseThruPortals,
Expand Down Expand Up @@ -1022,12 +1022,12 @@ namespace Ogre
{
// save portal to the visitedPortals list
visitedPortals.push_front(portal);
// recurse into the connected zone
portal->getTargetZone()->_findNodes(t,
list,
// recurse into the connected zone
portal->getTargetZone()->_findNodes(t,
list,
visitedPortals,
includeVisitors,
recurseThruPortals,
includeVisitors,
recurseThruPortals,
exclude);
}
}
Expand Down
Loading