Loading...
Searching...
No Matches
hellfire::LightComponent Class Reference

#include <LightComponent.h>

Inheritance diagram for hellfire::LightComponent:
Collaboration diagram for hellfire::LightComponent:

Public Types

enum  LightType { DIRECTIONAL , POINT , SPOT }
 

Public Member Functions

 LightComponent (const LightType type=DIRECTIONAL)
 
LightType get_light_type () const
 
void set_light_type (const LightType type)
 
void set_color (const glm::vec3 &color)
 
const glm::vec3 & get_color () const
 
void set_intensity (const float intensity)
 
const float & get_intensity () const
 
void set_direction (const float x, const float y, const float z)
 
void set_direction (const glm::vec3 &direction)
 
void set_cast_shadows (const bool cast_shadows)
 
bool should_cast_shadows () const
 
const glm::vec3 & get_direction ()
 
void look_at (const float x, const float y, const float z)
 
void look_at (const glm::vec3 &target)
 
void set_range (const float range)
 
float get_range () const
 
void set_attenuation (const float attenuation)
 
float get_attenuation () const
 
void set_inner_cone_angle (const float angle)
 
float get_inner_cone_angle () const
 
void set_outer_cone_angle (const float angle)
 
float get_outer_cone_angle () const
 
void upload_to_shader (Shader &shader, const int light_index) const
 
const glm::mat4 & get_light_view_proj_matrix () const
 
void set_light_view_proj_matrix (const glm::mat4 &lvpm)
 
- Public Member Functions inherited from hellfire::Component
virtual ~Component ()=default
 
Entityget_owner () const
 
virtual void on_added (Entity *owner)
 
virtual void on_removed ()
 

Private Member Functions

void upload_directional_to_shader (Shader &shader, const int light_index) const
 
void upload_point_to_shader (Shader &shader, const int light_index) const
 
void upload_spot_to_shader (Shader &shader, int light_index) const
 

Private Attributes

LightType type_ = DIRECTIONAL
 
glm::vec3 color_ = glm::vec3(1.0f)
 
float intensity_ = 1.0f
 
glm::vec3 direction_ = glm::vec3(0.0f, -1.0f, 0.0f)
 
float range_ = 10.0f
 
float attenuation_ = 1.0f
 
float inner_cone_angle_ = 30.0f
 
float outer_cone_angle_ = 45.0f
 
glm::mat4 light_view_proj_matrix = glm::mat4(1.0f)
 
bool cast_shadows_ = true
 

Detailed Description

Definition at line 19 of file LightComponent.h.

Member Enumeration Documentation

◆ LightType

Enumerator
DIRECTIONAL 
POINT 
SPOT 

Definition at line 21 of file LightComponent.h.

Constructor & Destructor Documentation

◆ LightComponent()

hellfire::LightComponent::LightComponent ( const LightType  type = DIRECTIONAL)
inlineexplicit

Definition at line 49 of file LightComponent.h.

Member Function Documentation

◆ get_attenuation()

float hellfire::LightComponent::get_attenuation ( ) const
inline

Definition at line 113 of file LightComponent.h.

◆ get_color()

const glm::vec3 & hellfire::LightComponent::get_color ( ) const
inline

Definition at line 58 of file LightComponent.h.

◆ get_direction()

const glm::vec3 & hellfire::LightComponent::get_direction ( )
inline

Definition at line 78 of file LightComponent.h.

◆ get_inner_cone_angle()

float hellfire::LightComponent::get_inner_cone_angle ( ) const
inline

Definition at line 117 of file LightComponent.h.

◆ get_intensity()

const float & hellfire::LightComponent::get_intensity ( ) const
inline

Definition at line 61 of file LightComponent.h.

◆ get_light_type()

LightType hellfire::LightComponent::get_light_type ( ) const
inline

Definition at line 53 of file LightComponent.h.

◆ get_light_view_proj_matrix()

const glm::mat4 & hellfire::LightComponent::get_light_view_proj_matrix ( ) const
inline

Definition at line 137 of file LightComponent.h.

◆ get_outer_cone_angle()

float hellfire::LightComponent::get_outer_cone_angle ( ) const
inline

Definition at line 120 of file LightComponent.h.

◆ get_range()

float hellfire::LightComponent::get_range ( ) const
inline

Definition at line 110 of file LightComponent.h.

◆ look_at() [1/2]

void hellfire::LightComponent::look_at ( const float  x,
const float  y,
const float  z 
)
inline

Definition at line 96 of file LightComponent.h.

