#include <ShadowMapManager.h>
|
class | ShadowMapHandle |
|
class | Renderer |
|
class | PipelineManager |
|
◆ ~ShadowMapManager()
ne::ShadowMapManager::~ShadowMapManager |
( |
| ) |
|
Makes sure that no resource exists.
◆ ShadowMapManager()
Initializes the manager.
- Parameters
-
pResourceManager | Resource manager that owns this object. |
vShadowMapArrayIndexManagers | Array index managers for various light source types |
◆ bindShadowMapsToAllPipelines()
std::optional< Error > ne::ShadowMapManager::bindShadowMapsToAllPipelines |
( |
| ) |
|
|
private |
Goes through all graphics pipelines ad binds shadow maps to pipelines that use them.
- Returns
- Error if something went wrong.
◆ bindShadowMapsToPipeline()
std::optional< Error > ne::ShadowMapManager::bindShadowMapsToPipeline |
( |
Pipeline * |
pPipeline | ) |
|
|
private |
Looks if the specified pipeline uses shadow maps and if uses binds shadow maps to the pipeline.
- Parameters
-
pPipeline | Pipeline to bind shadow maps to. |
- Returns
- Error if something went wrong.
◆ correctShadowMapResolutionForType()
unsigned int ne::ShadowMapManager::correctShadowMapResolutionForType |
( |
unsigned int |
iRenderSettingsShadowMapSize, |
|
|
ShadowMapType |
type |
|
) |
| |
|
private |
Returns shadow map texture size (in pixels) that should be used for the specified shadow map type. (the specified value might be corrected for the specified shadow map type).
- Parameters
-
iRenderSettingsShadowMapSize | Shadow map size from render settings. |
type | Shadow map size. |
- Returns
- Shadow map size to use for this shadow map type.
◆ create()
Creates a new shadow map manager.
- Parameters
-
pResourceManager | Resource manager that owns this object. |
- Returns
- Error if something went wrong, otherwise created shadow map manager.
◆ createShadowMap()
std::variant< std::unique_ptr< ShadowMapHandle >, Error > ne::ShadowMapManager::createShadowMap |
( |
const std::string & |
sResourceName, |
|
|
ShadowMapType |
type, |
|
|
const std::function< void(unsigned int)> & |
onArrayIndexChanged |
|
) |
| |
Creates a shadow map.
- Parameters
-
sResourceName | Name of the GPU resource that will be created, used for logging. |
type | Type of a shadow map to create depending on the light source type. |
onArrayIndexChanged | Called after the index of the returned shadow map into the descriptor array of shadow maps was initialized/changed. |
- Returns
- Error if something went wrong, otherwise created shadow map. Returning unique ptr although shadow map handle already behaves like unique ptr in order for the manager to be able to store raw pointers to handles without fearing that a raw pointer will point to invalid handle due to
move
ing the handle.
◆ getArrayIndexManagerBasedOnShadowMapType()
Returns pointer to one of the array index managers from mtxInternalResources depending on the specified shadow map type.
- Warning
- Do not delete (free) returned pointer.
- Parameters
-
type | Type of the shadow map to determine the manager. |
- Returns
nullptr
if specified not supported shadow map type, otherwise valid pointer.
◆ getDirectionalShadowMapsShaderResourceName()
static constexpr const char * ne::ShadowMapManager::getDirectionalShadowMapsShaderResourceName |
( |
| ) |
|
|
inlinestaticconstexpr |
Returns name of the shader resource (from shader code) that stores all directional light shadow maps.
- Returns
- Shader resource name.
◆ getInternalResources()
std::pair< std::recursive_mutex, InternalResources > * ne::ShadowMapManager::getInternalResources |
( |
| ) |
|
|
inline |
Returns internal resources of this manager.
- Warning
- Do not delete (free) returned pointer.
- Returns
- Internal resources.
◆ getPointShadowMapsShaderResourceName()
static constexpr const char * ne::ShadowMapManager::getPointShadowMapsShaderResourceName |
( |
| ) |
|
|
inlinestaticconstexpr |
Returns name of the shader resource (from shader code) that stores all point light shadow maps.
- Returns
- Shader resource name.
◆ getRenderer()
Renderer * ne::ShadowMapManager::getRenderer |
( |
| ) |
const |
◆ getShadowPassDepthBias()
int ne::ShadowMapManager::getShadowPassDepthBias |
( |
| ) |
|
|
static |
Constant depth bias (offset) to apply when rendering depth to shadow maps to avoid an effect known as "shadow acne" (stair-stepping).
- Returns
- Constant depth bias.
◆ getShadowPassDepthSlopeFactor()
float ne::ShadowMapManager::getShadowPassDepthSlopeFactor |
( |
| ) |
|
|
static |
Constant depth slope bias (multiplier) to apply when rendering depth to shadow maps to avoid an effect known as "shadow acne" (stair-stepping).
- Returns
- Constant depth slope factor.
◆ getSpotShadowMapsShaderResourceName()
static constexpr const char * ne::ShadowMapManager::getSpotShadowMapsShaderResourceName |
( |
| ) |
|
|
inlinestaticconstexpr |
Returns name of the shader resource (from shader code) that stores all spot light shadow maps.
- Returns
- Shader resource name.
◆ getVisibleDistanceToNearClipPlaneRatio()
static constexpr float ne::ShadowMapManager::getVisibleDistanceToNearClipPlaneRatio |
( |
| ) |
|
|
inlinestaticconstexpr |
Returns constant used to convert visible (non-clipped) distance to near clip plane for shadow mapping.
- Returns
- Far to near Z ratio.
◆ onShadowMapHandleBeingDestroyed()
void ne::ShadowMapManager::onShadowMapHandleBeingDestroyed |
( |
ShadowMapHandle * |
pHandleToResourceDestroy | ) |
|
|
private |
Called by destructor of shadow map handle to notify the manager that a resource is no longer used.
- Parameters
-
pHandleToResourceDestroy | Handle to resource to destroy. |
◆ recreateShadowMaps()
std::optional< Error > ne::ShadowMapManager::recreateShadowMaps |
( |
| ) |
|
|
private |
Called by the renderer to notify the manager that shadow quality setting was changed and all shadow maps should now be re-created using the new shadow map resolution.
- Returns
- Error if something went wrong.
◆ mtxInternalResources
std::pair<std::recursive_mutex, InternalResources> ne::ShadowMapManager::mtxInternalResources |
|
private |
◆ pDirectionalShadowMapsShaderResourceName
constexpr auto ne::ShadowMapManager::pDirectionalShadowMapsShaderResourceName = "directionalShadowMaps" |
|
staticconstexprprivate |
Name of the shader resource (from shader code) that stores all directional shadow maps.
◆ pPointShadowMapsShaderResourceName
constexpr auto ne::ShadowMapManager::pPointShadowMapsShaderResourceName = "pointShadowMaps" |
|
staticconstexprprivate |
Name of the shader resource (from shader code) that stores all point shadow maps.
◆ pResourceManager
Do not delete (free) this pointer. GPU resource manager that owns this object.
◆ pSpotShadowMapsShaderResourceName
constexpr auto ne::ShadowMapManager::pSpotShadowMapsShaderResourceName = "spotShadowMaps" |
|
staticconstexprprivate |
Name of the shader resource (from shader code) that stores all spot shadow maps.
◆ visibleDistanceToNearClipPlaneRatio
constexpr float ne::ShadowMapManager::visibleDistanceToNearClipPlaneRatio = 0.004F |
|
staticconstexprprivate |
Constant used to convert visible (non-clipped) distance to near clip plane for shadow mapping.
The documentation for this class was generated from the following files:
- src/engine_lib/private/render/general/resource/shadow/ShadowMapManager.h
- src/engine_lib/private/render/general/resource/shadow/ShadowMapManager.cpp