Terminus
lightmanager.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <set>
4 
5 #include <QVector3D>
6 
7 #include <world/light.h>
8 
9 namespace terminus
10 {
11 
12 class Program;
13 
22 {
23 public:
24  using ID = unsigned int;
25 
29  static constexpr int slotCount = 8;
30 
34  int freeSlots() const;
35 
43  ID add(const Light & light);
44 
50  Light & get(ID slot);
51 
56  void remove(ID slot);
57 
62  void setUniforms(Program & program) const;
63 
64 protected:
65  ID getFreeSlot();
66 
67 protected:
69 
70  std::set<ID> m_usedSlots;
71 };
72 
73 } //namespace terminus
static constexpr int slotCount
number of slots managed by this class
Definition: lightmanager.h:29
void setUniforms(Program &program) const
sets the lights managed by this class as a uniform array
Definition: lightmanager.cpp:34
ID getFreeSlot()
Definition: lightmanager.cpp:39
unsigned int ID
Definition: lightmanager.h:24
Light m_lights[slotCount]
Definition: lightmanager.h:68
The LightManager class manages slots that can be filled with Light instances and is able to set those...
Definition: lightmanager.h:21
ID add(const Light &light)
Inserts a light in the next free slot.
Definition: lightmanager.cpp:15
The program class implements the basic functionality used for binding programs to openGL...
Definition: program.h:18
Definition: eventhandler.cpp:18
The Light class represents a light source with a packed, shader compatible memory layout...
Definition: light.h:15
std::set< ID > m_usedSlots
Definition: lightmanager.h:70
int freeSlots() const
Definition: lightmanager.cpp:10