//----------------------------------------------------------------------- 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); }