|
Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
|
Runtime directional light component mirrored into ECS for renderer queries. More...
#include <DirectionalLightComponent.h>
Public Member Functions | |
| DirectionalLight (Entities::Scene *owningScene, const glm::vec3 &color=glm::vec3(1.0f), float intensity=1.0f, bool castsShadows=true, float angularDiameterDegrees=0.53f) | |
| Creates a directional light component. | |
| std::string | getComponentName () const override |
| Gets the component type name for debugging/UI. | |
| void | beginPlay () override |
| Called when the component is added to the scene or the game starts. | |
| void | endPlay () override |
| Called when the component is removed or the game ends. | |
| const glm::vec3 & | getColor () const |
| Gets the light color multiplier. | |
| float | getIntensity () const |
| Gets the light intensity. | |
| bool | isEnabled () const |
| Checks whether this light is enabled for rendering. | |
| bool | castsShadows () const |
| Checks whether this light casts shadows. | |
| float | getAngularDiameterDegrees () const |
| Gets the apparent angular diameter used for light softness. | |
| const glm::vec3 & | getDirectionOverride () const |
| Gets the explicit light direction override. | |
| bool | hasDirectionOverride () const |
| Checks whether an explicit light direction override is active. | |
| const std::string & | getDebugName () const |
| Gets the optional debug name appended to the component name. | |
| const std::string & | getDisableReason () const |
| Gets the reason this light was disabled. | |
| bool | hasDisableReason () const |
| Checks whether a disable reason is set. | |
| void | setColor (const glm::vec3 &color) |
| Sets the light color multiplier and syncs ECS data. | |
| void | setIntensity (float intensity) |
| Sets the light intensity and syncs ECS data. | |
| void | setEnabled (bool enabled) |
| Enables or disables the light and syncs ECS data. | |
| void | setCastsShadows (bool castsShadows) |
| Enables or disables shadow casting and syncs ECS data. | |
| void | setAngularDiameterDegrees (float angularDiameterDegrees) |
| Sets the apparent angular diameter and syncs ECS data. | |
| void | setDirectionOverride (const glm::vec3 &direction) |
| Sets an explicit normalized light direction and syncs ECS data. | |
| void | clearDirectionOverride () |
| Clears the explicit light direction override and syncs ECS data. | |
| void | setDebugName (std::string name) |
| Sets the debug name appended to the component name. | |
| void | setDisableReason (std::string reason) |
| Sets the reason this light is disabled. | |
| void | clearDisableReason () |
| Clears the stored disable reason. | |
| Public Member Functions inherited from Engine::Components::Logic | |
| Logic (Entities::Scene *owningScene) | |
| Constructs a logic component owned by a scene. | |
| Logic (const Entities::SpawnContext &context) | |
| Constructs a logic component from spawn context data. | |
| virtual | ~Logic ()=default |
| Destroys the logic component. | |
| virtual bool | drawImGui () |
| Draws component-specific ImGui inspector controls. | |
| virtual bool | drawImGuiName () |
| Used to alter the name of the entity in the outliner. | |
| virtual void | tick (double deltaTime) |
| Called every frame if ticking is enabled. | |
| bool | hasBegunPlay () const |
| Checks whether beginPlay() has been called without a matching endPlay(). | |
| bool | canTick () const |
| Checks if the component is currently set to tick. | |
| void | setCanTick (bool enable) |
| Enables or disables ticking for this component. | |
| Entities::Entity * | getOwningEntity () const |
| Gets the entity this component belongs to. | |
Static Public Attributes | |
| static constexpr bool | IsUnique = true |
| Only one directional light may be active per entity. | |
| static constexpr const char * | ComponentName = "DirectionalLight" |
| Component type name. | |
| Static Public Attributes inherited from Engine::Components::Logic | |
| static constexpr bool | IsUnique = false |
| Defines whether multiple instances of this component can exist on the same entity. Defaults to false (multiple allowed). Override in derived classes with static constexpr bool IsUnique =
true; if needed. | |
| static constexpr const char * | ComponentName = "Logic" |
| Fallback component type name. Derived classes may override getComponentName() for custom labels. | |
Private Member Functions | |
| bool | hasActiveEnabledConflict () const |
| void | disableIfConflicting () |
| void | syncEcsData () const |
Private Attributes | |
| std::string | debugName_ |
| std::string | disableReason_ |
| glm::vec3 | color_ { 1.0f } |
| float | intensity_ = 1.0f |
| bool | enabled_ = true |
| bool | castsShadows_ = true |
| bool | hasDirectionOverride_ = false |
| glm::vec3 | directionOverride_ { 0.0f, -1.0f, 0.0f } |
| float | angularDiameterDegrees_ = 0.53f |
Additional Inherited Members | |
| Protected Member Functions inherited from Engine::Components::Logic | |
| Entities::Scene * | getScene () const |
| Gets the scene this component belongs to. | |
| Core::SceneManager * | getSceneManager () const |
| Helper to get the SceneManager from the owning scene. | |
Runtime directional light component mirrored into ECS for renderer queries.
Definition at line 13 of file DirectionalLightComponent.h.
|
explicit |
Creates a directional light component.
| owningScene | Scene that owns the component. |
| color | Light color multiplier. |
| intensity | Non-negative light intensity. |
| castsShadows | True when the light should cast shadows. |
| angularDiameterDegrees | Apparent angular diameter used for soft lighting. |
References castsShadows().
|
overridevirtual |
Called when the component is added to the scene or the game starts.
Reimplemented from Engine::Components::Logic.
|
inlinenodiscard |
Checks whether this light casts shadows.
Definition at line 62 of file DirectionalLightComponent.h.
References castsShadows_.
Referenced by DirectionalLight(), and setCastsShadows().
| void Engine::Components::DirectionalLight::clearDirectionOverride | ( | ) |
Clears the explicit light direction override and syncs ECS data.
| void Engine::Components::DirectionalLight::clearDisableReason | ( | ) |
Clears the stored disable reason.
|
private |
|
overridevirtual |
Called when the component is removed or the game ends.
Reimplemented from Engine::Components::Logic.
|
inlinenodiscard |
Gets the apparent angular diameter used for light softness.
Definition at line 68 of file DirectionalLightComponent.h.
References angularDiameterDegrees_.
|
inlinenodiscard |
Gets the light color multiplier.
Definition at line 44 of file DirectionalLightComponent.h.
References color_.
|
nodiscardoverridevirtual |
Gets the component type name for debugging/UI.
Reimplemented from Engine::Components::Logic.
|
inlinenodiscard |
Gets the optional debug name appended to the component name.
Definition at line 86 of file DirectionalLightComponent.h.
References debugName_.
|
inlinenodiscard |
Gets the explicit light direction override.
Definition at line 74 of file DirectionalLightComponent.h.
References directionOverride_.
|
inlinenodiscard |
Gets the reason this light was disabled.
Definition at line 92 of file DirectionalLightComponent.h.
References disableReason_.
|
inlinenodiscard |
Gets the light intensity.
Definition at line 50 of file DirectionalLightComponent.h.
References intensity_.
|
nodiscardprivate |
|
inlinenodiscard |
Checks whether an explicit light direction override is active.
Definition at line 80 of file DirectionalLightComponent.h.
References hasDirectionOverride_.
|
inlinenodiscard |
Checks whether a disable reason is set.
Definition at line 98 of file DirectionalLightComponent.h.
References disableReason_.
|
inlinenodiscard |
Checks whether this light is enabled for rendering.
Definition at line 56 of file DirectionalLightComponent.h.
References enabled_.
| void Engine::Components::DirectionalLight::setAngularDiameterDegrees | ( | float | angularDiameterDegrees | ) |
Sets the apparent angular diameter and syncs ECS data.
| angularDiameterDegrees | New angular diameter in degrees, clamped to a non-negative value. |
| void Engine::Components::DirectionalLight::setCastsShadows | ( | bool | castsShadows | ) |
Enables or disables shadow casting and syncs ECS data.
| castsShadows | True to cast shadows. |
References castsShadows().
| void Engine::Components::DirectionalLight::setColor | ( | const glm::vec3 & | color | ) |
Sets the light color multiplier and syncs ECS data.
| color | New RGB color. |
| void Engine::Components::DirectionalLight::setDebugName | ( | std::string | name | ) |
Sets the debug name appended to the component name.
| name | New debug name. |
| void Engine::Components::DirectionalLight::setDirectionOverride | ( | const glm::vec3 & | direction | ) |
Sets an explicit normalized light direction and syncs ECS data.
| direction | Direction to use instead of the owning node direction. |
| void Engine::Components::DirectionalLight::setDisableReason | ( | std::string | reason | ) |
Sets the reason this light is disabled.
| reason | New disable reason. |
| void Engine::Components::DirectionalLight::setEnabled | ( | bool | enabled | ) |
Enables or disables the light and syncs ECS data.
| enabled | True to enable the light. |
| void Engine::Components::DirectionalLight::setIntensity | ( | float | intensity | ) |
Sets the light intensity and syncs ECS data.
| intensity | New intensity, clamped to a non-negative value. |
|
private |
|
private |
Definition at line 171 of file DirectionalLightComponent.h.
Referenced by getAngularDiameterDegrees().
|
private |
Definition at line 168 of file DirectionalLightComponent.h.
Referenced by castsShadows().
|
private |
Definition at line 165 of file DirectionalLightComponent.h.
Referenced by getColor().
|
staticconstexpr |
Component type name.
Definition at line 17 of file DirectionalLightComponent.h.
|
private |
Definition at line 163 of file DirectionalLightComponent.h.
Referenced by getDebugName().
|
private |
Definition at line 170 of file DirectionalLightComponent.h.
Referenced by getDirectionOverride().
|
private |
Definition at line 164 of file DirectionalLightComponent.h.
Referenced by getDisableReason(), and hasDisableReason().
|
private |
Definition at line 167 of file DirectionalLightComponent.h.
Referenced by isEnabled().
|
private |
Definition at line 169 of file DirectionalLightComponent.h.
Referenced by hasDirectionOverride().
|
private |
Definition at line 166 of file DirectionalLightComponent.h.
Referenced by getIntensity().
|
staticconstexpr |
Only one directional light may be active per entity.
Definition at line 16 of file DirectionalLightComponent.h.