CUGL 4.0
Cornell University Game Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
cugl::physics2::lights::Light Class Referenceabstract

#include <CULight.h>

Inheritance diagram for cugl::physics2::lights::Light:
cugl::physics2::WorldObject cugl::physics2::lights::ChainLight cugl::physics2::lights::ConeLight cugl::physics2::lights::DirectionalLight cugl::physics2::lights::PointLight

Public Member Functions

 Light (void)
 
 ~Light ()
 
virtual void dispose ()
 
virtual bool init (Uint32 rays=DEFAULT_RAYS)
 
virtual bool initWithReach (float reach, Uint32 rays=DEFAULT_RAYS)
 
virtual bool initWithPosition (const Vec2 &pos, Uint32 rays=DEFAULT_RAYS)
 
virtual bool initWithPositionReach (const Vec2 &pos, float reach, Uint32 rays=DEFAULT_RAYS)
 
void setRayNum (Uint32 rays)
 
int getRayNum ()
 
const Vec2getPosition () const
 
float getX () const
 
float getY () const
 
void setPosition (float x, float y)
 
void setPosition (const Vec2 &position)
 
float getReach () const
 
void setReach (float dist)
 
float getAngle () const
 
void setAngle (float angle)
 
Color4 getColor () const
 
void setColor (Color4 color)
 
void setColor (float r, float g, float b, float a)
 
float getGamma () const
 
void setGamma (float gamma)
 
bool isActive () const
 
void setActive (bool active)
 
bool isXray () const
 
void setXray (bool xray)
 
bool isStaticLight () const
 
void setStaticLight (bool staticLight)
 
bool isSoft () const
 
void setSoft (bool soft)
 
float getSoftness () const
 
void setSoftness (float factor)
 
bool getDebug () const
 
void setDebug (bool flag)
 
bool contains (float x, float y)
 
virtual bool contains (const Vec2 &p)
 
const graphics::Mesh< LightVertex > & getLightMesh () const
 
const graphics::Mesh< graphics::SpriteVertex > & getDebugMesh () const
 
const Affine2 getGraphicsTransform () const
 
void attachBody (b2Body *body)
 
void attachBody (b2Body *body, const Vec2 &offset)
 
void attachBody (b2Body *body, const Vec2 &offset, float radians)
 
float getPhysicsUnits () const
 
void setPhysicsUnits (float units)
 
bool doesIgnoreAttachedBody () const
 
void setIgnoreAttachedBody (bool flag)
 
const b2Filter & getContactFilter () const
 
void setContactFilter (const b2Filter &filter)
 
virtual void detachWorld (const ObstacleWorld *world) override
 
void update (b2World *world, const Rect &bounds)
 
virtual void detachWorld (const ObstacleWorld *world)
 

Static Public Member Functions

static bool filters (const b2Filter &filter, b2Fixture *fixture)
 
static const b2Filter & getGlobalContactFilter ()
 
static void setGlobalContactFilter (const b2Filter &filter)
 

Static Public Attributes

static const int MIN_RAYS
 
static int DEFAULT_RAYS
 
static float DEFAULT_REACH
 
static float DEFAULT_SOFTNESS
 

Protected Member Functions

virtual void initRays ()=0
 
void resetRays ()
 
virtual void updateMesh ()=0
 

Protected Attributes

Uint32 _rayNum
 
Color4 _color
 
float _gamma
 
Vec2 _position
 
float _angle
 
float _reach
 
float _shadowFactor
 
bool _active
 
bool _dirty
 
bool _soft
 
bool _xray
 
bool _staticLight
 
b2Body * _body
 
Vec2 _bodyOffset
 
float _bodyAngle
 
float _units
 
bool _ignoreBody
 
b2Filter _contactFilter
 
std::vector< Vec2_lightRays
 
std::vector< Vec2_endPoints
 
std::vector< Vec2_directions
 
std::vector< float > _fractions
 
LightRaycast _raycast
 
