47class VENOM_COMMON_API LightImpl :
public PluginObjectImpl,
public GraphicsPluginObject
53 vc::Error SetType(
const LightType type);
54 inline const LightType & GetLightType()
const {
return __lightType; }
55 inline void SetColor(
const vcm::Vec3 & color) { __color = color; }
56 inline const vcm::Vec3 & GetColor()
const {
return __color; }
57 inline void SetIntensity(
const float intensity) { __intensity = intensity; }
58 inline const float & GetIntensity()
const {
return __intensity; }
59 inline float * GetIntensityPtr() {
return &__intensity; }
60 inline void SetAngle(
const float angle) { __angle = angle; }
61 inline const float & GetAngle()
const {
return __angle; }
62 inline LightShaderStruct GetShaderStruct()
const {
return {__transform->GetPosition(), __lightType, __color, __intensity, GetDirection(), __angle}; }
63 inline vc::Error Reinit() {
return _SetType(__lightType); }
65 int GetCascadeIndex(
Camera *
const camera);
66 inline int GetLightIndexPerType()
const {
return _lightIndexPerType; }
68 vcm::Vec3 GetDirection()
const;
71 virtual vc::Error _SetType(
const LightType type) = 0;
72 virtual void _SetDescriptorsFromCascade(
const int cascadeIndex) = 0;
75 void __AllocateLightType();
76 void __DeallocateLightType();
79 int _lightIndexPerType;
84 LightType __lightType;
91class VENOM_COMMON_API Light :
public Component,
public PluginObjectImplWrapper
96 Light(
const Light & other);
97 Light & operator=(
const Light & other);
98 Light(Light && other)
noexcept;
99 Light & operator=(Light && other)
noexcept;
101 void Init(Entity entity)
override;
102 void Update(Entity entity)
override;
103 void _GUI(
const Entity entity)
override;
104 vc::String _GetComponentTitle()
override;
105 bool CanRemove(Entity entity)
override;
106 inline void SetType(
const LightType type) { _impl->As<
LightImpl>()->SetType(type); }
107 inline const LightType & GetLightType()
const {
return _impl->As<
LightImpl>()->GetLightType(); }
108 inline void SetColor(
const vcm::Vec3 & color) { _impl->As<
LightImpl>()->SetColor(color); }
109 inline const vcm::Vec3 & GetColor()
const {
return _impl->As<
LightImpl>()->GetColor(); }
110 inline void SetIntensity(
const float intensity) { _impl->As<
LightImpl>()->SetIntensity(intensity); }
111 inline const float & GetIntensity()
const {
return _impl->As<
LightImpl>()->GetIntensity(); }
112 inline float * GetIntensityPtr() {
return _impl->As<
LightImpl>()->GetIntensityPtr(); }
113 inline void SetAngle(
const float angle) { _impl->As<
LightImpl>()->SetAngle(angle); }
114 inline const float & GetAngle()
const {
return _impl->As<
LightImpl>()->GetAngle(); }
116 inline LightCascadedShadowMapConstantsStruct GetShadowMapConstantsStruct(
const int shadowMapIndex,
const int faceIndex,
Camera *
const camera, vcm::Vec3 * lightPos)
const {
return _impl->As<
LightImpl>()->GetShadowMapConstantsStruct(shadowMapIndex, faceIndex, camera, lightPos); }
118 static const size_t GetCountOfLights() {
return __lights.size(); }
119 static const vc::Vector<Light *> & GetLights() {
return __lights; }
120 static vc::Vector<Light *> & GetLightsMut() {
return __lights; }
122 static const size_t GetCountOfLightsOfType(
const LightType type);
125 static vc::Vector<Light *> __lights;