|
CeresEngine 0.2.0
A game development framework
|
A scene light. More...
#include <CeresEngine/Scene/Light.hpp>
Public Member Functions | |
| Light (EntityManager &entityManager, const Entity &parent, LightType type) | |
Create a new Light with the given type and parent. | |
Public Member Functions inherited from CeresEngine::EntityObject< TransformComponent, Cs... > | |
| EntityObject ()=default | |
| Creates a new entity object. | |
| EntityObject (std::nullptr_t) noexcept | |
| Creates a new empty entity. | |
| EntityObject (EntityManager &entityManager) | |
| Creates a new entity object attached to a entity manager. | |
| EntityObject (EntityManager &entityManager, const Entity &parent) | |
| Creates a new entity object attached to a entity manager. | |
| EntityObject (EntityManager &entityManager, String name) | |
| Creates a new entity object attached to a entity manager. | |
| EntityObject (EntityManager &entityManager, const Entity &parent, String name) | |
| Creates a new entity object attached to a entity manager. | |
| EntityObject (const EntityObject< OtherComponents... > &entity) | |
| Creates a new entity object by down-casting other compatible entity object. | |
| EntityObject (const EntityObject &other) noexcept=default | |
| Creates a new entity by copying another. | |
| EntityObject & | operator= (const EntityObject &other) noexcept=default |
| Assing the contents of the entity by copying the contents of another. | |
| CE_FLATTEN_INLINE decltype(auto) | operator-> () const |
Creates a new ComponentAccessor for this entity object. | |
| UInt64 | getHash () const |
| Computes a hash that uniquely represents the entity object. | |
| bool | compareHash (UInt64 &hash) const |
Public Member Functions inherited from CeresEngine::Entity | |
| Entity () noexcept=default | |
| Creates a new empty entity. | |
| Entity (EntityManager &entityManager, EntityID id) noexcept | |
| Creates a new entity attached to a entity manager. | |
| Entity (std::nullptr_t) noexcept | |
| Creates a new empty entity. | |
| Entity & | operator= (std::nullptr_t) noexcept |
Empties a EntityObject. The entity is not deallocated. | |
| Entity (const Entity &other) noexcept=default | |
| Creates a new entity by copying another. | |
| Entity & | operator= (const Entity &other) noexcept=default |
| Assing the contents of the entity by copying the contents of another. | |
| bool | valid () const noexcept |
| Checks if the entity is still valid. | |
| Entity | copy () const |
| Copies the entity and all its components. | |
| template<typename Block > | |
| Entity | copy (Block &&block) const |
Copies the entity and all its components. Executes block as. | |
| void | destroy () const |
| Destroys the entity. | |
| AbstractComponent & | add (const ComponentType &type, const Box &initialValue=nullptr) const |
Adds a new component of the given type. | |
| template<CComponent C, typename... Args> | |
| C & | add (Args &&... args) const noexcept(std::is_nothrow_constructible_v< C, Args... >) |
| Adds a new component. | |
| template<CComponent C, typename Block , typename... Args> | |
| C & | addWith (Block &&block, Args &&... args) const noexcept(std::is_nothrow_constructible_v< C, Args... >) |
Adds a new component and calls block with the added component. | |
| template<CComponent C, typename... Args> | |
| C & | set (Args &&... args) const noexcept(std::is_nothrow_constructible_v< C, Args... >) |
| Sets a component. | |
| void | remove (const ComponentType &type) const |
Removes a component of the given type from the entity. | |
| template<CComponent C> | |
| void | remove () const noexcept(std::is_nothrow_destructible_v< C >) |
Removes a component of type C from the entity. | |
| AbstractComponent & | get (const ComponentType &type) const |
Gets a component of the given type. | |
| template<CComponent C> | |
| C & | get () const noexcept |
Gets a component of type C. | |
| template<CComponent C0, CComponent C1, CComponent... Cs> | |
| Tuple< C0 &, C1 &, Cs &... > | get () const noexcept |
Gets a set of components of types C0, C1 and Cs. | |
| AbstractComponent & | getOr (const ComponentType &type) const |
Gets a component of the given type. | |
| template<CComponent C> | |
| C & | getOr () const noexcept(std::is_nothrow_constructible_v< C >) |
Gets a component of type C. | |
| template<CComponent C0, CComponent C1, CComponent... Cs> | |
| Tuple< C0 &, C1 &, Cs &... > | getOr () const noexcept |
Gets a set of components of types C0, C1 and Cs. | |
| AbstractComponent * | getIf (const ComponentType &type) const |
Gets a component of the given type. | |
| template<CComponent C> | |
| C * | getIf () const noexcept |
Gets a component of type C. | |
| template<CComponent C0, CComponent C1, CComponent... Cs> | |
| Tuple< C0 *, C1 *, Cs *... > | getIf () const noexcept |
Gets a set of components of types C0, C1 and Cs. | |
| Vector< AbstractComponent * > | getComponents () const |
| bool | has (const ComponentType &type) const noexcept |
Checks if the entity has all components of the given type. | |
| template<CComponent C, CComponent... Cs> | |
| bool | has () const noexcept |
Checks if the entity has all components of types Cs. | |
| void | clear () const |
| Removes all components attached to the entity, without destroying the entity itself. | |
| bool | empty () const noexcept |
| Checks if the entity is empty (i.e. | |
| template<typename E > | |
| bool | is () const noexcept |
Checks if the entity matches the criteria to be considered a E entity object. | |
| template<typename E > | |
| E | as () const |
Converts the entity handle type into a E entity object. | |
| template<typename... Cs> | |
| EntityObject< Cs... > | having () const |
Converts the entity handle type into a EntityObject<Cs...> object. | |
| template<typename E > | |
| E | being () const noexcept |
Converts the entity handle type into a E entity object. | |
| Entity | getParent () const noexcept |
| Gets the parent entity. | |
| template<typename P > | |
| P | getParent () const noexcept |
Gets the parent entity of type T. | |
| void | setParent (Entity parent) const |
| Sets the parent entity. | |
| const Vector< Entity > & | getChildren () const noexcept |
| Gets the list of children entities. | |
| template<typename T > | |
| Generator< T > | getChildren () const noexcept |
| Gets the list of children entities. | |
| void | setChildren (const Vector< Entity > &children) |
| Sets all entities as children of this entity. | |
| StringView | getName () const noexcept |
| Gets the name for the entity. | |
| void | setName (String name) const |
| Sets the name for the entity. | |
| template<CEntityEvent E, typename... Args> | |
| void | emit (Args &&... args) const |
Emits a event of type E to all event listeners. | |
| template<CEntityEvent E> | |
| void | emit (const E &event) const |
Emits a event of type E to all event listeners. | |
| template<CEntityEvent E, typename Listener > | |
| WeakEventConnection | on (Listener &&listener) const |
| Subscribes a listener that waits for events from the entity. | |
| template<CEntityAction A, typename... Args> | |
| bool | canAct (Args &&... args) const |
Checks if the the entity is capable of acting on the given action A. | |
| template<CEntityAction A, typename... Args> | |
| decltype(auto) | act (Args &&... args) const |
Orders the entity to act on the action A. | |
| template<typename T , CComponent Component> | |
| auto | mutate (T Component::*ptr) const |
Accesses an element from an existing Component. | |
| template<typename MutateFunc , typename T , CComponent Component> | |
| decltype(auto) | mutate (MutateFunc &&func, T Component::*ptr) const |
Accesses an element from an existing Component. | |
| template<typename T , CComponent Component> | |
| const T & | read (const T Component::*ptr) const |
Accesses an element from an existing Component. | |
| EntityID | getEntityID () const noexcept |
| EntityManager & | getEntityManager () const noexcept |
| operator bool () const noexcept | |
| Checks if the entity is still valid. | |
| Entity | operator[] (const EntityIndex childIndex) const |
| Entity | operator[] (const StringView childName) const |
Additional Inherited Members | |
Public Types inherited from CeresEngine::EntityObject< TransformComponent, Cs... > | |
| using | ComponentSet = CeresEngine::ComponentSet< Components... > |
| The component set for the entity object. | |
| using | Type = EntityObject< Components... > |
| Underlying EntityObject. | |
Static Public Member Functions inherited from CeresEngine::EntityObject< TransformComponent, Cs... > | |
| static EntityObject | make (Entity entity) |
Makes the entity an entity object by adding any missing component and casting it. | |
Public Attributes inherited from CeresEngine::Entity | |
| EntityManager * | entityManager = nullptr |
| The owning entity manager. | |
| EntityID | entityID = {} |
| The entity ID. | |
Static Public Attributes inherited from CeresEngine::TSceneObject< LightComponent > | |
| static constexpr Facing | facingConvention |
Static Public Attributes inherited from CeresEngine::EntityObject< TransformComponent, Cs... > | |
| static constexpr bool | includes |
Checks if all Components are valid component types. | |
| static const _MaskObject | mask |
A scene light.
The power of sun lights is specified in Watts per square meter. The power of point lights, spot lights, and area lights is specified in Watts. But this is not the electrical Watts that consumer light bulbs are rated at. It is Radiant Flux or Radiant Power which is also measured in Watts. It is the energy radiated from the light in the form of visible light.
If you want to set the power to real world values, you have to convert the wattage of consumer bulbs or LED lights to radiant flux, but it is not a straightforward process. The wattage of bulbs means the electrical power required to power them. LED lights have a “Watt equivalent” which is neither the electrical power they require nor the amount of light they put out. Some consumer lights specify lumens or luminous flux which is the radiant flux weighted with the wavelengths perceived by the human eye.
| CeresEngine::Light::Light | ( | EntityManager & | entityManager, |
| const Entity & | parent, | ||
| LightType | type | ||
| ) |
Create a new Light with the given type and parent.
The object is created in the given entityManager.
| entityManager | The object owning entity manager. |
| type | The light type. |
| parent | The object parent object. |