![]() |
VR-Forces Developer's Guide
|
Manages the allocation of overlay groups. Overlay groups are used to determine the draw order of sprites on a 2D overlay. This manager configures overlay group sets and allocates group ids within those sets. The separate group sets allow for all overlay widgets of a specific type to be ordered above or below widgets of a different type. The allocation of different group IDs to each widget within a group ensures that the widget's different components don't fight to be on top. When the first call to nextGroupId( const std::string& ) is made, the configured sets are allocated id ranges, and further modifications to the group sets is prohibited.
Customizing block layout: subclass this manager, override layersPerBlock() to reserve extra slot space and layerSlot() to remap stock layers within the wider block. Register the subclass instance (DE-side registerFastInstance via the instance() substitution pattern, or before the driver's copyInstance runs) BEFORE the first allocation locks the manager. copyInstance propagates the subclass to connection clones through the virtual clone().

Classes | |
| class | DtOverlayGroupIdGenerator |
Public Types | |
| enum | OverlayGroupId { HiddenGroup = 0, DefaultGroup = 1, UnusedLowGroup = 2, GroupsGroup = 500000, UnusedHighGroup = 1000000 } |
| typedef std::list< std::string > | GroupRangeList |
Public Member Functions | |
| virtual DtOverlayGroupManager * | clone () |
| virtual | ~DtOverlayGroupManager () |
| void | initializeDefaultGroupSets () |
| virtual void | addOverlayGroupSet (const std::string &name) |
| virtual void | addOverlayGroupSetUnder (const std::string &name, const std::string &beforeName) |
| virtual void | addOverlayGroupSetAbove (const std::string &name, const std::string &afterName) |
| virtual const GroupRangeList & | overlayGroupSets () const |
| virtual GroupRangeList & | overlayGroupSets () |
| virtual unsigned int | nextGroupId (const std::string &groupSetName) |
| virtual unsigned int | acquireElementBlock (const DtElementID &elementId) |
| virtual void | releaseElementBlock (const DtElementID &elementId) |
| virtual unsigned int | elementGroupId (DtOverlayZone zone, unsigned int blockIndex, DtElementOverlayLayer layer) const |
| virtual unsigned int | layersPerBlock () const |
| virtual unsigned int | layerSlot (DtElementOverlayLayer layer) const |
| virtual void | setOverlayGroupSetSizeMultiplier (const std::string &name, unsigned int multiplier) |
| virtual unsigned int | blocksPerZone () const |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Static Public Member Functions | |
| static DtOverlayGroupManager & | instance (DtDe &de) |
| static DtOverlayGroupManager & | instance (DtBaseConnection &sim) |
| static void | copyInstance (DtBaseConnection &sim, DtDe &de) |
Protected Types | |
| using | ElementBlockMap = std::unordered_map< DtElementID, unsigned int > |
| using | GroupIdGeneratorList = std::unordered_map< std::string, DtOverlayGroupIdGenerator * > |
Protected Member Functions | |
| DtOverlayGroupManager () | |
| DtOverlayGroupManager (DtDe &de) | |
| DtOverlayGroupManager (const DtOverlayGroupManager ©) | |
| virtual void | initializeGroupIdGenerators () |
Protected Attributes | |
| GroupIdGeneratorList | myGroupIdGenerators |
| GroupRangeList | myOverlayGroupRanges |
| std::unordered_map < std::string, unsigned int > | myGroupSizeMultipliers |
| ElementBlockMap | myElementBlocks |
| std::set< unsigned int > | myFreeBlockIndices |
| unsigned int | myNextBlockIndex |
| bool | myBlockExhaustionWarned |
| unsigned int | myNormalZoneBase |
| unsigned int | mySelectedZoneBase |
| unsigned int | myMouseOverZoneBase |
| unsigned int | myBlocksPerZone |
| DtDe * | myOptionalDe |
| unsigned int | myNextGroupId |
| bool | myModificationsLockedFlag |
Friends | |
| template<typename ManagerClass > | |
| ManagerClass & | defaultManagerInstanceFunction (DtDe &, bool) |
| template<typename ManagerClass > | |
| void | defaultManagerRegisterInstanceFunction (DtDe &, ManagerClass *) |
| typedef std::list<std::string> makVrv::DtOverlayGroupManager::GroupRangeList |
List type for the names and order of configured overlay group sets.
|
protected |
Map type from element id to block allocation record.
|
protected |
Map type for mapping overlay group sets to their ID generators.
|
virtual |
Virtual DTOR.
|
protected |
Protected CTOR. (Use ::instance(..)).
|
protected |
Protected CTOR. (Use ::instance(..)).
|
protected |
Protected CTOR. (Use ::instance(..)).
|
static |
Instance method (for use in the main thread).
|
static |
Instance method (for use in the connection thread).
|
virtual |
Clone function so derived classes can be used with copyInstance.
|
static |
Create a copy of the de's overlay group manager for the base connection.
|
inline |
Initialization of the default group sets used by VR-Vantage. This method creates the default overlay group sets used by VR-Vantage. The default groups are (ordered from highest to lowest):
|
virtual |
Adds a new set of overlay groups with the given name. The new set is added under all other configured sets.
|
virtual |
Adds a new set of overlay groups below the specified set. The new set has the given name and is below the specified set but above all other sets below that one.
|
virtual |
Adds a new set of overlay groups above the specified set. The new set has the given name and is above the specified set but below all other sets above that one.
|
virtual |
Accessor for the list of configured overlay group sets (const). Sets towards the beginning of the list are lower on the overlay.
|
virtual |
Accessor for the list of configured overlay group sets. Sets towards the beginning of the list are lower on the overlay.
| DtCorruptedState | if modifications to the manager are locked. |
|
virtual |
Returns the next available group id for the given set. Obtains the group id generator for the set with the given name and returns the group id returned by the generator's nextGroupId() method. If a group set with the given name could not be found, OverlayGroupId::DefaultGroup (1) is returned.
|
virtual |
Acquires a per-entity overlay block for the given element. The first call for a given elementId allocates a fresh block index from the free list (or the next sequential index). Subsequent calls for the same elementId return the same index. Use elementGroupId() to convert a block index and layer into a overlay group id.
| elementId | the unique id of the entity element. |
|
virtual |
Releases the per-entity overlay block for the given element. The block index is returned to the free list. Calls for unknown element ids are ignored gracefully.
| elementId | the unique id of the entity element. |
|
virtual |
Converts a zone, block index, and layer into an overlay group id. Returns the group id used to draw a widget at the given layer within the given zone for the entity that owns blockIndex.
| zone | the state zone (Normal, Selected, or Hover). |
| blockIndex | the index returned by acquireElementBlock. |
| layer | the DtElementOverlayLayer slot within the block. |
Returns the number of overlay group slots per entity block. This is the block stride used when computing element group IDs. Subclasses may return a larger value to reserve room for custom layer slots above the stock LayerCount, provided the value is consistent with layerSlot().
|
virtual |
Maps a stock DtElementOverlayLayer to its slot offset within a block. The base implementation returns static_cast<unsigned int>(layer). Subclasses that widen the block (by overriding layersPerBlock) may remap stock layers to non-contiguous slot positions so custom layers can fill the gaps.
| layer | the DtElementOverlayLayer to map. |
|
virtual |
Sets the ID-range size multiplier for the named group set. Multiplies the number of group IDs allocated to the named set relative to a default set (multiplier 1). A set at multiplier 8 receives 8x the ID slots of a default set. Does not affect draw ordering, which comes solely from the set's position in the ordered list. Must be called before the first nextGroupId() or acquireElementBlock() call locks the manager.
| name | the name of the group set. |
| multiplier | ID-range size multiplier (default 1; zone sets use 8). |
Returns the number of entity blocks that fit within one zone.
|
protectedvirtual |
Initializes the group id generators for all configured sets. Ranges for the individual group sets are allocated based on the size multiplier of each set (default multiplier 1; zone sets use 8).
|
friend |
default Manager instance function. Manager requirements: 1) Static instance function 2) Protected DtSignalConnectionManager named myConnections. 3) Member functioned called loadDefaults which takes no arguments. and loads the default settings of the manager or factory from disk. 4) define defaultManagerInstanceFunction as friend. 5) define defaultManagerRegisterInstanceFunction as friend (see below). 5) Protected Constructor which only takes a DtDe reference.
Befriend the manager instance functions for instance retreival/creation.
Befriend the manager instance functions for instance retrieval/creation.
Then simply in the implementation of instance call defaultManagerInstanceFunction with the de object and return the return value.
|
friend |
Default implementation of how to register a manager, especially necessary when overriding the manager.
Befriend the manager instance functions for instance retreival/creation.
Befriend the manager instance functions for instance retrieval/creation.
|
protected |
|
protected |
|
protected |
Per-set ID-range size multipliers; unregistered sets default to 1.
|
protected |
Per-entity block allocations, keyed by DtElementID.
Recycled block indices awaiting reuse. std::set deduplicates double-releases and yields deterministic lowest-index-first reuse.
Next sequential block index to hand out when free list is empty.
|
protected |
True after the one-time block exhaustion warning has been emitted.
Base group id of the overlayZoneNormal range.
Base group id of the overlayZoneSelected range.
Base group id of the overlayZoneMouseOver range.
Number of entity blocks that fit within one zone.
|
protected |
|
protected |