bool _debug
 
graphics::Mesh< LightVertex_lightMesh
 
graphics::Mesh< graphics::SpriteVertex_debugMesh
 

Static Protected Attributes

static b2Filter _globalFilter
 

Detailed Description

This is an abstract class for all light objects.

This is a fairly minimal class that exists primarily for polymorphic reasons. As a general rule, you will want one of the subclasses, such as PointLight, ConeLight, or DirectionalLight.

While a light can be attached to a box2d body, it does not own the body. That body should be constructed elsewhere such as in an Obstacle object. This class should use the WorldObject interface to be notified when the underlying world has been released.

Note that lights have no methods for rendering. That is done via the classes LightBatch. The methods getLightMesh and getDebugMesh extract meshes to be used in LightBatch or graphics::SpriteBatch, respectively.

As an abstract class there are no static constructors.

Constructor & Destructor Documentation

◆ Light()

cugl::physics2::lights::Light::Light ( void  )

Creates a light with no mesh or drawing information.

NEVER USE A CONSTRUCTOR WITH NEW. If you want to allocate an object on the heap, use one of the static constructors instead.

◆ ~Light()

cugl::physics2::lights::Light::~Light ( )
inline

Deletes this light, disposing all resources.

Member Function Documentation

◆ attachBody() [1/3]

void cugl::physics2::lights::Light::attachBody ( b2Body *  body)
inline

Attaches the light to the specified the body

When attached, the light will automatically follow this body unless stated otherwise. Note that the body rotation angle is taken into account for the light offset and direction calculations.

Note that lights do not own box2d bodies. The body should created (and deleted) separately, either manually or part of an Obstacle object.

Parameters
bodyThe body to attach this light to

◆ attachBody() [2/3]

void cugl::physics2::lights::Light::attachBody ( b2Body *  body,
const Vec2 offset 
)
inline

Attaches the light to the specified body with the relative offset

When attached, the light will automatically follow this body. Note that the body rotation angle is taken into account for the light offset and direction calculations.

Note that lights do not own box2d bodies. The body should created (and deleted) separately, either manually or part of an Obstacle object.

Parameters
bodyThe body to attach this light to
offsetThe relative offset in world coordinates

◆ attachBody() [3/3]

void cugl::physics2::lights::Light::attachBody ( b2Body *  body,
const Vec2 offset,
float  radians 
)

Attaches the light to the specified body with the relative offset and direction

When attached, the light will automatically follow this body unless stated otherwise. Note that the body rotation angle is taken into account for the light offset and direction calculations.

Note that lights do not own box2d bodies. The body should created (and deleted) separately, either manually or part of an Obstacle object.

Parameters
bodyThe body to attach this light to
offsetThe relative offset in world coordinates
radiansThe angle offset offset in radians

◆ contains() [1/2]

virtual bool cugl::physics2::lights::Light::contains ( const Vec2 p)
inlinevirtual

Returns true if given point is inside of this light area

Parameters
pthe point in world coordinates
Returns
true if given point is inside of this light area

Reimplemented in cugl::physics2::lights::ChainLight, cugl::physics2::lights::ConeLight, cugl::physics2::lights::DirectionalLight, and cugl::physics2::lights::PointLight.

◆ contains() [2/2]

bool cugl::physics2::lights::Light::contains ( float  x,
float  y 
)
inline

Returns true if given point is inside of this light area

Parameters
xthe horizontal position of point in world coordinates
ythe vertical position of point in world coordinates
Returns
true if given point is inside of this light area

◆ detachWorld()

virtual void cugl::physics2::lights::Light::detachWorld ( const ObstacleWorld world)
inlineoverridevirtual

Detatches the given obstacle world from this object.

This method ensures safe clean-up.

Parameters
worldThe world to detatch.

Reimplemented from cugl::physics2::WorldObject.

◆ dispose()

virtual void cugl::physics2::lights::Light::dispose ( )
virtual

