Skip to content

PointLight

Represents a light that emits from a single point in all directions.

A point light simulates a localized light source such as a bare lightbulb. Intensity falls off with distance according to the configured attenuation parameters.

cpp
auto point = vglx::PointLight::Create({
  .color = 0xFFFFFF,
  .intensity = 1.0f,
  .attenuation = {
    .base = 1.0f,
    .linear = 0.0f,
    .quadratic = 0.0f
  }
});

INFO

Derives from Light and inherits all public properties and methods.

Construction

Constructors


PointLight()

Constructs a point light.

cpp
PointLight::PointLight(const Parameters& params);
ParameterDescription
paramsInitialization parameters for constructing the light.

Factories preferred


PointLight::Create() auto

Creates a shared instance of PointLight.

cpp
static auto PointLight::Create(const Parameters& params);
ParameterDescription
paramsInitialization parameters for constructing the light.

Types

PointLight::Parameters struct

Parameters for constructing a PointLight object.

ParameterDescription
color ColorLight color.
intensity floatLight intensity multiplier.
attenuation AttenuationLight attenuation parameters.

Properties

attenuation Attenuation

Attenuation parameters controlling distance-based falloff.

cpp
Attenuation attenuation {};

Functions

GetType() Light::Type virtual

Identifies this light as Light::Type::Point.

cpp
Type vglx::PointLight::GetType() const override;

OnUpdate() void virtual

Called once per frame to update the light state.

Currently used to update the debug geometry when debug mode is enabled.

cpp
void PointLight::OnUpdate(float delta) override;
ParameterDescription
deltaTime in seconds since the last frame.

SetDebugMode() void virtual

Enables or disables debug visualization for this light.

When enabled, the renderer will visualize the light’s location using a spherical line geometry.

cpp
void PointLight::SetDebugMode(bool is_debug_mode) override;
ParameterDescription
is_debug_modetrue to enable debug mode; false to disable.

Released under the MIT License.