DrawableGroup class
#include <esp/gfx/DrawableGroup.h>
Group of drawables, and shared group parameters.
Constructors, destructors, conversion operators
- ~DrawableGroup() override
Public functions
- auto add(Drawable& drawable) -> DrawableGroup&
- Add a drawable to the group.
- auto remove(Drawable& drawable) -> DrawableGroup&
- Remove a drawable from the group.
-
auto hasDrawable(uint64_
t id) const -> bool - Given drawable id, returns if drawable is in the group.
-
auto getDrawable(uint64_
t id) const -> Drawable* - Given drawable id, returns nullptr if the id is not in this drawable group, otherwise the raw pointer to the object.
- auto prepareForDraw(const RenderCamera&) -> bool virtual
- Prepare to draw group with given RenderCamera.
Protected functions
- auto registerDrawable(Drawable& drawable) -> bool
- Add the drawable to the lookup table, and update the state in the drawable.
- auto unregisterDrawable(Drawable& drawable) -> bool
- Remove the drawable from the lookup table, and update the state in the drawable.
Protected variables
Function documentation
DrawableGroup& esp:: gfx:: DrawableGroup:: add(Drawable& drawable)
Add a drawable to the group.
| Returns | Reference to self (for method chaining) |
|---|
If the drawable is part of another group, it is removed from it.
DrawableGroup& esp:: gfx:: DrawableGroup:: remove(Drawable& drawable)
Remove a drawable from the group.
| Returns | Reference to self (for method chaining) |
|---|
The feature must be part of the group.
bool esp:: gfx:: DrawableGroup:: hasDrawable(uint64_ t id) const
Given drawable id, returns if drawable is in the group.
| Parameters | |
|---|---|
| id | drawable id |
| Returns | true if the drawable is in the group, otherwise false |
Drawable* esp:: gfx:: DrawableGroup:: getDrawable(uint64_ t id) const
Given drawable id, returns nullptr if the id is not in this drawable group, otherwise the raw pointer to the object.
| Parameters | |
|---|---|
| id | drawable id |
| Returns | raw pointer to the drawable, or nullptr |
bool esp:: gfx:: DrawableGroup:: prepareForDraw(const RenderCamera&) virtual
Prepare to draw group with given RenderCamera.
| Returns | Whether the DrawableGroup is in a valid state to be drawn |
|---|
bool esp:: gfx:: DrawableGroup:: registerDrawable(Drawable& drawable) protected
Add the drawable to the lookup table, and update the state in the drawable.
| Returns | return true, if the drawable was newly registered, otherwise false |
|---|
bool esp:: gfx:: DrawableGroup:: unregisterDrawable(Drawable& drawable) protected
Remove the drawable from the lookup table, and update the state in the drawable.
| Returns | return true, if the drawable was in the group, otherwise false |
|---|
Variable documentation
std:: unordered_map<uint64_ t, Drawable*> esp:: gfx:: DrawableGroup:: idToDrawable_ protected
a lookup table, that maps a drawable id to the drawable object