Graphics/Light: Add cache infos (cosines, tangent) + inline
Former-commit-id: 36e6fb9c2d09597480302da30d3097ec54582fe8
This commit is contained in:
@@ -34,8 +34,12 @@ class NAZARA_API NzLight : public NzRenderable
|
||||
NzColor GetColor() const;
|
||||
float GetDiffuseFactor() const;
|
||||
float GetInnerAngle() const;
|
||||
float GetInnerAngleCosine() const;
|
||||
float GetInvRadius() const;
|
||||
nzLightType GetLightType() const;
|
||||
float GetOuterAngle() const;
|
||||
float GetOuterAngleCosine() const;
|
||||
float GetOuterAngleTangent() const;
|
||||
float GetRadius() const;
|
||||
|
||||
void SetAmbientFactor(float factor);
|
||||
@@ -60,7 +64,11 @@ class NAZARA_API NzLight : public NzRenderable
|
||||
float m_attenuation;
|
||||
float m_diffuseFactor;
|
||||
float m_innerAngle;
|
||||
float m_innerAngleCosine;
|
||||
float m_invRadius;
|
||||
float m_outerAngle;
|
||||
float m_outerAngleCosine;
|
||||
float m_outerAngleTangent;
|
||||
float m_radius;
|
||||
};
|
||||
|
||||
@@ -85,4 +93,6 @@ struct NzLightUniforms
|
||||
};
|
||||
};
|
||||
|
||||
#include <Nazara/Graphics/Light.inl>
|
||||
|
||||
#endif // NAZARA_LIGHT_HPP
|
||||
|
||||
92
include/Nazara/Graphics/Light.inl
Normal file
92
include/Nazara/Graphics/Light.inl
Normal file
@@ -0,0 +1,92 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
inline float NzLight::GetAmbientFactor() const
|
||||
{
|
||||
return m_ambientFactor;
|
||||
}
|
||||
|
||||
inline float NzLight::GetAttenuation() const
|
||||
{
|
||||
return m_attenuation;
|
||||
}
|
||||
|
||||
inline NzColor NzLight::GetColor() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
||||
inline float NzLight::GetDiffuseFactor() const
|
||||
{
|
||||
return m_diffuseFactor;
|
||||
}
|
||||
|
||||
inline float NzLight::GetInnerAngle() const
|
||||
{
|
||||
return m_innerAngle;
|
||||
}
|
||||
|
||||
inline nzLightType NzLight::GetLightType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
inline float NzLight::GetOuterAngle() const
|
||||
{
|
||||
return m_outerAngle;
|
||||
}
|
||||
|
||||
inline float NzLight::GetRadius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
inline void NzLight::SetAmbientFactor(float factor)
|
||||
{
|
||||
m_ambientFactor = factor;
|
||||
}
|
||||
|
||||
inline void NzLight::SetAttenuation(float attenuation)
|
||||
{
|
||||
m_attenuation = attenuation;
|
||||
}
|
||||
|
||||
inline void NzLight::SetColor(const NzColor& color)
|
||||
{
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
inline void NzLight::SetDiffuseFactor(float factor)
|
||||
{
|
||||
m_diffuseFactor = factor;
|
||||
}
|
||||
|
||||
inline void NzLight::SetInnerAngle(float innerAngle)
|
||||
{
|
||||
m_innerAngle = innerAngle;
|
||||
m_innerAngleCosine = std::cos(NzDegreeToRadian(m_innerAngle));
|
||||
}
|
||||
|
||||
inline void NzLight::SetLightType(nzLightType type)
|
||||
{
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
inline void NzLight::SetOuterAngle(float outerAngle)
|
||||
{
|
||||
m_outerAngle = outerAngle;
|
||||
m_outerAngleCosine = std::cos(NzDegreeToRadian(m_outerAngle));
|
||||
m_outerAngleTangent = std::tan(NzDegreeToRadian(m_outerAngle));
|
||||
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
inline void NzLight::SetRadius(float radius)
|
||||
{
|
||||
m_radius = radius;
|
||||
|
||||
m_invRadius = 1.f / m_radius;
|
||||
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
Reference in New Issue
Block a user