Added Light::GetLightType
Former-commit-id: 22739eaaed4daf0651860c34af30bbfad87f538f
This commit is contained in:
parent
85c3224752
commit
861c1b6a38
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
#include <cstring>
|
||||
#include <Nazara/3D/Debug.hpp>
|
||||
|
||||
///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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue