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
@@ -31,6 +31,11 @@ namespace Nz
|
||||
return m_color;
|
||||
}
|
||||
|
||||
inline float SpotLight::GetDiffuseFactor() const
|
||||
{
|
||||
return m_diffuseFactor;
|
||||
}
|
||||
|
||||
inline const Vector3f& SpotLight::GetDirection() const
|
||||
{
|
||||
return m_direction;
|
||||
@@ -41,11 +46,31 @@ namespace Nz
|
||||
return m_innerAngle;
|
||||
}
|
||||
|
||||
inline float SpotLight::GetInnerAngleCos() const
|
||||
{
|
||||
return m_innerAngleCos;
|
||||
}
|
||||
|
||||
inline float SpotLight::GetInvRadius() const
|
||||
{
|
||||
return m_invRadius;
|
||||
}
|
||||
|
||||
inline RadianAnglef SpotLight::GetOuterAngle() const
|
||||
{
|
||||
return m_outerAngle;
|
||||
}
|
||||
|
||||
inline float SpotLight::GetOuterAngleCos() const
|
||||
{
|
||||
return m_outerAngleCos;
|
||||
}
|
||||
|
||||
inline float SpotLight::GetOuterAngleTan() const
|
||||
{
|
||||
return m_outerAngleTan;
|
||||
}
|
||||
|
||||
inline const Vector3f& SpotLight::GetPosition() const
|
||||
{
|
||||
return m_position;
|
||||
@@ -56,16 +81,16 @@ namespace Nz
|
||||
return m_rotation;
|
||||
}
|
||||
|
||||
inline float SpotLight::GetDiffuseFactor() const
|
||||
{
|
||||
return m_diffuseFactor;
|
||||
}
|
||||
|
||||
inline float SpotLight::GetRadius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
inline const Matrix4f& SpotLight::GetViewProjMatrix() const
|
||||
{
|
||||
return m_viewProjMatrix;
|
||||
}
|
||||
|
||||
inline void SpotLight::UpdateAmbientFactor(float factor)
|
||||
{
|
||||
m_ambientFactor = factor;
|
||||
@@ -164,10 +189,10 @@ namespace Nz
|
||||
|
||||
inline void SpotLight::UpdateViewProjMatrix()
|
||||
{
|
||||
Matrix4f biasMatrix(0.5f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.5f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.5f, 0.5f, 0.0f, 1.0f);
|
||||
constexpr Matrix4f biasMatrix(0.5f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.5f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.5f, 0.5f, 0.0f, 1.0f);
|
||||
|
||||
Matrix4f projection = Matrix4f::Perspective(m_outerAngle * 2.f, 1.f, 0.01f, m_radius);
|
||||
Matrix4f view = Matrix4f::TransformInverse(m_position, m_rotation);
|
||||
|
||||
Reference in New Issue
Block a user