Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
Public Member Functions | Friends | List of all members
Engine::LightComponent Class Reference

#include <LightComponent.hpp>

Inheritance diagram for Engine::LightComponent:
Engine::Component

Public Member Functions

 ~LightComponent ()
 
void SetLightName (eastl::string name)
 Sets the name of the light. This is used internally by the engine to reference the light. If two lights have the same name, any changes to one of them will alter both. The default name used will be the entity name. WARNING: Any lights that already have the new name will be reset to the values held by this component. More...
 
eastl::string GetLightName () const
 Returns the name of the light. The default name is the entity name. More...
 
void SetLightType (LightType type)
 Sets the type of the light. NOTE: the type non-existent (-1) disables the light. More...
 
LightType GetLightType () const
 Returns the type of the light. More...
 
void SetLightPosition (glm::vec3 position)
 Sets the position of the light. NOTE: In case of directional lights and ambient lights this value will take effect if the light type is changed to a point or spot light. More...
 
glm::vec3 GetLightPosition ()
 Returns the position of the light. More...
 
void SetLightDirection (glm::vec3 direction)
 Sets the direction of the light. NOTE: In case of point and ambient lights this value will take effect if the light type is changed to a directional or spot light. More...
 
glm::vec3 GetLightDirection ()
 Returns the direction of the light. More...
 
void SetLightColor (glm::vec3 color)
 Sets the color of the light. More...
 
glm::vec3 GetLightColor ()
 Returns the color of the light. More...
 
void SetLightRadius (float radius)
 Sets the new radius of the light. NOTE: In case of directional lights and ambient lights this value will take effect if the light type is changed to a point or spot light. More...
 
float GetLightRadius () const
 Returns the radius of the light. More...
 
void SetLightConeInnerAngle (float angle)
 Sets the inner angle of the light cone. NOTE: If the light isn't a spot light this value will take effect if the light type is changed to spot light. More...
 
float GetLightConeInnerAngle ()
 Returns the inner angle of the light cone. More...
 
void SetLightConeOuterAngle (float angle)
 Sets the outer angle of the light cone. NOTE: If the light isn't a spot light this value will take effect if the light type is changed to spot light. More...
 
float GetLightConeOuterAngle ()
 Returns the outer angle of the light cone. More...
 
 LightComponent (eastl::string name, LightType type, glm::vec3 position, glm::vec3 direction, glm::vec3 color, float radius, float attunuation, float coneInnerAngle, float coneOuterAngle) noexcept
 Creates a new light component with the given name and type, and initializes it with the given variables. More...
 
 LightComponent (eastl::string name) noexcept
 Creates a new light component with the given name, but doesn't set the variables for the light. More...
 
- Public Member Functions inherited from Engine::Component
virtual ~Component ()=default
 
eastl::weak_ptr< EntityGetOwner () const
 This method allows you to get the entity holding this component. More...
 

Friends

class Entity
 

Additional Inherited Members

- Public Attributes inherited from Engine::Component
bool isEnabled
 
- Protected Member Functions inherited from Engine::Component
 Component ()
 
virtual void OnComponentAdded (eastl::weak_ptr< Component > addedComponent)
 This method will be called whenever a component has been added to the entity. More...
 
virtual void OnComponentRemoved (eastl::weak_ptr< Component > removedComponent)
 This method will be called whenever a component has been removed from the entity. More...
 
template<typename ComponentType >
eastl::weak_ptr< ComponentType > GetComponent ()
 This method allows you to get the first component of the given type. More...
 
template<typename ComponentType >
eastl::vector< eastl::weak_ptr< ComponentType > > GetComponents ()
 This method allows you to get all of the components of the given type. More...
 
eastl::vector< eastl::shared_ptr< Component > > GetAllComponents () const
 Returns all the components of this entity. More...
 
template<class ComponentType , class... Args>
eastl::weak_ptr< ComponentType > AddComponent (Args &&...args)
 Allows you to create a component of the given type. More...
 
template<class ComponentType , class... Args>
eastl::vector< eastl::weak_ptr< ComponentType > > AddComponents (size_t count, Args &&...args)
 Allows you to create X amount of components of the given type. More...
 
template<typename ComponentType >
void RemoveComponent (size_t amountToRemove=1) const
 Allows X amount of components of the given type. More...
 
template<typename ComponentType >
void RemoveAllComponents () const
 Deletes all the components of the given type. More...
 
template<typename archive >
void SaveBaseComponent (archive ar)
 Saves the data of this component to a archive (all derived classes have their own version, but if needed they can call this one as a failsafe/default version) More...
 
template<typename archive >
void LoadBaseComponent (archive ar)
 loads the data from the archive to this component (all derived classes have their own version, but if needed they can call this one as a failsafe/default version) More...
 
virtual void OnBeginContact (eastl::weak_ptr< Entity > entity)
 
virtual void OnEndContact (eastl::weak_ptr< Entity > entity)
 
eastl::weak_ptr< ComponentGetPointerRefence () const
 This method allows you to get a direct refence to the weak pointer of this component. More...
 
template<typename ComponentType >
eastl::weak_ptr< ComponentType > GetPointerRefence ()
 This method allows you to get a direct refence to the weak pointer of this component. More...
 

Detailed Description

Definition at line 18 of file LightComponent.hpp.

Constructor & Destructor Documentation

Engine::LightComponent::~LightComponent ( )

