mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 22:54:34 +00:00
Basic zone code refactor using lists instead of linked lists
This commit is contained in:
parent
7e5eacc43d
commit
d9ff5d3f0e
8 changed files with 419 additions and 289 deletions
|
|
@ -96,10 +96,20 @@ SceneCullingState::SceneCullingState( SceneManager* sceneManager, const SceneCam
|
|||
|
||||
bool SceneCullingState::isWithinVisibleZone( SceneObject* object ) const
|
||||
{
|
||||
for( SceneObject::ZoneRef* ref = object->_getZoneRefHead();
|
||||
ref != NULL; ref = ref->nextInObj )
|
||||
if( mZoneVisibilityFlags.test( ref->zone ) )
|
||||
SceneManager* mgr = object->getSceneManager();
|
||||
SceneZoneSpaceManager* zm = mgr->getZoneManager();
|
||||
|
||||
U32 numZones = 0;
|
||||
U32* zones = NULL;
|
||||
|
||||
SceneZoneSpaceManager::ObjectZoneValueIterator itr, itrEnd;
|
||||
zm->getObjectZoneValueIterators(object, itr, itrEnd);
|
||||
|
||||
for (itr; itr != itrEnd; itr++)
|
||||
{
|
||||
if (mZoneVisibilityFlags.test(*itr))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -148,8 +158,19 @@ void SceneCullingState::addOccluder( SceneObject* object )
|
|||
|
||||
// Add the frustum to all zones that the object is assigned to.
|
||||
|
||||
for( SceneObject::ZoneRef* ref = object->_getZoneRefHead(); ref != NULL; ref = ref->nextInObj )
|
||||
addCullingVolumeToZone( ref->zone, volume );
|
||||
U32 numZones = 0;
|
||||
U32* zones = NULL;
|
||||
//object->getSceneManager()->getZoneManager()
|
||||
|
||||
SceneManager* sm = object->getSceneManager();
|
||||
SceneZoneSpaceManager* zm = sm->getZoneManager();
|
||||
SceneZoneSpaceManager::ObjectZoneValueIterator itr, itrEnd;
|
||||
zm->getObjectZoneValueIterators(object, itr, itrEnd);
|
||||
|
||||
for (itr; itr != itrEnd; itr++)
|
||||
{
|
||||
addCullingVolumeToZone(*itr, volume);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -679,7 +700,7 @@ bool SceneCullingState::isOccluded( SceneObject* object ) const
|
|||
|
||||
CullingTestResult result = _testOccludersOnly(
|
||||
object->getWorldBox(),
|
||||
SceneObject::ObjectZonesIterator( object )
|
||||
mSceneManager->getZoneManager()->makeObjectZoneValueIterator(object)
|
||||
);
|
||||
|
||||
return ( result == SceneZoneCullingState::CullingTestPositiveByOcclusion );
|
||||
|
|
@ -719,6 +740,8 @@ U32 SceneCullingState::cullObjects( SceneObject** objects, U32 numObjects, U32 c
|
|||
const PlaneF& nearPlane = getCullingFrustum().getPlanes()[ Frustum::PlaneNear ];
|
||||
const PlaneF& farPlane = getCullingFrustum().getPlanes()[ Frustum::PlaneFar ];
|
||||
|
||||
SceneZoneSpaceManager* zoneMgr = mSceneManager->getZoneManager();
|
||||
|
||||
for( U32 i = 0; i < numObjects; ++ i )
|
||||
{
|
||||
SceneObject* object = objects[ i ];
|
||||
|
|
@ -777,7 +800,7 @@ U32 SceneCullingState::cullObjects( SceneObject** objects, U32 numObjects, U32 c
|
|||
{
|
||||
CullingTestResult result = _test(
|
||||
object->getWorldBox(),
|
||||
SceneObject::ObjectZonesIterator( object ),
|
||||
zoneMgr->makeObjectZoneValueIterator( object ),
|
||||
nearPlane,
|
||||
farPlane
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue