struct
DirectionalShadowCasterComponent which enables shadow casting on a directional light.
Public functions
-
void updateShadowMaps(cubos::
core:: gl:: RenderDevice& rd) - Update shadow maps to the target size and target number of cascades.
- void setDefaultSplitDistances(int numCascades)
- Set splits to have the same distance between each other.
- auto getCurrentSplitDistances() const -> const std::vector<float>&
- Get the real current distances of each split.
- auto getCurrentSize() const -> glm::uvec2
- Get the real current size of shadow maps.
Public variables
- std::vector<float> splitDistances
- Target distance of each split from 0 to 1 (interpolated between nearDistance and maxDistance).
- float maxDistance
- Max distance (if 0, uses camera zFar).
- float nearDistance
- Near distance of shadow frustum (if 0, uses camera zNear).
-
std::unordered_map<core::
ecs:: Entity, std::shared_ptr<ShadowMap>, core:: ecs:: EntityHash> shadowMaps - Caster's shadow maps for each camera.
- glm::uvec2 size
- Target size of the shadow map textures, in pixels. Use this to change the resolution of the shadow maps. Note that the real resolution may not match this, as it may be dynamically adjusted.
Function documentation
void cubos:: engine:: DirectionalShadowCaster:: updateShadowMaps(cubos:: core:: gl:: RenderDevice& rd)
Update shadow maps to the target size and target number of cascades.
Parameters | |
---|---|
rd | Render device used to create the textures. |
void cubos:: engine:: DirectionalShadowCaster:: setDefaultSplitDistances(int numCascades)
Set splits to have the same distance between each other.
Parameters | |
---|---|
numCascades | Number of shadow map cascades. |
const std::vector<float>& cubos:: engine:: DirectionalShadowCaster:: getCurrentSplitDistances() const
Get the real current distances of each split.
Returns | Current distances of each split. |
---|
glm::uvec2 cubos:: engine:: DirectionalShadowCaster:: getCurrentSize() const
Get the real current size of shadow maps.
Returns | Size of the shadow map textures, in pixels. |
---|