diff --git a/include/Nazara/3D/Light.hpp b/include/Nazara/3D/Light.hpp index 349e846e8..3eab48855 100644 --- a/include/Nazara/3D/Light.hpp +++ b/include/Nazara/3D/Light.hpp @@ -19,13 +19,14 @@ class NAZARA_API NzLight : public NzSceneNode NzLight(const NzLight& light); ~NzLight(); - void Apply(unsigned int i = 0) const; + void Apply(unsigned int unit) const; const NzAxisAlignedBox& GetAABB() const; NzColor GetAmbientColor() const; float GetAttenuation() const; NzColor GetDiffuseColor() const; float GetInnerAngle() const; + nzLightType GetLightType() const; float GetOuterAngle() const; float GetRadius() const; nzSceneNodeType GetSceneNodeType() const; diff --git a/src/Nazara/3D/Light.cpp b/src/Nazara/3D/Light.cpp index 350082c65..b59c0a998 100644 --- a/src/Nazara/3D/Light.cpp +++ b/src/Nazara/3D/Light.cpp @@ -10,6 +10,8 @@ #include #include +///TODO: Utilisation des UBOs + NzLight::NzLight(nzLightType type) : m_type(type), m_ambientColor((type == nzLightType_Directional) ? NzColor(50, 50, 50) : NzColor::Black), @@ -29,7 +31,7 @@ NzLight::NzLight(const NzLight& light) NzLight::~NzLight() = default; -void NzLight::Apply(unsigned int i) const +void NzLight::Apply(unsigned int unit) const { /* struct Light @@ -66,10 +68,10 @@ void NzLight::Apply(unsigned int i) const int parameters2Location = shader->GetUniformLocation("Lights[0].parameters2"); int parameters3Location = shader->GetUniformLocation("Lights[0].parameters3"); - if (i > 0) + if (unit > 0) { int type2Location = shader->GetUniformLocation("Lights[1].type"); - int offset = i * (type2Location - typeLocation); // type2Location - typeLocation donne la taille de la structure + int offset = unit * (type2Location - typeLocation); // type2Location - typeLocation donne la taille de la structure // On applique cet offset typeLocation += offset; @@ -133,6 +135,11 @@ float NzLight::GetInnerAngle() const return m_innerAngle; } +nzLightType NzLight::GetLightType() const +{ + return m_type; +} + float NzLight::GetOuterAngle() const { return m_outerAngle;