Graphics/RenderQueue: Replace AddLight method by variations
Former-commit-id: 79ad49d60bd8d397aa606cded7c0dd2d20a078dc
This commit is contained in:
@@ -6,3 +6,25 @@
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
|
||||
NzAbstractRenderQueue::~NzAbstractRenderQueue() = default;
|
||||
|
||||
void NzAbstractRenderQueue::AddDirectionalLight(const NzColor& color, float ambientFactor, float diffuseFactor, const NzVector3f& direction)
|
||||
{
|
||||
m_directionalLights.push_back(DirectionalLight{color, direction, ambientFactor, diffuseFactor});
|
||||
}
|
||||
|
||||
void NzAbstractRenderQueue::AddPointLight(const NzColor& color, float ambientFactor, float diffuseFactor, const NzVector3f& position, float radius, float attenuation)
|
||||
{
|
||||
m_pointLights.push_back(PointLight{color, position, ambientFactor, attenuation, diffuseFactor, radius});
|
||||
}
|
||||
|
||||
void NzAbstractRenderQueue::AddSpotLight(const NzColor& color, float ambientFactor, float diffuseFactor, const NzVector3f& position, const NzVector3f& direction, float radius, float attenuation, float innerAngle, float outerAngle)
|
||||
{
|
||||
m_spotLights.push_back(SpotLight{color, direction, position, ambientFactor, attenuation, diffuseFactor, innerAngle, outerAngle, radius});
|
||||
}
|
||||
|
||||
void NzAbstractRenderQueue::Clear(bool fully)
|
||||
{
|
||||
m_directionalLights.clear();
|
||||
m_pointLights.clear();
|
||||
m_spotLights.clear();
|
||||
}
|
||||
|
||||
@@ -75,37 +75,6 @@ void NzDeferredRenderQueue::AddDrawable(const NzDrawable* drawable)
|
||||
m_forwardQueue->AddDrawable(drawable);
|
||||
}
|
||||
|
||||
void NzDeferredRenderQueue::AddLight(const NzLight* light)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!light)
|
||||
{
|
||||
NazaraError("Invalid light");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// On trie la lumière (elles sont traitées différement selon leur type)
|
||||
switch (light->GetLightType())
|
||||
{
|
||||
case nzLightType_Directional:
|
||||
directionalLights.push_back(light);
|
||||
break;
|
||||
|
||||
case nzLightType_Point:
|
||||
pointLights.push_back(light);
|
||||
break;
|
||||
|
||||
case nzLightType_Spot:
|
||||
spotLights.push_back(light);
|
||||
break;
|
||||
}
|
||||
|
||||
// On envoie également la lumière au forward-shading
|
||||
///TODO: Possibilité pour une lumière de se réserver au Deferred Shading
|
||||
m_forwardQueue->AddLight(light);
|
||||
}
|
||||
|
||||
void NzDeferredRenderQueue::AddMesh(const NzMaterial* material, const NzMeshData& meshData, const NzBoxf& meshAABB, const NzMatrix4f& transformMatrix)
|
||||
{
|
||||
if (material->IsEnabled(nzRendererParameter_Blend))
|
||||
@@ -154,9 +123,7 @@ void NzDeferredRenderQueue::AddSprites(const NzMaterial* material, const NzVerte
|
||||
|
||||
void NzDeferredRenderQueue::Clear(bool fully)
|
||||
{
|
||||
directionalLights.clear();
|
||||
pointLights.clear();
|
||||
spotLights.clear();
|
||||
NzAbstractRenderQueue::Clear(fully);
|
||||
|
||||
if (fully)
|
||||
opaqueModels.clear();
|
||||
|
||||
@@ -370,34 +370,6 @@ void NzForwardRenderQueue::AddDrawable(const NzDrawable* drawable)
|
||||
otherDrawables.push_back(drawable);
|
||||
}
|
||||
|
||||
void NzForwardRenderQueue::AddLight(const NzLight* light)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
if (!light)
|
||||
{
|
||||
NazaraError("Invalid light");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (light->GetLightType())
|
||||
{
|
||||
case nzLightType_Directional:
|
||||
directionalLights.push_back(light);
|
||||
break;
|
||||
|
||||
case nzLightType_Point:
|
||||
case nzLightType_Spot:
|
||||
lights.push_back(light);
|
||||
break;
|
||||
|
||||
#ifdef NAZARA_DEBUG
|
||||
default:
|
||||
NazaraError("Light type not handled (0x" + NzString::Number(light->GetLightType(), 16) + ')');
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void NzForwardRenderQueue::AddMesh(const NzMaterial* material, const NzMeshData& meshData, const NzBoxf& meshAABB, const NzMatrix4f& transformMatrix)
|
||||
{
|
||||
if (material->IsEnabled(nzRendererParameter_Blend))
|
||||
@@ -481,8 +453,8 @@ void NzForwardRenderQueue::AddSprites(const NzMaterial* material, const NzVertex
|
||||
|
||||
void NzForwardRenderQueue::Clear(bool fully)
|
||||
{
|
||||
directionalLights.clear();
|
||||
lights.clear();
|
||||
NzAbstractRenderQueue::Clear(fully);
|
||||
|
||||
otherDrawables.clear();
|
||||
transparentModels.clear();
|
||||
transparentModelData.clear();
|
||||
|
||||
Reference in New Issue
Block a user