◆ look_at() [2/2]

void hellfire::LightComponent::look_at ( const glm::vec3 &  target)
inline

Definition at line 100 of file LightComponent.h.

◆ set_attenuation()

void hellfire::LightComponent::set_attenuation ( const float  attenuation)
inline

Definition at line 112 of file LightComponent.h.

◆ set_cast_shadows()

void hellfire::LightComponent::set_cast_shadows ( const bool  cast_shadows)
inline

Definition at line 74 of file LightComponent.h.

◆ set_color()

void hellfire::LightComponent::set_color ( const glm::vec3 &  color)
inline

Definition at line 57 of file LightComponent.h.

◆ set_direction() [1/2]

void hellfire::LightComponent::set_direction ( const float  x,
const float  y,
const float  z 
)
inline

Definition at line 64 of file LightComponent.h.

◆ set_direction() [2/2]

void hellfire::LightComponent::set_direction ( const glm::vec3 &  direction)
inline

Definition at line 68 of file LightComponent.h.

◆ set_inner_cone_angle()

void hellfire::LightComponent::set_inner_cone_angle ( const float  angle)
inline

Definition at line 116 of file LightComponent.h.

◆ set_intensity()

void hellfire::LightComponent::set_intensity ( const float  intensity)
inline

Definition at line 60 of file LightComponent.h.

◆ set_light_type()

void hellfire::LightComponent::set_light_type ( const LightType  type)
inline

Definition at line 54 of file LightComponent.h.

◆ set_light_view_proj_matrix()

void hellfire::LightComponent::set_light_view_proj_matrix ( const glm::mat4 &  lvpm)
inline

Definition at line 138 of file LightComponent.h.

◆ set_outer_cone_angle()

void hellfire::LightComponent::set_outer_cone_angle ( const float  angle)
inline

Definition at line 119 of file LightComponent.h.

◆ set_range()

void hellfire::LightComponent::set_range ( const float  range)
inline

Definition at line 109 of file LightComponent.h.

◆ should_cast_shadows()

bool hellfire::LightComponent::should_cast_shadows ( ) const
inline

Definition at line 76 of file LightComponent.h.

◆ upload_directional_to_shader()

void hellfire::LightComponent::upload_directional_to_shader ( Shader shader,
const int  light_index 
) const
inlineprivate

Definition at line 141 of file LightComponent.h.

◆ upload_point_to_shader()

void hellfire::LightComponent::upload_point_to_shader ( Shader shader,
const int  light_index 
) const
inlineprivate

Definition at line 152 of file LightComponent.h.

◆ upload_spot_to_shader()

void hellfire::LightComponent::upload_spot_to_shader ( Shader shader,
int  light_index 
) const
inlineprivate

Definition at line 164 of file LightComponent.h.

◆ upload_to_shader()

void hellfire::LightComponent::upload_to_shader ( Shader shader,
const int  light_index 
) const
inline

Definition at line 123 of file LightComponent.h.

Member Data Documentation

◆ attenuation_

float hellfire::LightComponent::attenuation_ = 1.0f
private

Definition at line 38 of file LightComponent.h.

◆ cast_shadows_

bool hellfire::LightComponent::cast_shadows_ = true
private

Definition at line 47 of file LightComponent.h.

◆ color_

glm::vec3 hellfire::LightComponent::color_ = glm::vec3(1.0f)
private

Definition at line 30 of file LightComponent.h.

◆ direction_

glm::vec3 hellfire::LightComponent::direction_ = glm::vec3(0.0f, -1.0f, 0.0f)
private

Definition at line 34 of file LightComponent.h.

◆ inner_cone_angle_

float hellfire::LightComponent::inner_cone_angle_ = 30.0f
private

Definition at line 41 of file LightComponent.h.

◆ intensity_

float hellfire::LightComponent::intensity_ = 1.0f
private

Definition at line 31 of file LightComponent.h.

◆ light_view_proj_matrix

glm::mat4 hellfire::LightComponent::light_view_proj_matrix = glm::mat4(1.0f)
private

Definition at line 44 of file LightComponent.h.

◆ outer_cone_angle_

float hellfire::LightComponent::outer_cone_angle_ = 45.0f
private

Definition at line 42 of file LightComponent.h.

◆ range_

float hellfire::LightComponent::range_ = 10.0f
private

Definition at line 37 of file LightComponent.h.

◆ type_

LightType hellfire::LightComponent::type_ = DIRECTIONAL
private

Definition at line 29 of file LightComponent.h.


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