Terminus
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
terminus::LightManager Class Reference

The LightManager class manages slots that can be filled with Light instances and is able to set those lights as a uniform array on a shader program. More...

#include <lightmanager.h>

Public Types

using ID = unsigned int
 

Public Member Functions

int freeSlots () const
 
ID add (const Light &light)
 Inserts a light in the next free slot. More...
 
Lightget (ID slot)
 
void remove (ID slot)
 mark the given slot as free and store the Light::nullLight in it More...
 
void setUniforms (Program &program) const
 sets the lights managed by this class as a uniform array More...
 

Static Public Attributes

static constexpr int slotCount = 8
 number of slots managed by this class More...
 

Protected Member Functions

ID getFreeSlot ()
 

Protected Attributes

Light m_lights [slotCount]
 
std::set< IDm_usedSlots
 

Detailed Description

The LightManager class manages slots that can be filled with Light instances and is able to set those lights as a uniform array on a shader program.

See also
Light

Member Typedef Documentation

using terminus::LightManager::ID = unsigned int

Member Function Documentation

LightManager::ID terminus::LightManager::add ( const Light light)

Inserts a light in the next free slot.

Parameters
light
Returns
the number of the slot that the light was inserted in

It is an invalid operation to call this method if freeSlots() == 0

int terminus::LightManager::freeSlots ( ) const
Returns
the number of yet unoccupied light slots
Light & terminus::LightManager::get ( LightManager::ID  id)
Parameters
slot
Returns
get a reference to the Light instance contained in a particular slot
LightManager::ID terminus::LightManager::getFreeSlot ( )
protected
void terminus::LightManager::remove ( LightManager::ID  slot)

mark the given slot as free and store the Light::nullLight in it

Parameters
slot
void terminus::LightManager::setUniforms ( Program program) const

sets the lights managed by this class as a uniform array

Parameters
program

Member Data Documentation

Light terminus::LightManager::m_lights[slotCount]
protected
std::set<ID> terminus::LightManager::m_usedSlots
protected
constexpr int terminus::LightManager::slotCount = 8
static

number of slots managed by this class


The documentation for this class was generated from the following files: