Tramway SDK
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
tram::Light Class Reference

LightComponent wrapper. More...

#include <entities/light.h>

Inheritance diagram for tram::Light:
tram::Entity

Public Member Functions

 Light (const SharedEntityData &, const ValueArray &)
 
void UpdateParameters ()
 Called when Entity::UpdateTransform is called. More...
 
void SetParameters ()
 Called when either Entity::SetLocation or Entity::SetRotation is called. More...
 
void Load ()
 Loads an entity. More...
 
void Unload ()
 Unloads an entity. More...
 
void Serialize ()
 
void MessageHandler (Message &msg)
 Allows entities to receive messages. More...
 
name_t GetType ()
 Returns the type of the entity. More...
 
- Public Member Functions inherited from tram::Entity
 Entity ()
 Creates an unnamed entity with a random ID. More...
 
 Entity (name_t name)
 Creates a named entity with a random ID. More...
 
 Entity (const SharedEntityData &)
 Creates an entity from a SharedEntityData. More...
 
virtual ~Entity ()
 Destructs the entity. More...
 
name_t GetName () const
 
id_t GetID () const
 
WorldCellGetCell ()
 Returns the entity's parent cell. More...
 
bool IsLoaded () const
 Returns the entity load status. More...
 
bool IsAutoLoad () const
 Returns the auto load flag status. More...
 
bool IsPersistent () const
 Returns the persistence status of an entity. More...
 
bool IsChanged () const
 
bool IsDeleted () const
 Returns the entity deletion status. More...
 
bool IsLoadedFromDisk () const
 
void Yeet ()
 Purges the entity. More...
 
void SetAutoLoad (bool is)
 
void SetPersistent (bool is)
 
void SetLocation (vec3 loc)
 
void SetRotation (quat rot)
 
void UpdateTransform (const vec3 &loc, const quat &rot)
 
const vec3GetLocation ()
 
const quatGetRotation ()
 
virtual void EventHandler (Event &event)
 Allows entities to receive events. More...
 
void CheckTransition ()
 Check whether an entity has entered a different cell. More...
 
SignalTableGetSignalTable ()
 

Static Public Member Functions

static void Register ()
 
- Static Public Member Functions inherited from tram::Entity
static void Update ()
 Updates entities. More...
 
static void RegisterType (name_t name, entity_make, entity_clear, const Type *fields, size_t fieldcount)
 Registers a new entity type. More...
 
static void RegisterType (name_t name, entity_make, entity_clear, const FieldInfo *fields, size_t fieldcount)
 Registers a new entity type. More...
 
static void RegisterType (name_t name, entity_make, entity_clear, std::initializer_list< FieldInfo > fields)
 Registers a new entity type. More...
 
static EntityMake (name_t type, File *file)
 Loads an Entity from a File. More...
 
static EntityMake (name_t type, const SharedEntityData &, const ValueArray &)
 Creates an entity. More...
 
static EntityFind (id_t entity_id)
 Finds the entity by its ID number. More...
 
static EntityFind (name_t entity_name)
 Finds the entity by its name. More...
 

Protected Attributes

Component< LightComponentlight
 
vec3 color
 
float distance
 
vec3 direction
 
float exponent
 
- Protected Attributes inherited from tram::Entity
id_t id = 0
 
name_t name
 
WorldCellcell = nullptr
 
SignalTablesignals = nullptr
 
quat rotation = {1.0f, 0.0f, 0.0f, 0.0f}
 
vec3 location = {0.0f, 0.0f, 0.0f}
 
uint32_t flags = 0
 

Additional Inherited Members

- Public Types inherited from tram::Entity
enum  : uint32_t { FIELD_SERIALIZE = 1 }
 
- Protected Types inherited from tram::Entity
enum  : uint32_t {
  NON_PERSISTENT = 1 , LOADED = 2 , DISABLE_AUTO_LOAD = 4 , NON_SERIALIZABLE = 8 ,
  DIRTY = 16 , DELETED = 32 , LOADED_FROM_DISK = 64
}
 
- Protected Member Functions inherited from tram::Entity
void Register ()
 Registers the entity. More...
 
void Unregister ()
 Unregisters the entity. More...
 
void FireSignal (signal_t type)
 
void FireSignal (signal_t type, Value value)
 
void SetFlag (uint32_t flag, bool value)
 

Detailed Description

LightComponent wrapper.

See also
https://racenis.github.io/tram-sdk/documentation/entities/light.html

Constructor & Destructor Documentation

◆ Light()

tram::Light::Light ( const SharedEntityData shared_data,
const ValueArray field_array 
)

Member Function Documentation

◆ GetType()

name_t tram::Light::GetType ( )
virtual

Returns the type of the entity.

Usually this method returns the same name that is used to Entity::RegisterType() its type.

Implements tram::Entity.

◆ Load()

void tram::Light::Load ( )
virtual

Loads an entity.

Usually the Load() method for an entity type will set up its components, event listeners, etc. After being loaded, the entity will be ready for simulation.

When implementing this method, make sure to flag the entity with the LOADED flag, so that world streaming system doesn't try to load your entity twice.

Implements tram::Entity.

◆ MessageHandler()

void tram::Light::MessageHandler ( Message msg)
virtual

Allows entities to receive messages.

Whenever an entity is sent a Message, once the Message::Dispatch() function has been called, the entity will gets the message passed to it through this method.

Implements tram::Entity.

◆ Register()

void tram::Light::Register ( )
static

◆ Serialize()

void tram::Light::Serialize ( )
virtual

Implements tram::Entity.

◆ SetParameters()

void tram::Light::SetParameters ( )
virtual

Called when either Entity::SetLocation or Entity::SetRotation is called.

Usually this method is used to relocate or rerotate an entity.

If the entity has a PhysicsComponent, its position or rotation is usually set from this method, otherwise in the next Physics update step, the entity's previous rotation and location will be restored.

Implements tram::Entity.

◆ Unload()

void tram::Light::Unload ( )
virtual

Unloads an entity.

Usually the Load() method for an entity type will destroy its its components, event listeners, etc. After being unloaded, the entity have been removed from the simulation.

When implementing this method, make sure to clear your entity's LOADED flag, so that world streaming system can load the entity again.

Implements tram::Entity.

◆ UpdateParameters()

void tram::Light::UpdateParameters ( )
virtual

Called when Entity::UpdateTransform is called.

From the runtime's side, only the Physics system will call the Entity::UpdateTransform() method, and through it, this method.

Usually this method is used to forward the entity's new position and rotation to its RenderComponent, if it has one.

If the entity has a PhysicsComponent, its position or rotation is never updated from this method.

Implements tram::Entity.

Member Data Documentation

◆ color

vec3 tram::Light::color
protected

◆ direction

vec3 tram::Light::direction
protected

◆ distance

float tram::Light::distance
protected

◆ exponent

float tram::Light::exponent
protected

◆ light

Component<LightComponent> tram::Light::light
protected

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