SceneZoneSpaceManager
Engine/source/scene/zones/sceneZoneSpaceManager.h
Object that manages zone spaces in a scene.
Classes:
Iterator for the contents of a given zone.
Dirty Lists
Updating the zoning state of a scene is done en block rather than individually for each object as it changes transforms or size.
Area of the scene that needs to be rezoned.
Vector< SceneZoneSpace * >
List of zone spaces that have changed state and need updating.
Vector< SceneObject * >
List of objects (non-zone spaces) that have changed state and need updating.
Objects
registerObject(SceneObject * object)
Add zoning state to the given object.
unregisterObject(SceneObject * object)
Remove the given object from the zoning state.
notifyObjectChanged(SceneObject * object)
Let the manager know that state relevant to zoning of the given object has changed.
updateObject(SceneObject * object)
Update the zoning state of the given object.
Zones
Return the root zone of the scene.
registerZones(SceneZoneSpace * object, U32 numZones)
Register a zone manager.
unregisterZones(SceneZoneSpace * object)
Unregister a zone manager.
bool
isValidZoneId(const U32 zoneId)
Return true if the given ID belongs to a currently registered zone.
getZoneOwner(const U32 zoneId)
Get the scene object that contains the zone with the given ID.
Return the total number of zones in the scene.
Return the effective amount of used zone IDs in the scene.
Return the total number of objects in the scene that manage zones.
findZone(const Point3F & point, SceneZoneSpace *& outZoneSpace, U32 & outZoneID)
Find the zone that contains the given point.
Debugging
Verify the current zoning state.
dumpZoneStates(bool update)
Dump the current state of all zone spaces in the scene to the console.
Public Types
_Anonymous_ { RootZoneId = 0 InvalidZoneId = 0xFFFFFFFF }
Signal< void(SceneZoneSpaceManager *) >
ZoningChangedSignal
A signal used to notify that the zone setup of the scene has changed.
Public Friends
class
class
Protected Attributes
Scene container that holds the zone spaces we are managing.
Number of zone IDs that are in active use.
Total number of zones that have been allocated in the scene.
The root and outdoor zone of the scene.
Object list for each zone in the scene.
Vector< SceneZoneSpace * >
Collection of objects that manage zones.
Vector< SceneObject * >
Vector used repeatedly for zone space queries on the container.
Protected Static Attributes
Allocator for ZoneRefs.
Protected Functions
_addToOutdoorZone(SceneObject * object)
Assign the given object to the outdoor zone.
_addToZoneList(U32 zoneId, SceneObject * object)
Add to given object to the zone list of the given zone.
_clearZoneList(U32 zoneId)
Clear all objects assigned to the given zone.
Check to see if we have accumulated a lot of unallocate zone IDs and if so, compact the zoning lists by reassigning IDs.
_findInZoneList(U32 zoneId, SceneObject * object)
Find the given object in the zone list of the given zone.
_getZoneSpaceIndex(SceneZoneSpace * object)
Return the index into mZoneSpaces for the given object or -1 if @object is not a zone manager.
_queryZoneSpaces(const Box3F & area)
Fill mZoneSpacesQueryList with all ZoneObjectType objects in the given area.
_rezoneObject(SceneObject * object)
Update the zoning state of the given object.
_rezoneObjects(const Box3F & area)
Rezone all objects in the given area.
_zoneInsert(SceneObject * object, bool queryListInitialized)
Attach zoning state to the given object.
_zoneRemove(SceneObject * object)
Detach zoning state from the given object.
Public Functions
SceneZoneSpaceManager(SceneContainer * container)
Bring the zoning state of the scene up to date.
Detailed Description
Object that manages zone spaces in a scene.
Dirty Lists
Updating the zoning state of a scene is done en block rather than individually for each object as it changes transforms or size.
Box3F mDirtyArea
Area of the scene that needs to be rezoned.
Vector< SceneZoneSpace * > mDirtyZoneSpaces
List of zone spaces that have changed state and need updating.
Vector< SceneObject * > mDirtyObjects
List of objects (non-zone spaces) that have changed state and need updating.
Objects
registerObject(SceneObject * object)
Add zoning state to the given object.
unregisterObject(SceneObject * object)
Remove the given object from the zoning state.
notifyObjectChanged(SceneObject * object)
Let the manager know that state relevant to zoning of the given object has changed.
updateObject(SceneObject * object)
Update the zoning state of the given object.
Zones
getRootZone()
Return the root zone of the scene.
registerZones(SceneZoneSpace * object, U32 numZones)
Register a zone manager.
Parameters:
object | SceneZoneSpace object that contains zones. |
numZones | Number of zones that object contains. |
unregisterZones(SceneZoneSpace * object)
Unregister a zone manager.
Parameters:
object | Object that contains zones. |
isValidZoneId(const U32 zoneId)
Return true if the given ID belongs to a currently registered zone.
getZoneOwner(const U32 zoneId)
Get the scene object that contains the zone with the given ID.
Parameters:
zoneId | ID of the zone. Must be valid. |
The zone space that has registered the given zone.
getNumZones()
Return the total number of zones in the scene.
getNumActiveZones()
Return the effective amount of used zone IDs in the scene.
getNumZoneSpaces()
Return the total number of objects in the scene that manage zones.
findZone(const Point3F & point, SceneZoneSpace *& outZoneSpace, U32 & outZoneID)
Find the zone that contains the given point.
Note that the result can be any zone containing the given point.
findZones(const Box3F & area, Vector< U32 > & outZones)
Collect the IDs of all zones that overlap the given area.
Parameters:
area | AABB of scene space to query. |
outZones | IDs of all overlapped zones are added to this vector. |
Number of zones that have been added to outZones. Always at least 1 as at least the outdoor zone always overlaps the given area (though if another zone manager fully contains area, the outdoor zone will not be added to the list).
getZoningChangedSignal()
Debugging
verifyState()
Verify the current zoning state.
This makes sure all the connectivity information and all the zone assignments appear to be correct.
dumpZoneStates(bool update)
Dump the current state of all zone spaces in the scene to the console.
Parameters:
update | If true, zoning state states are updated first; if false, zoning is dumped as is. |
Public Types
@163
Enumerator
- RootZoneId = 0
Zone ID of the exterior zone.
- InvalidZoneId = 0xFFFFFFFF
Constant to indicate an invalid zone ID.
typedef Signal< void(SceneZoneSpaceManager *) > ZoningChangedSignal
A signal used to notify that the zone setup of the scene has changed.
note:If you use this signal to maintain state that depends on the zoning setup, it's best to not immediately update the sate in response to this signal. The reason is that during loading and editing, the signal may be fired a lot and continuously updating dependent data may waste a lot of time.
Public Friends
Protected Attributes
SceneContainer * mContainer
Scene container that holds the zone spaces we are managing.
U32 mNumActiveZones
Number of zone IDs that are in active use.
U32 mNumTotalAllocatedZones
Total number of zones that have been allocated in the scene.
SceneRootZone * mRootZone
The root and outdoor zone of the scene.
Vector< SceneObject::ZoneRef * > mZoneLists
Object list for each zone in the scene.
First entry in the list points back to the zone manager.
Vector< SceneZoneSpace * > mZoneSpaces
Collection of objects that manage zones.
Vector< SceneObject * > mZoneSpacesQueryList
Vector used repeatedly for zone space queries on the container.
Protected Static Attributes
ClassChunker< SceneObject::ZoneRef > smZoneRefChunker
Allocator for ZoneRefs.
Protected Functions
_addToOutdoorZone(SceneObject * object)
Assign the given object to the outdoor zone.
_addToZoneList(U32 zoneId, SceneObject * object)
Add to given object to the zone list of the given zone.
_clearZoneList(U32 zoneId)
Clear all objects assigned to the given zone.
note:This does not remove the first link in the zone list which is the link back to the zone manager.
_compactZonesCheck()
Check to see if we have accumulated a lot of unallocate zone IDs and if so, compact the zoning lists by reassigning IDs.
@warn This method may alter all zone IDs in the scene!
_findInZoneList(U32 zoneId, SceneObject * object)
Find the given object in the zone list of the given zone.
_getZoneSpaceIndex(SceneZoneSpace * object)
Return the index into mZoneSpaces for the given object or -1 if @object is not a zone manager.
_queryZoneSpaces(const Box3F & area)
Fill mZoneSpacesQueryList with all ZoneObjectType objects in the given area.
_rezoneObject(SceneObject * object)
Update the zoning state of the given object.
_rezoneObjects(const Box3F & area)
Rezone all objects in the given area.
_zoneInsert(SceneObject * object, bool queryListInitialized)
Attach zoning state to the given object.
_zoneRemove(SceneObject * object)
Detach zoning state from the given object.
Public Functions
SceneZoneSpaceManager(SceneContainer * container)
~SceneZoneSpaceManager()
updateZoningState()
Bring the zoning state of the scene up to date.
This will cause objects that have moved or have been resized to be rezoned and will updated regions of the scene that had their zoning setup changed.
note:This method depends on proper use of notifyObjectChanged().