cubos::engine::ShadowAtlas class

Resource which stores the shadow map atlas, a large texture that holds the shadow maps for each shadow caster in a quadtree structure, reducing texture switching.

Public types

struct Slot
Slot for a shadow map in the shadow atlas.

Public functions

auto getSize() const -> glm::uvec2
Gets the size of the shadow atlas texture.
void resize(cubos::core::gl::RenderDevice& rd)
Recreates the shadow atlas texture.

Public variables

glm::uvec2 configSize
Configured size of the shadow atlas texture, in pixels. Use this to change the resolution of the atlas. Note that the texture isn't immediately resized; use getSize() to get the actual texture size.
bool cleared
Whether the shadow atlas texture has already been cleared this frame.
core::gl::Texture2D atlas
Stores shadow maps for each shadow caster component.
std::vector<std::shared_ptr<Slot>> slots
Stores the sizes, offsets, and caster ids of the shadow maps in the atlas.
std::map<int, std::shared_ptr<Slot>> slotsMap
Maps shadow caster ids to their corresponding slots.

Function documentation

glm::uvec2 cubos::engine::ShadowAtlas::getSize() const

Gets the size of the shadow atlas texture.

Returns Size of the shadow atlas texture, in pixels.

void cubos::engine::ShadowAtlas::resize(cubos::core::gl::RenderDevice& rd)

Recreates the shadow atlas texture.

Parameters
rd Render device used to create the texture.