Simulant  21.06-50
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
Public Types | Public Member Functions | List of all members
smlt::Light Class Reference
Inheritance diagram for smlt::Light:
smlt::TypedDestroyableObject< Light, Stage > smlt::ContainerNode smlt::generic::Identifiable< LightID > smlt::ChainNameable< Light > smlt::DestroyableObject smlt::StageNode smlt::Nameable smlt::TwoPhaseConstructed smlt::HasAutoID< StageNode > smlt::Organism smlt::BoundableEntity smlt::Updateable smlt::Transformable smlt::Printable smlt::Nameable smlt::TreeNode smlt::DestroyableObject

Public Types

typedef std::shared_ptr< Lightptr
 
- Public Types inherited from smlt::generic::Identifiable< LightID >
typedef LightID id_type
 

Public Member Functions

 Light (Stage *stage)
 
void set_type (LightType type)
 
Vec3 direction () const
 
void set_direction (float x, float y, float z)
 
void set_range (float range)
 
void set_direction (const Vec3 &dir)
 
void set_diffuse (const smlt::Colour &colour)
 
void set_ambient (const smlt::Colour &colour)
 
void set_specular (const smlt::Colour &colour)
 
LightType type () const
 
const smlt::Colourambient () const
 
const smlt::Colourdiffuse () const
 
const smlt::Colourspecular () const
 
smlt::Colour global_ambient () const
 
void set_attenuation (float range, float constant, float linear, float quadratic)
 
void set_attenuation_from_range (float range)
 Light::set_attenuation_from_range. More...
 
float range () const
 
float constant_attenuation () const
 
float linear_attenuation () const
 
float quadratic_attenuation () const
 
const AABBaabb () const override
 
void update (float step) override
 
void clean_up () override
 
- Public Member Functions inherited from smlt::TypedDestroyableObject< Light, Stage >
 TypedDestroyableObject (Stage *owner)
 
void destroy () override
 
void destroy_immediately () override
 
- Public Member Functions inherited from smlt::DestroyableObject
bool is_marked_for_destruction () const
 
- Public Member Functions inherited from smlt::ContainerNode
 ContainerNode (Stage *stage, StageNodeType node_type)
 
void _get_renderables (batcher::RenderQueue *, const CameraPtr, const DetailLevel) override
 
- Public Member Functions inherited from smlt::StageNode
AncestorIteratorPair each_ancestor ()
 
DescendentIteratorPair each_descendent ()
 
SiblingIteratorPair each_sibling ()
 
ChildIteratorPair each_child ()
 
std::string repr () const override
 
 StageNode (Stage *stage, StageNodeType node_type)
 
StageNodeType node_type () const
 
void link_position (StageNode *other)
 
void move_to_absolute (const Vec3 &position)
 
void move_to_absolute (float x, float y, float z)
 
void rotate_to_absolute (const Quaternion &rotation)
 
void rotate_to_absolute (const Degrees &degrees, float x, float y, float z)
 
Vec3 absolute_position () const
 
Quaternion absolute_rotation () const
 
Vec3 absolute_scaling () const
 
Mat4 absolute_transformation () const
 
bool is_visible () const
 
bool is_intended_visible () const
 
void set_visible (bool visible)
 
template<typename T >
void set_parent (const UniqueID< T > &id)
 
void set_parent (TreeNode *node)
 
void destroy_after (const Seconds &seconds)
 
void update (float dt) override
 
void late_update (float dt) override
 
void fixed_update (float step) override
 
bool parent_is_stage () const
 
void clean_up () override
 
const AABB transformed_aabb () const override
 
ShadowCast shadow_cast () const
 
void set_shadow_cast (ShadowCast cast)
 
ShadowReceive shadow_receive () const
 
void set_shadow_receive (ShadowReceive receive)
 
StageNodefind_descendent_with_name (const std::string &name)
 
void set_cullable (bool v)
 
bool is_cullable () const
 
- Public Member Functions inherited from smlt::TreeNode
void set_parent (TreeNode *node)
 
void add_child (TreeNode *node)
 
void remove_from_parent ()
 
bool is_root () const
 
bool is_leaf () const
 
TreeNodeparent () const
 
uint32_t child_count () const
 
TreeNodefirst_child () const
 
TreeNodenext_node () const
 
TreeNodeprevious_node () const
 
- Public Member Functions inherited from smlt::Nameable
void set_name (const std::string &name)
 
const std::string & name () const
 
bool has_name () const
 
- Public Member Functions inherited from smlt::Transformable
smlt::Vec3 position () const
 
smlt::Vec2 position_2d () const
 
smlt::Quaternion rotation () const
 
smlt::Vec3 scale () const
 
virtual void move_to (const smlt::Vec3 &pos)
 
virtual void move_to (const smlt::Vec2 &pos)
 
virtual void move_to (float x, float y, float z)
 
virtual void move_to (float x, float y)
 
virtual void move_by (const smlt::Vec3 &pos)
 
virtual void move_by (const smlt::Vec2 &pos)
 
virtual void move_by (float x, float y, float z)
 
virtual void move_by (float x, float y)
 
virtual void move_forward_by (float amount)
 
virtual void move_right_by (float amount)
 
virtual void move_up_by (float amount)
 
virtual void rotate_to (const smlt::Degrees &angle, float axis_x, float axis_y, float axis_z)
 
virtual void rotate_to (const smlt::Degrees &angle, const smlt::Vec3 &axis)
 
virtual void rotate_to (const smlt::Quaternion &rotation)
 
