Raftel Engine
 
Loading...
Searching...
No Matches
Raftel::LightComponent Struct Reference

Represents a light component with different light types. More...

#include <components.hpp>

Public Types

enum class  LightType { DIRECTIONAL , POINT , SPOT , AMBIENT }
 Enumeration of light types. More...
 

Public Member Functions

void CalculateShadowMatrix (const TransformComponent &tr, const class Camera &cam)
 Calculates the shadow matrix for the light.
 
void move (LightComponent &other)
 Moves the attributes of another LightComponent instance.
 
 LightComponent (LightType lt, glm::vec3 color_, float intensity_, float range_, float inner_, float outer_, glm::ivec2 screenSize)
 Constructs a light component with given parameters.
 

Public Attributes

enum Raftel::LightComponent::LightType type
 
glm::vec3 color
 
float intensity
 
float range
 
float innerCone
 
float outerCone
 
float near
 
float far
 
std::unique_ptr< ShadowMapshadowMap
 
float fov
 
std::vector< glm::mat4 > lightSpaceMatrix
 

Detailed Description

Represents a light component with different light types.

Definition at line 141 of file components.hpp.

Member Enumeration Documentation

◆ LightType

Enumeration of light types.

Enumerator
DIRECTIONAL 

Directional light (like sunlight).

POINT 

Point light emitting in all directions.

SPOT 

Spot light with an adjustable cone.

AMBIENT 

Ambient light affecting all objects equally.

Definition at line 145 of file components.hpp.

Constructor & Destructor Documentation

◆ LightComponent()

Raftel::LightComponent::LightComponent ( LightType lt,
glm::vec3 color_,
float intensity_,
float range_,
float inner_,
float outer_,
glm::ivec2 screenSize )

Constructs a light component with given parameters.

Parameters
ltType of the light.
color_Color of the light.
intensity_Intensity of the light.
range_Range of the light.
inner_Inner cone angle (for spotlights).
outer_Outer cone angle (for spotlights).
screenSizeThe screen size used for shadow mapping.

Member Function Documentation

◆ CalculateShadowMatrix()

void Raftel::LightComponent::CalculateShadowMatrix ( const TransformComponent & tr,
const class Camera & cam )

Calculates the shadow matrix for the light.

Parameters
trThe transform component of the light.
camThe camera reference.

◆ move()

void Raftel::LightComponent::move ( LightComponent & other)

Moves the attributes of another LightComponent instance.

Parameters
otherThe LightComponent to move from.

Member Data Documentation

◆ color

glm::vec3 Raftel::LightComponent::color

Color of the light.

Definition at line 152 of file components.hpp.

◆ far

float Raftel::LightComponent::far

Far plane distance for shadow mapping.

Definition at line 158 of file components.hpp.

◆ fov

float Raftel::LightComponent::fov

Field of view for spotlights.

Definition at line 174 of file components.hpp.

◆ innerCone

float Raftel::LightComponent::innerCone

Inner cone angle for spotlights.

Definition at line 155 of file components.hpp.

◆ intensity

float Raftel::LightComponent::intensity

Intensity of the light.

Definition at line 153 of file components.hpp.

◆ lightSpaceMatrix

std::vector<glm::mat4> Raftel::LightComponent::lightSpaceMatrix

Shadow matrices.

Definition at line 175 of file components.hpp.

◆ near

float Raftel::LightComponent::near

Near plane distance for shadow mapping.

Definition at line 157 of file components.hpp.

◆ outerCone

float Raftel::LightComponent::outerCone

Outer cone angle for spotlights.

Definition at line 156 of file components.hpp.

◆ range

float Raftel::LightComponent::range

Range for point and spotlights.

Definition at line 154 of file components.hpp.

◆ shadowMap

std::unique_ptr<ShadowMap> Raftel::LightComponent::shadowMap

Shadow map associated with the light.

Definition at line 159 of file components.hpp.

◆ type

enum Raftel::LightComponent::LightType Raftel::LightComponent::type

Type of the light.


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