Definition at line 16 of file LightComponent.cpp.

Engine::LightComponent::LightComponent ( eastl::string  name,
LightType  type,
glm::vec3  position,
glm::vec3  direction,
glm::vec3  color,
float  radius,
float  attunuation,
float  coneInnerAngle,
float  coneOuterAngle 
)
explicitnoexcept

Creates a new light component with the given name and type, and initializes it with the given variables.

Parameters
nameThe name of the light. Use this when modifying the light in other functions.
typeThe type of light that's being created.
positionThe position of the light. Unused for directional lights.
directionThe direction the light points at. Unused for point lights.
colorThe color of the light.
radiusThe radius over which a light has effect.
attunuationAttunuation of the light. Currently not used.
coneInnerAngleThe angle of a spot light in which a pixel recieves the incoming light at full strength. Only used for spot lights.
coneOuterAngleThe angle of spot light that is the outer most angle a pixel can still recieve incoming light. If a pixel is between the inner and outer angle the strength of the light will slowly fade depending how close to the outer angle the pixel is. Only used for spot lights.

Definition at line 156 of file LightComponent.cpp.

Engine::LightComponent::LightComponent ( eastl::string  name)
explicitnoexcept

Creates a new light component with the given name, but doesn't set the variables for the light.

Parameters
nameThe name to use for the light.

Definition at line 192 of file LightComponent.cpp.

Member Function Documentation

glm::vec3 Engine::LightComponent::GetLightColor ( )

Returns the color of the light.

Returns
A vec3 containing the color in rgb format.

Definition at line 112 of file LightComponent.cpp.

float Engine::LightComponent::GetLightConeInnerAngle ( )

Returns the inner angle of the light cone.

Returns
The angle in radians.

Definition at line 138 of file LightComponent.cpp.

float Engine::LightComponent::GetLightConeOuterAngle ( )

Returns the outer angle of the light cone.

Returns
The angle in radians.

Definition at line 151 of file LightComponent.cpp.

glm::vec3 Engine::LightComponent::GetLightDirection ( )

Returns the direction of the light.

Returns
A vec3 containing the direction.

Definition at line 99 of file LightComponent.cpp.

eastl::string Engine::LightComponent::GetLightName ( ) const

Returns the name of the light. The default name is the entity name.

Returns
The name of the light.

Definition at line 40 of file LightComponent.cpp.

glm::vec3 Engine::LightComponent::GetLightPosition ( )

Returns the position of the light.

Returns
A vec3 containing the position.

Definition at line 86 of file LightComponent.cpp.

float Engine::LightComponent::GetLightRadius ( ) const

Returns the radius of the light.

Returns
A float containing the radius of the light.

Definition at line 125 of file LightComponent.cpp.

LightType Engine::LightComponent::GetLightType ( ) const

Returns the type of the light.

Returns
The light's type.

Definition at line 73 of file LightComponent.cpp.

void Engine::LightComponent::SetLightColor ( glm::vec3  color)

Sets the color of the light.

Parameters
colorA vec3 containing the color in rgb format.

Definition at line 104 of file LightComponent.cpp.

void Engine::LightComponent::SetLightConeInnerAngle ( float  angle)

Sets the inner angle of the light cone. NOTE: If the light isn't a spot light this value will take effect if the light type is changed to spot light.

Parameters
angleThe new angle in radians.

Definition at line 130 of file LightComponent.cpp.

void Engine::LightComponent::SetLightConeOuterAngle ( float  angle)

Sets the outer angle of the light cone. NOTE: If the light isn't a spot light this value will take effect if the light type is changed to spot light.

Parameters
angleThe new angle in radians.

Definition at line 143 of file LightComponent.cpp.

void Engine::LightComponent::SetLightDirection ( glm::vec3  direction)

Sets the direction of the light. NOTE: In case of point and ambient lights this value will take effect if the light type is changed to a directional or spot light.

Parameters
directionA vec3 containing the new direction.

Definition at line 91 of file LightComponent.cpp.

void Engine::LightComponent::SetLightName ( eastl::string  name)

Sets the name of the light. This is used internally by the engine to reference the light. If two lights have the same name, any changes to one of them will alter both. The default name used will be the entity name. WARNING: Any lights that already have the new name will be reset to the values held by this component.

Parameters
nameThe new name of the light. NOTE: Unless you want to have multiple references to the same light, prefix this with the entity name for safety.

Definition at line 23 of file LightComponent.cpp.

void Engine::LightComponent::SetLightPosition ( glm::vec3  position)

Sets the position of the light. NOTE: In case of directional lights and ambient lights this value will take effect if the light type is changed to a point or spot light.

Parameters
positionA vec3 containing the position.

Definition at line 78 of file LightComponent.cpp.

void Engine::LightComponent::SetLightRadius ( float  radius)

Sets the new radius of the light. NOTE: In case of directional lights and ambient lights this value will take effect if the light type is changed to a point or spot light.

Parameters
radiusA float containing the new radius of the light.

Definition at line 117 of file LightComponent.cpp.

void Engine::LightComponent::SetLightType ( LightType  type)

Sets the type of the light. NOTE: the type non-existent (-1) disables the light.

Parameters
typeThe light's new type.

Definition at line 45 of file LightComponent.cpp.

Friends And Related Function Documentation

friend class Entity
friend

Definition at line 155 of file LightComponent.hpp.


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