Pogosim
Loading...
Searching...
No Matches
RotatingRayOfLightObject Class Reference

Single ray of light that sweeps around its centre, and that becomes visible only after an optional photo-start delay. More...

#include <lights.h>

Inheritance diagram for RotatingRayOfLightObject:
Object

Public Member Functions

 RotatingRayOfLightObject (float x, float y, ObjectGeometry &geom, LightLevelMap *light_map, int16_t value, float ray_half_width=0.1f, float angular_speed=3.0f, float photo_start_at=-1.0f, float photo_start_dur=1.0f, float _white_frame_dur=1.0f, int16_t _white_frame_val=32767, std::string const &category="objects")
 RotatingRayOfLightObject (Simulation *simulation, float x, float y, LightLevelMap *light_map, Configuration const &config, std::string const &category="objects")
void render (SDL_Renderer *, b2WorldId) const override
 Renders the object on the given SDL renderer.
void update_light_map (LightLevelMap &l)
void launch_user_step (float t) override
 Launches the user-defined step function.
Public Member Functions inherited from Object
 Object (float _x, float _y, ObjectGeometry &_geom, std::string const &_category="objects")
 Constructs an Object.
 Object (Simulation *simulation, float _x, float _y, Configuration const &config, std::string const &_category="objects")
 Constructs an Object from a configuration entry.
virtual ~Object ()
 Destructor.
ObjectGeometryget_geometry ()
 Return the object's geometry.
virtual void move (float x, float y, float theta=NAN)
 Move the object to a given coordinate.
virtual bool is_tangible () const
 Returns whether this object is tangible (e.g. collisions, etc) or not.
virtual arena_polygons_t generate_contours (std::size_t points_per_contour=0) const
 Return one or more polygonal contours that represent the geometry of the object.

Protected Member Functions

void parse_configuration (Configuration const &config, Simulation *simulation) override
 Parse a provided configuration and set associated members values.
void start_white_frame (float now_s)

Additional Inherited Members

Public Attributes inherited from Object
float x
 X position.
float y
 Y position.
float theta
 Orientation (in rad).
std::string category
 Category of the object.
Protected Attributes inherited from Object
ObjectGeometrygeom
 Geometry of the object.

Detailed Description

Single ray of light that sweeps around its centre, and that becomes visible only after an optional photo-start delay.

The object overwrites each covered light-map bin with either value (inside the ray) or 0 (outside the ray) via LightLevelMap::set_light_level().

Parameters
angular_speedSweep speed in rad · s⁻¹ (default = 3).
ray_half_widthHalf the angular aperture of the ray in radians (default ≈ 5.7 ° = 0.1 rad).

Constructor & Destructor Documentation

◆ RotatingRayOfLightObject() [1/2]

RotatingRayOfLightObject::RotatingRayOfLightObject ( float x,
float y,
ObjectGeometry & geom,
LightLevelMap * light_map,
int16_t value,
float ray_half_width = 0.1f,
float angular_speed = 3.0f,
float photo_start_at = -1.0f,
float photo_start_dur = 1.0f,
float _white_frame_dur = 1.0f,
int16_t _white_frame_val = 32767,
std::string const & category = "objects" )

◆ RotatingRayOfLightObject() [2/2]

RotatingRayOfLightObject::RotatingRayOfLightObject ( Simulation * simulation,
float x,
float y,
LightLevelMap * light_map,
Configuration const & config,
std::string const & category = "objects" )

Member Function Documentation

◆ launch_user_step()

void RotatingRayOfLightObject::launch_user_step ( float f)
overridevirtual

Launches the user-defined step function.

Parameters
tcurrent simulation time

Reimplemented from Object.

◆ parse_configuration()

void RotatingRayOfLightObject::parse_configuration ( Configuration const & config,
Simulation * simulation )
overrideprotectedvirtual

Parse a provided configuration and set associated members values.

Parameters
configConfiguration entry describing the object properties.

Reimplemented from Object.

◆ render()

void RotatingRayOfLightObject::render ( SDL_Renderer * renderer,
b2WorldId world_id ) const
inlineoverridevirtual

Renders the object on the given SDL renderer.

Parameters
rendererPointer to the SDL_Renderer.
world_idThe Box2D world identifier (unused in rendering).

Implements Object.

◆ start_white_frame()

void RotatingRayOfLightObject::start_white_frame ( float now_s)
protected

◆ update_light_map()

void RotatingRayOfLightObject::update_light_map ( LightLevelMap & l)

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