Graphics: Add light type
This commit is contained in:
@@ -3,12 +3,14 @@
|
|||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Graphics/DirectionalLight.hpp>
|
#include <Nazara/Graphics/DirectionalLight.hpp>
|
||||||
|
#include <Nazara/Graphics/Enums.hpp>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <Nazara/Graphics/Debug.hpp>
|
#include <Nazara/Graphics/Debug.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline DirectionalLight::DirectionalLight() :
|
inline DirectionalLight::DirectionalLight() :
|
||||||
|
Light(SafeCast<UInt8>(BasicLightType::Directional)),
|
||||||
m_color(Color::White),
|
m_color(Color::White),
|
||||||
m_ambientFactor(0.2f),
|
m_ambientFactor(0.2f),
|
||||||
m_diffuseFactor(1.f)
|
m_diffuseFactor(1.f)
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ namespace Nz
|
|||||||
Max = Spot
|
Max = Spot
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr std::size_t BasicLightTypeCount = UnderlyingCast(BasicLightType::Max) + 1;
|
||||||
|
|
||||||
enum class BasicRenderElement
|
enum class BasicRenderElement
|
||||||
{
|
{
|
||||||
SpriteChain = 0,
|
SpriteChain = 0,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Nz
|
|||||||
class NAZARA_GRAPHICS_API Light
|
class NAZARA_GRAPHICS_API Light
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline Light();
|
inline Light(UInt8 lightType);
|
||||||
Light(const Light&) = delete;
|
Light(const Light&) = delete;
|
||||||
Light(Light&&) noexcept = default;
|
Light(Light&&) noexcept = default;
|
||||||
virtual ~Light();
|
virtual ~Light();
|
||||||
@@ -34,6 +34,7 @@ namespace Nz
|
|||||||
virtual void FillLightData(void* data) const = 0;
|
virtual void FillLightData(void* data) const = 0;
|
||||||
|
|
||||||
inline const BoundingVolumef& GetBoundingVolume() const;
|
inline const BoundingVolumef& GetBoundingVolume() const;
|
||||||
|
inline UInt8 GetLightType() const;
|
||||||
|
|
||||||
virtual void UpdateTransform(const Vector3f& position, const Quaternionf& rotation, const Vector3f& scale) = 0;
|
virtual void UpdateTransform(const Vector3f& position, const Quaternionf& rotation, const Vector3f& scale) = 0;
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ namespace Nz
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BoundingVolumef m_boundingVolume;
|
BoundingVolumef m_boundingVolume;
|
||||||
|
UInt8 m_lightType;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,9 @@
|
|||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline Light::Light() :
|
inline Light::Light(UInt8 lightType) :
|
||||||
m_boundingVolume(BoundingVolumef::Null())
|
m_boundingVolume(BoundingVolumef::Null()),
|
||||||
|
m_lightType(lightType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,6 +19,11 @@ namespace Nz
|
|||||||
return m_boundingVolume;
|
return m_boundingVolume;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline UInt8 Light::GetLightType() const
|
||||||
|
{
|
||||||
|
return m_lightType;
|
||||||
|
}
|
||||||
|
|
||||||
inline void Light::UpdateBoundingVolume(const BoundingVolumef& boundingVolume)
|
inline void Light::UpdateBoundingVolume(const BoundingVolumef& boundingVolume)
|
||||||
{
|
{
|
||||||
m_boundingVolume = boundingVolume;
|
m_boundingVolume = boundingVolume;
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Graphics/PointLight.hpp>
|
#include <Nazara/Graphics/PointLight.hpp>
|
||||||
|
#include <Nazara/Graphics/Enums.hpp>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <Nazara/Graphics/Debug.hpp>
|
#include <Nazara/Graphics/Debug.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline PointLight::PointLight() :
|
inline PointLight::PointLight() :
|
||||||
|
Light(SafeCast<UInt8>(BasicLightType::Point)),
|
||||||
m_color(Color::White),
|
m_color(Color::White),
|
||||||
m_position(Vector3f::Zero()),
|
m_position(Vector3f::Zero()),
|
||||||
m_ambientFactor(0.2f),
|
m_ambientFactor(0.2f),
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Graphics/SpotLight.hpp>
|
#include <Nazara/Graphics/SpotLight.hpp>
|
||||||
|
#include <Nazara/Graphics/Enums.hpp>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <Nazara/Graphics/Debug.hpp>
|
#include <Nazara/Graphics/Debug.hpp>
|
||||||
|
|
||||||
namespace Nz
|
namespace Nz
|
||||||
{
|
{
|
||||||
inline SpotLight::SpotLight() :
|
inline SpotLight::SpotLight() :
|
||||||
|
Light(SafeCast<UInt8>(BasicLightType::Spot)),
|
||||||
m_color(Color::White),
|
m_color(Color::White),
|
||||||
m_position(Vector3f::Zero()),
|
m_position(Vector3f::Zero()),
|
||||||
m_ambientFactor(0.2f),
|
m_ambientFactor(0.2f),
|
||||||
|
|||||||
Reference in New Issue
Block a user