![]() |
VISR
0.11.1
Versatile Interactive Scene Renderer
|
#include <object_channel_allocator.hpp>
Public Member Functions | |
ObjectChannelAllocator (std::size_t numChannels) | |
void | setObjects (std::vector< objectmodel::ObjectId > const &objectIds) |
std::size_t | maxChannels () const |
std::size_t | numberUsedChannels () const |
objectmodel::ObjectId | getObjectForChannel (std::size_t channelId) const |
Class to manage the allocation of a limited number of rendering resources (channels) to a potentially larger number of objects where only a subset of these objects are of a type that uses these channels. The main rationale is that the allocated channel for an object does not change as long as the object exists. Objects are represented by arbitrary, unique objects ids, while channels are denoted by a consecutive set of integers (starting at zero)
|
explicit |
Constructor, constructs an allocator objects with no channels allocated.
numChannels | The number of rendering resources (channels) |
objectmodel::ObjectId visr::rbbl::ObjectChannelAllocator::getObjectForChannel | ( | std::size_t | channelId | ) | const |
Retrieve the channel index for a given object id.
channelId | the logical channel id. |
objectmodel::cInvalidObjectId
if the channel is not allocated. std::invalid_argument | If channelId exceeds the number of rendering channels. |
|
inline |
Return the number of available rendering resources (channels) as set in the constructor.
std::size_t visr::rbbl::ObjectChannelAllocator::numberUsedChannels | ( | ) | const |
Return the number of currently allocated rendering resources (channels).
void visr::rbbl::ObjectChannelAllocator::setObjects | ( | std::vector< objectmodel::ObjectId > const & | objectIds | ) |
Set the set of used object ids. This function internally recomputes the allocation of channels to objects, taking the previous object set into account to keep the allocation for already existing objects unchanged. Allocations for previously existing objects not present in the current object set are removed.
objectIds | A vector containg the object ids of the current object set. |
invalid_argument | If the size of the object vector exceeds the maximum number of rendering resources (channels) |