Skip to content

PointLight

Represents a light that gets emitted from a single point in all directions.

A common use case for this is to replicate the light emitted from a bare lightbulb.

cpp
auto point_light = 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()

cpp
vglx::PointLight::PointLight(const Parameters &params)
ParameterDescription
paramsPointLight::Parameters

Constructs a PointLight object.

Factories preferred


PointLight::Create() auto

cpp
static auto vglx::PointLight::Create(const Parameters &params)
ParameterDescription
paramsPointLight::Parameters

Creates a shared pointer to an PointLight object.

Types

PointLight::Parameters struct

Parameters for constructing a PointLight object.

NameTypeDescription
attenuationAttenuationLight attenuation properties.
colorColorLight color.
intensityfloatLight intensity.

Properties

attenuation Attenuation

cpp
Attenuation attenuation

Light attenuation properties.

Functions

GetType() LightType virtual

cpp
LightType vglx::PointLight::GetType() const override

Returns light type.

OnUpdate() void virtual

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

Updates the light each frame.

SetDebugMode() void virtual

cpp
void vglx::PointLight::SetDebugMode(bool is_debug_mode) override
ParameterDescription
is_debug_modeTrue to enable debug mode, false to disable.

Sets debug mode.

Released under the MIT License.