virtual void rotate_x_by (const smlt::Degrees &angle)
 
virtual void rotate_y_by (const smlt::Degrees &angle)
 
virtual void rotate_z_by (const smlt::Degrees &angle)
 
virtual void rotate_by (const smlt::Degrees &angle_x, const smlt::Degrees &angle_y, const smlt::Degrees &angle_z)
 
virtual void rotate_by (const smlt::Vec3 &angles)
 
virtual void scale_x_by (const float scale)
 
virtual void scale_y_by (const float scale)
 
virtual void scale_z_by (const float scale)
 
virtual void scale_by (float x)
 
virtual void scale_by (const Vec3 &x)
 
virtual void scale_to (const float x, const float y, const float z)
 
virtual void rotate_around (const smlt::Vec3 &axis, const smlt::Degrees &degrees)
 
void rotate_global_x_by (const smlt::Degrees &degrees)
 
void rotate_global_y_by (const smlt::Degrees &degrees)
 
void rotate_global_z_by (const smlt::Degrees &degrees)
 
virtual void look_at (const smlt::Vec3 &target, const Vec3 &up=Vec3::POSITIVE_Y)
 
virtual void look_at (float x, float y, float z, const Vec3 &up=Vec3::POSITIVE_Y)
 
Vec3 right () const
 
Vec3 up () const
 
Vec3 forward () const
 
void constrain_to_aabb (const AABB &region)
 
bool is_constrained () const
 
void remove_constraint ()
 
- Public Member Functions inherited from smlt::Updateable
virtual void _update_thunk (float dt)
 
virtual void _late_update_thunk (float dt)
 
virtual void _fixed_update_thunk (float step)
 
- Public Member Functions inherited from smlt::BoundableEntity
virtual const Vec3 centre () const
 
- Public Member Functions inherited from smlt::Boundable
virtual float width () const
 
virtual float height () const
 
virtual float depth () const
 
virtual float half_width () const
 
virtual float half_height () const
 
virtual float half_depth () const
 
virtual float diameter () const
 
virtual float radius () const
 
- Public Member Functions inherited from smlt::Organism
template<typename T >
bool has_behaviour () const
 
template<typename T >
T * behaviour () const
 
template<typename T >
T * new_behaviour ()
 
template<typename T , typename ... Params>
T * new_behaviour (Params &&... params)
 
void fixed_update_behaviours (float step)
 
void update_behaviours (float dt)
 
void late_update_behaviours (float dt)
 
- Public Member Functions inherited from smlt::HasAutoID< StageNode >
uint64_t auto_id () const
 
- Public Member Functions inherited from smlt::TwoPhaseConstructed
virtual bool init ()
 
- Public Member Functions inherited from smlt::generic::Identifiable< LightID >
 Identifiable (LightID id)
 
LightID id () const
 
virtual bool operator== (const Identifiable< LightID > &rhs) const
 
virtual bool operator< (const Identifiable< LightID > &rhs) const
 
void _bind_id_pointer (ResourceTypePtr ptr)
 
void _overwrite_id (LightID new_id)
 
- Public Member Functions inherited from smlt::ChainNameable< Light >
Lightset_name_and_get (const std::string &name)
 

Additional Inherited Members

- Public Attributes inherited from smlt::StageNode
Property< generic::DataCarrier StageNode::* > data = { this, &StageNode::data_ }
 
Property< Stage *StageNode::* > stage = { this, &StageNode::stage_ }
 
- Protected Member Functions inherited from smlt::StageNode
Stageget_stage () const
 
void on_transformation_changed () override
 
void on_parent_set (TreeNode *oldp, TreeNode *newp) override
 
virtual void update_transformation_from_parent ()
 
void recalc_bounds_if_necessary () const
 
void mark_transformed_aabb_dirty ()
 
void mark_absolute_transformation_dirty ()
 
- Protected Member Functions inherited from smlt::TreeNode
TreeNodedetach ()
 
TreeNodelast_child () const
 
- Protected Member Functions inherited from smlt::Transformable
void set_position (const Vec3 &p)
 
void set_rotation (const Quaternion &q)
 
void set_scaling (const Vec3 &s)
 
virtual void on_transformation_change_attempted ()
 
- Protected Attributes inherited from smlt::TreeNode
TreeNoderoot_ = nullptr
 
TreeNodeparent_ = nullptr
 
TreeNodefirst_child_ = nullptr
 
TreeNodeprev_ = this
 
TreeNodenext_ = this
 
- Protected Attributes inherited from smlt::Transformable
Vec3 position_
 
Quaternion rotation_
 
Vec3 scaling_ = Vec3(1, 1, 1)
 
std::unique_ptr< AABBconstraint_
 

Member Function Documentation

◆ global_ambient()

Colour smlt::Light::global_ambient ( ) const

Returns the owner stage's global ambient value.

◆ set_attenuation()

void smlt::Light::set_attenuation ( float  range,
float  constant,
float  linear,
float  quadratic 
)

Sets the attenuation and the range of the light. The range doesn't have any direct effect on the brightness on the light, it simply is a cut-off - outside of which objects will not be lit by the light.

e.g. the larger the range, the more objects will be rendered for this light even if the light would never reach them.

◆ set_attenuation_from_range()

void smlt::Light::set_attenuation_from_range ( float  range)

Light::set_attenuation_from_range.

Parameters
range- The range of the lights brightness

This is a shortcut function that calculates attenuation so that at the light position the brightness is 100% and at a distance of 'range' from the light the brightness is 0%


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