- 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)
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
// 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 <Nazara/Graphics/PointLight.hpp>
|
|
#include <Nazara/Graphics/PointLightShadowData.hpp>
|
|
#include <Nazara/Graphics/Debug.hpp>
|
|
|
|
namespace Nz
|
|
{
|
|
float PointLight::ComputeContributionScore(const Frustumf& viewerFrustum) const
|
|
{
|
|
// TODO: take luminosity/radius into account
|
|
return viewerFrustum.GetPlane(FrustumPlane::Near).SignedDistance(m_position);
|
|
}
|
|
|
|
bool PointLight::FrustumCull(const Frustumf& viewerFrustum) const
|
|
{
|
|
return viewerFrustum.Intersect(Spheref(m_position, m_radius)) != IntersectionSide::Outside;
|
|
}
|
|
|
|
std::unique_ptr<LightShadowData> PointLight::InstanciateShadowData(FramePipeline& pipeline, ElementRendererRegistry& elementRegistry) const
|
|
{
|
|
return std::make_unique<PointLightShadowData>(pipeline, elementRegistry, *this);
|
|
}
|
|
|
|
void PointLight::UpdateTransform(const Vector3f& position, const Quaternionf& /*rotation*/, const Vector3f& /*scale*/)
|
|
{
|
|
UpdatePosition(position);
|
|
}
|
|
}
|