Graphics: Rework shadowing (add cascaded shadow mapping)
- Add support for per-viewer shadows - Add cascaded shadow mapping for directional lights (wip) - Rework the way lights are sent to the shaders (they are now selected once per viewer) - Fixes PointLight shadow mapping (using a dedicated pass) - Lights out of frustum for every viewers are no longer processed (wip)
This commit is contained in:
committed by
Jérôme Leclercq
parent
a08850946a
commit
9aebb4f745
42
include/Nazara/Graphics/DirectionalLightShadowData.inl
Normal file
42
include/Nazara/Graphics/DirectionalLightShadowData.inl
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <cassert>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline void DirectionalLightShadowData::EnableShadowStabilization(bool enable)
|
||||
{
|
||||
m_isShadowStabilizationEnabled = enable;
|
||||
}
|
||||
|
||||
inline std::size_t DirectionalLightShadowData::GetCascadeCount() const
|
||||
{
|
||||
return m_cascadeCount;
|
||||
}
|
||||
|
||||
inline void DirectionalLightShadowData::GetCascadeData(const AbstractViewer* viewer, SparsePtr<float> distance, SparsePtr<Matrix4f> viewProjMatrix) const
|
||||
{
|
||||
assert(viewer);
|
||||
PerViewerData& viewerData = *Retrieve(m_viewerData, viewer);
|
||||
|
||||
for (const auto& cascadeData : viewerData.cascades)
|
||||
{
|
||||
if (distance)
|
||||
*distance++ = cascadeData.distance;
|
||||
|
||||
if (viewProjMatrix)
|
||||
*viewProjMatrix++ = cascadeData.viewProjMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool DirectionalLightShadowData::IsShadowStabilization() const
|
||||
{
|
||||
return m_isShadowStabilizationEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Graphics/DebugOff.hpp>
|
||||
|
||||
Reference in New Issue
Block a user