41 : IEventListener( sgn->sceneGraph()->GetECSEngine() ),
42 _castsShadows( false ),
44 _parentPool( parentPool ),
55 for (
U8 i = 0u; i < 6u; ++i )
88 rangeField.
_name =
"Range";
89 rangeField.
_data = &_range;
97 intensityField.
_name =
"Intensity";
98 intensityField.
_data = &_intensity;
106 colourField.
_name =
"Colour";
107 colourField.
_dataGetter = [
this](
void* dataOut )
noexcept
111 colourField.
_dataSetter = [
this](
const void* data )
noexcept
121 castsShadowsField.
_name =
"Is Shadow Caster";
122 castsShadowsField.
_data = &_castsShadows;
129 shadowBiasField.
_name =
"Shadow Bias";
133 shadowBiasField.
_format =
"%.5f";
139 shadowStrengthField.
_name =
"Shadow Strength";
148 lightTagField.
_name =
"Light Tag Value";
149 lightTagField.
_data = &_tag;
163 assert( tComp !=
nullptr );
165 bool transformChanged =
false;
169 transformChanged =
true;
175 transformChanged =
true;
178 if ( transformChanged )
180 staticShadowsDirty(
true );
181 dynamicShadowsDirty(
true );
190 _boundingVolume.setCenter( playerCamera->
snapshot().
_eye );
191 _boundingVolume.setRadius( range() );
194 _boundingVolume.setCenter( positionCache() );
195 _boundingVolume.setRadius( range() );
200 const F32 radius = angle > M_PI_4 ? range() * tan( angle ) : range() * 0.5f / pow( cos( angle ), 2.0f );
201 const vec3<F32> position = positionCache() + directionCache() * radius;
203 _boundingVolume.setCenter( position );
204 _boundingVolume.setRadius( radius );
214 _colour.rgb = newDiffuseColour;
#define PROFILE_SCOPE_AUTO(CATEGORY)
const CameraSnapshot & snapshot() const noexcept
Returns the internal camera snapshot data (eye, orientation, etc)
void registerField(EditorComponentField &&field)
ShadowProperties _shadowProperties
virtual void updateBoundingVolume(const Camera *playerCamera)
void setDiffuseColour(const UColour3 &newDiffuseColour) noexcept
const LightType & getLightType() const noexcept
Get the light type. (see LightType enum)
FColour3 getDiffuseColour() const noexcept
void updateCache(const ECS::CustomEvent &event)
void registerFields(EditorComponent &comp)
virtual ~Light() override
Light(SceneGraphNode *sgn, F32 range, LightType type, LightPool &parentPool)
Create a new light assigned to the specified slot with the specified range.
bool removeLight(const Light &light)
remove a light from the manager
bool addLight(Light &light)
Add a new light to the manager.
FORCE_INLINE T * get() const
Returns a pointer to a specific component. Returns null if the SGN does not have the component reques...
void UnregisterAllEventCallbacks()
constexpr T DegreesToRadians(T angleDegrees) noexcept
Return the radian equivalent of the given degree value.
FColour4 WHITE
Random stuff added for convenience.
static constexpr const char * lightType[]
constexpr Optick::Category::Type Scene
const char * LightTypeToString(LightType lightType) noexcept
LightType StringToLightType(const string &name)
Handle console commands that start with a forward slash.
constexpr U32 to_U32(const T value)
constexpr F32 to_F32(const T value)
constexpr F32 EPSILON_F32
LightType
The different types of lights supported.
SceneGraphNode * _flag[2]
constexpr U8 to_U8(const T value)
constexpr auto to_base(const Type value) -> Type
DELEGATE_STD< void, void * > _dataGetter
DELEGATE_STD< void, const void * > _dataSetter
vec2< F32 > _range
Used by slider_type as a min / max range or dropdown as selected_index / count.
PushConstantType _basicType
EditorComponentFieldType _type
vec4< F32 > _lightDetails
std::array< vec4< F32 >, 6 > _lightPosition
light's position in world space. w - csm split distances (or whatever else might be needed)
std::array< mat4< F32 >, 6 > _lightVP
light viewProjection matrices