Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Components::DirectionalLight Class Reference

Runtime directional light component mirrored into ECS for renderer queries. More...

#include <DirectionalLightComponent.h>

Inheritance diagram for Engine::Components::DirectionalLight:
Collaboration diagram for Engine::Components::DirectionalLight:

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)
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
float getIntensity () const
bool isEnabled () const
bool castsShadows () const
float getAngularDiameterDegrees () const
const glm::vec3 & getDirectionOverride () const
bool hasDirectionOverride () const
void setColor (const glm::vec3 &color)
void setIntensity (float intensity)
void setEnabled (bool enabled)
void setCastsShadows (bool castsShadows)
void setAngularDiameterDegrees (float angularDiameterDegrees)
void setDirectionOverride (const glm::vec3 &direction)
void clearDirectionOverride ()
Public Member Functions inherited from Engine::Components::Logic
 Logic (Entities::Scene *owningScene)
virtual ~Logic ()=default
virtual void tick (double deltaTime)
 Called every frame if ticking is enabled.
bool hasBegunPlay () const
bool canTick () const
 Checks if the component is currently set to tick.
void setCanTick (bool enable)
 Enables or disables ticking for this component.
Entities::EntitygetOwningEntity () const
 Gets the entity this component belongs to.

Static Public Attributes

static constexpr bool IsUnique = true
static constexpr const char * ComponentName = "DirectionalLight"
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

void syncEcsData () const

Private Attributes

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::ScenegetScene () const
 Gets the scene this component belongs to.
Core::SceneManagergetSceneManager () const
 Helper to get the SceneManager from the owning scene.

Detailed Description

Runtime directional light component mirrored into ECS for renderer queries.

Definition at line 11 of file DirectionalLightComponent.h.

Constructor & Destructor Documentation

◆ DirectionalLight()

Engine::Components::DirectionalLight::DirectionalLight ( Entities::Scene * owningScene,
const glm::vec3 & color = glm::vec3(1.0f),
float intensity = 1.0f,
bool castsShadows = true,
float angularDiameterDegrees = 0.53f )
explicit

References castsShadows().

Here is the call graph for this function:

Member Function Documentation

◆ beginPlay()

void Engine::Components::DirectionalLight::beginPlay ( )
overridevirtual

Called when the component is added to the scene or the game starts.

Reimplemented from Engine::Components::Logic.

◆ castsShadows()

bool Engine::Components::DirectionalLight::castsShadows ( ) const
inlinenodiscard

Definition at line 33 of file DirectionalLightComponent.h.

References castsShadows_.

Referenced by DirectionalLight(), and setCastsShadows().

Here is the caller graph for this function:

◆ clearDirectionOverride()

void Engine::Components::DirectionalLight::clearDirectionOverride ( )

◆ endPlay()

void Engine::Components::DirectionalLight::endPlay ( )
overridevirtual

Called when the component is removed or the game ends.

Reimplemented from Engine::Components::Logic.

◆ getAngularDiameterDegrees()

float Engine::Components::DirectionalLight::getAngularDiameterDegrees ( ) const
inlinenodiscard

Definition at line 34 of file DirectionalLightComponent.h.

References angularDiameterDegrees_.

◆ getColor()

const glm::vec3 & Engine::Components::DirectionalLight::getColor ( ) const
inlinenodiscard

Definition at line 30 of file DirectionalLightComponent.h.

References color_.

◆ getComponentName()

std::string Engine::Components::DirectionalLight::getComponentName ( ) const
inlinenodiscardoverridevirtual

Gets the component type name for debugging/UI.

Returns
The component display name.

Reimplemented from Engine::Components::Logic.

Definition at line 25 of file DirectionalLightComponent.h.

References ComponentName.

◆ getDirectionOverride()

const glm::vec3 & Engine::Components::DirectionalLight::getDirectionOverride ( ) const
inlinenodiscard

Definition at line 35 of file DirectionalLightComponent.h.

References directionOverride_.

◆ getIntensity()

float Engine::Components::DirectionalLight::getIntensity ( ) const
inlinenodiscard

Definition at line 31 of file DirectionalLightComponent.h.

References intensity_.

◆ hasDirectionOverride()

bool Engine::Components::DirectionalLight::hasDirectionOverride ( ) const
inlinenodiscard

Definition at line 36 of file DirectionalLightComponent.h.

References hasDirectionOverride_.

◆ isEnabled()

bool Engine::Components::DirectionalLight::isEnabled ( ) const
inlinenodiscard

Definition at line 32 of file DirectionalLightComponent.h.

References enabled_.

◆ setAngularDiameterDegrees()

void Engine::Components::DirectionalLight::setAngularDiameterDegrees ( float angularDiameterDegrees)

◆ setCastsShadows()

void Engine::Components::DirectionalLight::setCastsShadows ( bool castsShadows)

References castsShadows().

Here is the call graph for this function:

◆ setColor()

void Engine::Components::DirectionalLight::setColor ( const glm::vec3 & color)

◆ setDirectionOverride()

void Engine::Components::DirectionalLight::setDirectionOverride ( const glm::vec3 & direction)

◆ setEnabled()

void Engine::Components::DirectionalLight::setEnabled ( bool enabled)

◆ setIntensity()

void Engine::Components::DirectionalLight::setIntensity ( float intensity)

◆ syncEcsData()

void Engine::Components::DirectionalLight::syncEcsData ( ) const
private

Member Data Documentation

◆ angularDiameterDegrees_

float Engine::Components::DirectionalLight::angularDiameterDegrees_ = 0.53f
private

Definition at line 55 of file DirectionalLightComponent.h.

Referenced by getAngularDiameterDegrees().

◆ castsShadows_

bool Engine::Components::DirectionalLight::castsShadows_ = true
private

Definition at line 52 of file DirectionalLightComponent.h.

Referenced by castsShadows().

◆ color_

glm::vec3 Engine::Components::DirectionalLight::color_ { 1.0f }
private

Definition at line 49 of file DirectionalLightComponent.h.

Referenced by getColor().

◆ ComponentName

const char* Engine::Components::DirectionalLight::ComponentName = "DirectionalLight"
staticconstexpr

Definition at line 15 of file DirectionalLightComponent.h.

Referenced by getComponentName().

◆ directionOverride_

glm::vec3 Engine::Components::DirectionalLight::directionOverride_ { 0.0f, -1.0f, 0.0f }
private

Definition at line 54 of file DirectionalLightComponent.h.

Referenced by getDirectionOverride().

◆ enabled_

bool Engine::Components::DirectionalLight::enabled_ = true
private

Definition at line 51 of file DirectionalLightComponent.h.

Referenced by isEnabled().

◆ hasDirectionOverride_

bool Engine::Components::DirectionalLight::hasDirectionOverride_ = false
private

Definition at line 53 of file DirectionalLightComponent.h.

Referenced by hasDirectionOverride().

◆ intensity_

float Engine::Components::DirectionalLight::intensity_ = 1.0f
private

Definition at line 50 of file DirectionalLightComponent.h.

Referenced by getIntensity().

◆ IsUnique

bool Engine::Components::DirectionalLight::IsUnique = true
staticconstexpr

Definition at line 14 of file DirectionalLightComponent.h.


The documentation for this class was generated from the following file: