83 lines
3.1 KiB
C++
83 lines
3.1 KiB
C++
#pragma once
|
|
|
|
#include <XCEngine/Components/Component.h>
|
|
#include <XCEngine/Core/Math/Color.h>
|
|
#include <XCEngine/Rendering/Shadow/DirectionalShadowSettings.h>
|
|
|
|
namespace XCEngine {
|
|
namespace Components {
|
|
|
|
enum class LightType {
|
|
Directional = 0,
|
|
Point,
|
|
Spot
|
|
};
|
|
|
|
class LightComponent : public Component {
|
|
public:
|
|
std::string GetName() const override { return "Light"; }
|
|
|
|
LightType GetLightType() const { return m_lightType; }
|
|
void SetLightType(LightType value) { m_lightType = value; }
|
|
|
|
const Math::Color& GetColor() const { return m_color; }
|
|
void SetColor(const Math::Color& value) { m_color = value; }
|
|
|
|
float GetIntensity() const { return m_intensity; }
|
|
void SetIntensity(float value);
|
|
|
|
float GetRange() const { return m_range; }
|
|
void SetRange(float value);
|
|
|
|
float GetSpotAngle() const { return m_spotAngle; }
|
|
void SetSpotAngle(float value);
|
|
|
|
bool GetCastsShadows() const { return m_castsShadows; }
|
|
void SetCastsShadows(bool value) { m_castsShadows = value; }
|
|
|
|
bool GetOverridesDirectionalShadowSettings() const { return m_overrideDirectionalShadowSettings; }
|
|
void SetOverridesDirectionalShadowSettings(bool value) { m_overrideDirectionalShadowSettings = value; }
|
|
|
|
const Rendering::DirectionalShadowSamplingSettings& GetDirectionalShadowSamplingSettings() const {
|
|
return m_directionalShadowSampling;
|
|
}
|
|
void SetDirectionalShadowSamplingSettings(const Rendering::DirectionalShadowSamplingSettings& value);
|
|
|
|
const Rendering::DirectionalShadowCasterBiasSettings& GetDirectionalShadowCasterBiasSettings() const {
|
|
return m_directionalShadowCasterBias;
|
|
}
|
|
void SetDirectionalShadowCasterBiasSettings(const Rendering::DirectionalShadowCasterBiasSettings& value);
|
|
|
|
float GetDirectionalShadowReceiverDepthBias() const { return m_directionalShadowSampling.receiverDepthBias; }
|
|
void SetDirectionalShadowReceiverDepthBias(float value);
|
|
|
|
float GetDirectionalShadowNormalBiasScale() const { return m_directionalShadowSampling.normalBiasScale; }
|
|
void SetDirectionalShadowNormalBiasScale(float value);
|
|
|
|
float GetDirectionalShadowStrength() const { return m_directionalShadowSampling.shadowStrength; }
|
|
void SetDirectionalShadowStrength(float value);
|
|
|
|
float GetDirectionalShadowDepthBiasFactor() const { return m_directionalShadowCasterBias.depthBiasFactor; }
|
|
void SetDirectionalShadowDepthBiasFactor(float value);
|
|
|
|
int GetDirectionalShadowDepthBiasUnits() const { return m_directionalShadowCasterBias.depthBiasUnits; }
|
|
void SetDirectionalShadowDepthBiasUnits(int value);
|
|
|
|
void Serialize(std::ostream& os) const override;
|
|
void Deserialize(std::istream& is) override;
|
|
|
|
private:
|
|
LightType m_lightType = LightType::Directional;
|
|
Math::Color m_color = Math::Color::White();
|
|
float m_intensity = 1.0f;
|
|
float m_range = 10.0f;
|
|
float m_spotAngle = 30.0f;
|
|
bool m_castsShadows = false;
|
|
bool m_overrideDirectionalShadowSettings = false;
|
|
Rendering::DirectionalShadowSamplingSettings m_directionalShadowSampling = {};
|
|
Rendering::DirectionalShadowCasterBiasSettings m_directionalShadowCasterBias = {};
|
|
};
|
|
|
|
} // namespace Components
|
|
} // namespace XCEngine
|