Deletes the light, freeing all resources.

You must reinitialize the light to use it.

Reimplemented in cugl::physics2::lights::ChainLight.

◆ doesIgnoreAttachedBody()

bool cugl::physics2::lights::Light::doesIgnoreAttachedBody ( ) const
inline

Returns true if the attached body fixtures will be ignored during raycasting

If the value is true, all the fixtures of attached body will be ignored and will not create any shadows for this light. By default, this value is set to false.

Returns
true if the attached body fixtures will be ignored during raycasting

◆ filters()

static bool cugl::physics2::lights::Light::filters ( const b2Filter &  filter,
b2Fixture *  fixture 
)
static

Returns true if the given filter omits the given fixture.

This method is used to eliminate any fixtures that would be filtered out during raycasting.

Parameters
filterThe filter to apply
fixtureThe fixture to test
Returns
true if the given filter omits the given fixture.

◆ getAngle()

float cugl::physics2::lights::Light::getAngle ( ) const
inline

Returns the angle of the light in radians

For lights with direction, the angle is typically the "facing" of the light.

Returns
the angle in radians

◆ getColor()

Color4 cugl::physics2::lights::Light::getColor ( ) const
inline

Returns the current color of this light

The RGB values set the color while the alpha value sets the intensity. Note that you can also use colorless (e.g Color4#BLACK light with shadows. By default this is a light grey color.

Returns
the current color of this light

◆ getContactFilter()

const b2Filter & cugl::physics2::lights::Light::getContactFilter ( ) const
inline

Returns the contact filter for this light

In raycasting, this filter is combined with getGlobalContactFilter to remove any fixtures that should be ignored.

Returns
the contact filter for this light

◆ getDebug()

bool cugl::physics2::lights::Light::getDebug ( ) const
inline

Returns true if debugging is enabled.

If this attribute is true, getDebugMesh will return a non-empty mesh for debugging.

Returns
true if debugging is enabled.

◆ getDebugMesh()

const graphics::Mesh< graphics::SpriteVertex > & cugl::physics2::lights::Light::getDebugMesh ( ) const
inline

Returns the debug mesh for this light.

This mesh is a wireframe that can be passed to graphics::SpriteBatch for drawing, or used in a scene2::MeshNode. The coordinates of the mesh are in the light coordinate space, meaning that they the origin is the light position. They are scaled by the getPhysicsUnits. This means that you should use getGraphicsTransform to draw this mesh to a sprite batch.

Note that if getDebug is not true, this mesh will be empty.

Returns
the debug mesh for this light.

◆ getGamma()

float cugl::physics2::lights::Light::getGamma ( ) const
inline

Returns the gamma correction factor for this light.

This value is used to adjust the light color in the LightBatch#draw method.

Returns
the gamma correction factor for this light.

◆ getGlobalContactFilter()

static const b2Filter & cugl::physics2::lights::Light::getGlobalContactFilter ( )
inlinestatic

Returns the contact filter for all lights.

In raycasting, this filter is combined with getContactFilter to remove any fixtures that should be ignored.

Returns
the contact filter for all lights.

◆ getGraphicsTransform()

const Affine2 cugl::physics2::lights::Light::getGraphicsTransform ( ) const

Returns a transform for displaying graphics attached to this light.

Obstacles are generally used to transform a 2d graphics object on the screen. This includes getDebugMesh. Passing this transform to a graphics::SpriteBatch will display the object in its proper location.

Returns
a transform for displaying graphics attached to this light.

◆ getLightMesh()

const graphics::Mesh< LightVertex > & cugl::physics2::lights::Light::getLightMesh ( ) const
inline

Returns the light mesh for this light.

This light mesh can be passed to a LightBatch for drawing. Vertices in a light mesh are in absolute worlds coordinates and do not need to be transformed before sending them to the light batch.

Returns
the light mesh for this light.

◆ getPhysicsUnits()

float cugl::physics2::lights::Light::getPhysicsUnits ( ) const
inline

Returns the physics units for this light.

Physics units are the number of pixels per box2d unit. These values are used to create the debug mesh.

Returns
the physics units for this light

◆ getPosition()

const Vec2 & cugl::physics2::lights::Light::getPosition ( ) const
inline

Returns the position of the light

All positions are measured in box2d world coordinates. If this light has an attached box2d body, that body will determine this position.

Returns
the position of the light

◆ getRayNum()

int cugl::physics2::lights::Light::getRayNum ( )
inline

Returns the number of rays set for this light

Returns
the number of rays set for this light

◆ getReach()

float cugl::physics2::lights::Light::getReach ( ) const
inline

Returns the light reach

The reach is the distance that the light extends from its position.

NOTE: The minimum value should be capped to 0.1f meter. In addition, this value does not include any gamma correction.

Returns
the light reach

◆ getSoftness()

float cugl::physics2::lights::Light::getSoftness ( ) const
inline

Returns the softness value for the beam tips.

This value is multiplied by the reach of the light to get the length of the soft shadows. The default value is 0.1f

Returns
the softness value for the beam tips.

◆ getX()

float cugl::physics2::lights::Light::getX ( ) const
inline

Returns the horizontal position of the light

All positions are measured in box2d world coordinates. If this light has an attached box2d body, that body will determine this position.

Returns
the horizontal starting of the light

◆ getY()

float cugl::physics2::lights::Light::getY ( ) const
inline

Returns the vertical starting position of light

All positions are measured in box2d world coordinates. If this light has an attached box2d body, that body will determine this position.

Returns
the vertical starting position of light

◆ init()

virtual bool cugl::physics2::lights::Light::init ( Uint32  rays = DEFAULT_RAYS)
inlinevirtual

Initializes a new light with the given number of rays.

All attributes will have their default values. The light will be placed at the world origin, and will have the default reach. The light color will be a transluscent light grey.

The number of rays cannot be less than MIN_RAYS. More rays make the light look more realistic but will decrease performance.

Parameters
raysThe number of rays
Returns
true if initialization is successful

Reimplemented in cugl::physics2::lights::DirectionalLight.

◆ initRays()

virtual void cugl::physics2::lights::Light::initRays ( )
protectedpure virtual

Creates the ray template and associated data structures

This method should be called after any action that would alter the ray template. Such examples include changing the reach or the number of rays.

This method is specific to each light type

Implemented in cugl::physics2::lights::ChainLight, cugl::physics2::lights::ConeLight, cugl::physics2::lights::DirectionalLight, and cugl::physics2::lights::PointLight.

◆ initWithPosition()

virtual bool cugl::physics2::lights::Light::initWithPosition ( const Vec2 pos,
Uint32  rays = DEFAULT_RAYS 
)
inlinevirtual

Initializes a new light with the given number of rays and position

All other attributes will have their default values. The light will have the default reach. The light color will be a transluscent light grey.

The number of rays cannot be less than MIN_RAYS. More rays make the light look more realistic but will decrease performance.

Parameters
posThe light position
raysThe number of rays
Returns
true if initialization is successful

Reimplemented in cugl::physics2::lights::DirectionalLight.

◆ initWithPositionReach()

virtual bool cugl::physics2::lights::Light::initWithPositionReach ( const Vec2 pos,
float  reach,
Uint32  rays = DEFAULT_RAYS 
)
virtual

Initializes a new light with the given number of rays, position, and reach

All other attributes will have their default values. The light color will be a transluscent light grey.

The number of rays cannot be less than MIN_RAYS. More rays make the light look more realistic but will decrease performance.

Parameters
posThe light position
reachThe light reach
raysThe number of rays
Returns
true if initialization is successful

Reimplemented in cugl::physics2::lights::DirectionalLight.

◆ initWithReach()

virtual bool cugl::physics2::lights::Light::initWithReach ( float  reach,
Uint32  rays = DEFAULT_RAYS 
)
inlinevirtual

Initializes a new light with the given number of rays and reach

All other attributes will have their default values. The light will be placed at the world origin. The light color will be a transluscent light grey.

The number of rays cannot be less than MIN_RAYS. More rays make the light look more realistic but will decrease performance.

Parameters
reachThe light reach
raysThe number of rays
Returns
true if initialization is successful

Reimplemented in cugl::physics2::lights::DirectionalLight.

◆ isActive()

bool cugl::physics2::lights::Light::isActive ( ) const
inline

Returns true if this light is active.

An enabled light will respond to calls to update and LightMap#render.

Returns
true if this light is active.

◆ isSoft()

bool cugl::physics2::lights::Light::isSoft ( ) const
inline

Returns true if the tips of the light beams are soft

This value is true by default.

Returns
true if the tips of the light beams are soft

◆ isStaticLight()

bool cugl::physics2::lights::Light::isStaticLight ( ) const
inline

Returns true if this light is static

Static lights do not get any automatic updates, but any changes to one of its parameters will update it. Static lights are useful for lights that you want to collide with static geometry but ignore all the dynamic objects. This can reduce the CPU burden of the light by about 90%.

Returns
true if this light is static

◆ isXray()

bool cugl::physics2::lights::Light::isXray ( ) const
inline

Returns true if this light beams go through obstacles

Enabling this will allow beams to go through obstacles that reduce CPU burden of light about 70%. Use the combination of x-ray and non x-ray lights wisely,

Returns
true if this light beams go through obstacles

◆ resetRays()

void cugl::physics2::lights::Light::resetRays ( )
protected

Resets the rays to the current orientation.

This extends all rays to their full lemgth. It should be called just before ray casting.

◆ setActive()

void cugl::physics2::lights::Light::setActive ( bool  active)
inline

Enables/disables this light.

An enabled light will respond to calls to update() and LightMap#render.

Parameters
activeWhether to enable this light

◆ setAngle()

void cugl::physics2::lights::Light::setAngle ( float  angle)
inline

Sets the angle of the light in radians

For lights with direction, the angle is typically the "facing" of the light.

Parameters
angleThe angle in radians

◆ setColor() [1/2]

void cugl::physics2::lights::Light::setColor ( Color4  color)
inline

Sets the light color

The RGB values set the color while the alpha value sets the intensity. Note that you can also use colorless (e.g Color4#BLACK light with shadows. By default this is a light grey color.

Note that this color will not be committed to mesh until a call to update.

Parameters
colorThe light color

◆ setColor() [2/2]

void cugl::physics2::lights::Light::setColor ( float  r,
float  g,
float  b,
float  a 
)
inline

Sets the light color

The RGB values set the color while the alpha value sets the intensity. Note that you can also use colorless (e.g Color4#BLACK light with shadows. By default this is a light grey color.

Note that this color will not be committed to mesh until a call to update.

Parameters
rthe red component
gthe green component
bthe blue component
athe shadow intensity

◆ setContactFilter()

void cugl::physics2::lights::Light::setContactFilter ( const b2Filter &  filter)
inline

Sets the contact filter for this light

In raycasting, this filter is combined with getGlobalContactFilter to remove any fixtures that should be ignored.

Parameters
filterThe contact filter

◆ setDebug()

void cugl::physics2::lights::Light::setDebug ( bool  flag)
inline

Sets whether debugging is enabled.

If this attribute is true, getDebugMesh will return a non-empty mesh for debugging.

Parameters
flagWhether debugging should be enabled.

◆ setGamma()

void cugl::physics2::lights::Light::setGamma ( float  gamma)
inline

Sets the gamma correction factor for this light.

This value is used to adjust the light color in the LightBatch#draw method.

Parameters
gammathe gamma correction factor for this light.

◆ setGlobalContactFilter()

static void cugl::physics2::lights::Light::setGlobalContactFilter ( const b2Filter &  filter)
inlinestatic

Sets the contact filter for all lights.

In raycasting, this filter is combined with getContactFilter to remove any fixtures that should be ignored.

Parameters
filterThe contact filter

◆ setIgnoreAttachedBody()

void cugl::physics2::lights::Light::setIgnoreAttachedBody ( bool  flag)
inline

Sets if the attached body fixtures should be ignored during raycasting

If the value is true, all the fixtures of attached body will be ignored and will not create any shadows for this light. By default, this value is set to false.

Parameters
flagWhether to ignore the attached body.

◆ setPhysicsUnits()

void cugl::physics2::lights::Light::setPhysicsUnits ( float  units)
inline

Sets the physics units for this light.

Physics units are the number of pixels per box2d unit. These values are used to create the debug mesh.

Parameters
unitsThe physics units for this light

◆ setPosition() [1/2]

void cugl::physics2::lights::Light::setPosition ( const Vec2 position)
inline

Sets the light starting position

All positions are measured in box2d world coordinates. If this light has an attached box2d body, that body will determine this position. In particular, setting this value is only relevant if there is no attached body. Otherwise this value will be overwritten at the next call to update.

Parameters
positionThe light position

◆ setPosition() [2/2]

void cugl::physics2::lights::Light::setPosition ( float  x,
float  y 
)
inline

Sets the light starting position

All positions are measured in box2d world coordinates. If this light has an attached box2d body, that body will determine this position. In particular, setting this value is only relevant if there is no attached body. Otherwise this value will be overwritten at the next call to update.

Parameters
xThe x-coordinate of the light
yThe y-coordinate of the light

◆ setRayNum()

void cugl::physics2::lights::Light::setRayNum ( Uint32  rays)

Sets the number of rays for this light.

This is an internal method to update the associated mesh.

Parameters
raysThe number of rays for this light

◆ setReach()

void cugl::physics2::lights::Light::setReach ( float  dist)
inline

Sets the light reach

The reach is the distance that the light extends from its position.

NOTE: The minimum value should be capped to 0.1f meter. In addition, this value does not include any gamma correction.

Parameters
distThe light reach

◆ setSoft()

void cugl::physics2::lights::Light::setSoft ( bool  soft)
inline

Enables/disables softness on tips of the light beams

This value is true by default.

Parameters
softWhether to enable soft tips

◆ setSoftness()

void cugl::physics2::lights::Light::setSoftness ( float  factor)
inline

Sets the softness value for the beam tips.

This value is multiplied by the reach of the light to get the length of the soft shadows. The default value is 0.1f

Parameters
factorThe softness value for the beam tips.

◆ setStaticLight()

void cugl::physics2::lights::Light::setStaticLight ( bool  staticLight)
inline

Enables/disables light static behavior

Static lights do not get any automatic updates, but any changes to one of its parameters will update it. Static lights are useful for lights that you want to collide with static geometry but ignore all the dynamic objects. This can reduce the CPU burden of the light by about 90%.

Parameters
staticLightWhether to make this light static

◆ setXray()

void cugl::physics2::lights::Light::setXray ( bool  xray)
inline

Enables/disables x-ray beams for this light

Enabling this will allow beams to go through obstacles that reduce CPU burden of light about 70%. Use the combination of x-ray and non x-ray lights wisely,

Parameters
xrayWhether to enable x-ray beams

◆ update()

void cugl::physics2::lights::Light::update ( b2World *  world,
const Rect bounds 
)

Updates this light according to box2d.

The bounds are used for culling. Rays outside of the bounds are not processed and are set to 0.

Parameters
worldThe box2d world
boundsThe world bounds

◆ updateMesh()

virtual void cugl::physics2::lights::Light::updateMesh ( )
protectedpure virtual

Updates the mesh(es) associated with this light.

This will always update the light mesh. It will only update the debug mesh if getDebug is true.

Implemented in cugl::physics2::lights::ChainLight, cugl::physics2::lights::ConeLight, cugl::physics2::lights::DirectionalLight, and cugl::physics2::lights::PointLight.

Member Data Documentation

◆ _active

bool cugl::physics2::lights::Light::_active
protected

Whether this light is active (inactive lights do not update or render)

◆ _angle

float cugl::physics2::lights::Light::_angle
protected

The current light angle in radians

◆ _body

b2Body* cugl::physics2::lights::Light::_body
protected

The attached body (if any)

◆ _bodyAngle

float cugl::physics2::lights::Light::_bodyAngle
protected

The angle offset of the light from the body

◆ _bodyOffset

Vec2 cugl::physics2::lights::Light::_bodyOffset
protected

The positional offset from the body

◆ _color

Color4 cugl::physics2::lights::Light::_color
protected

The light color

◆ _contactFilter

b2Filter cugl::physics2::lights::Light::_contactFilter
protected

The light specific filter

◆ _debug

bool cugl::physics2::lights::Light::_debug
protected

Whether to compute the debug mesh

◆ _debugMesh

graphics::Mesh<graphics::SpriteVertex> cugl::physics2::lights::Light::_debugMesh
protected

The mesh for debugging (generated on demand)

◆ _directions

std::vector<Vec2> cugl::physics2::lights::Light::_directions
protected

The normalized direction of each ray

◆ _dirty

bool cugl::physics2::lights::Light::_dirty
protected

Whether this light requires an update

◆ _endPoints

std::vector<Vec2> cugl::physics2::lights::Light::_endPoints
protected

The current ray endpoints

◆ _fractions

std::vector<float> cugl::physics2::lights::Light::_fractions
protected

The fraction of each ray that is illuminated

◆ _gamma

float cugl::physics2::lights::Light::_gamma
protected

The gamma correction factor

◆ _globalFilter

b2Filter cugl::physics2::lights::Light::_globalFilter
staticprotected

The global filter for all lights

◆ _ignoreBody

bool cugl::physics2::lights::Light::_ignoreBody
protected

Whether this light ignores the fixtures of the attached body

◆ _lightMesh

graphics::Mesh<LightVertex> cugl::physics2::lights::Light::_lightMesh
protected

The mesh for rendering the light

◆ _lightRays

std::vector<Vec2> cugl::physics2::lights::Light::_lightRays
protected

The unmodified light rays for this light

◆ _position

Vec2 cugl::physics2::lights::Light::_position
protected

The current light position

◆ _raycast

LightRaycast cugl::physics2::lights::Light::_raycast
protected

The raycasting function for this light

◆ _rayNum

Uint32 cugl::physics2::lights::Light::_rayNum
protected

The number of light rays

◆ _reach

float cugl::physics2::lights::Light::_reach
protected

The light reach (e.g. how far the light extends)

◆ _shadowFactor

float cugl::physics2::lights::Light::_shadowFactor
protected

The percentage of the reach to make as soft shadows

◆ _soft

bool cugl::physics2::lights::Light::_soft
protected

Whether this light has soft tips

◆ _staticLight

bool cugl::physics2::lights::Light::_staticLight
protected

Whether this light ignores dynamic game elements

◆ _units

float cugl::physics2::lights::Light::_units
protected

The physics units for this light

◆ _xray

bool cugl::physics2::lights::Light::_xray
protected

Whether this light shines through obstacles

◆ DEFAULT_RAYS

int cugl::physics2::lights::Light::DEFAULT_RAYS
static

The default number of rays to use

◆ DEFAULT_REACH

float cugl::physics2::lights::Light::DEFAULT_REACH
static

The default reach for a light (in box2d units)

◆ DEFAULT_SOFTNESS

float cugl::physics2::lights::Light::DEFAULT_SOFTNESS
static

The default shadow softness (in box2d units)

◆ MIN_RAYS

const int cugl::physics2::lights::Light::MIN_RAYS
static

The minimum supported number of rays


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