Add shadow mapping (wip)

This commit is contained in:
SirLynix
2022-11-07 02:16:02 +01:00
committed by Jérôme Leclercq
parent be9fba3190
commit 4a10c1f8fe
23 changed files with 333 additions and 44 deletions

View File

@@ -178,12 +178,21 @@ namespace Nz
inline void Camera::UpdateViewport(const Recti& viewport)
{
NazaraAssert(m_renderTarget, "no render target");
if (m_renderTarget)
{
// We compute the region necessary to make this view port with the actual size of the target
Vector2f invSize = 1.f / Vector2f(m_renderTarget->GetSize());
// We compute the region necessary to make this view port with the actual size of the target
Vector2f invSize = 1.f / Vector2f(m_renderTarget->GetSize());
UpdateTargetRegion(Rectf(invSize.x * viewport.x, invSize.y * viewport.y, invSize.x * viewport.width, invSize.y * viewport.height));
}
else
{
m_aspectRatio = float(viewport.width) / float(viewport.height);
m_viewport = viewport;
m_viewerInstance.UpdateTargetSize(Vector2f(viewport.GetLengths()));
UpdateTargetRegion(Rectf(invSize.x * viewport.x, invSize.y * viewport.y, invSize.x * viewport.width, invSize.y * viewport.height));
UpdateProjectionMatrix();
}
}
inline void Camera::UpdateSize(const Vector2f& size)