PointLight
A point light simulates a localized light source such as a bare lightbulb. Intensity follows physical inverse-square falloff, so intensity represents the light's brightness at a distance of one unit.
my_scene->Add(vglx::PointLight::Create({
.color = 0xFFFFFF,
.intensity = 25.0f,
.range = 0.0f
}));INFO
Derives from Light and inherits all public properties and methods.
Construction
Constructors
PointLight()
Constructs a point light.
PointLight::PointLight(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters for constructing the light. |
Factories preferred
PointLight::Create() std::unique_ptr<PointLight>
Creates an instance of PointLight with default parameters.
static std::unique_ptr<PointLight> PointLight::Create();PointLight::Create() std::unique_ptr<PointLight>
Creates an instance of PointLight.
static std::unique_ptr<PointLight> PointLight::Create(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters for constructing the light. |
Types
PointLight::Parameters struct
Parameters for constructing a PointLight object.
| Parameter | Description |
|---|---|
| color Color | Light color. |
| intensity float | Light intensity multiplier. |
| range float | Maximum range of influence. 0 = unbounded. |
| cast_shadow bool | Enables shadow casting for this light. |
Properties
cast_shadow bool
When true this light casts shadows.
bool cast_shadow {false};range float
Maximum range of influence in world units.
Falloff is smoothly windowed to reach zero at this distance. A value of 0 disables the cutoff, leaving pure inverse-square falloff.
float range {0.0f};Shadow configuration used when cast_shadow is enabled.
Shadow shadow {};Functions
GetPower() float
Returns the light's luminous power in lumens.
Power is the total light emitted in all directions: , where is intensity in candela.
float PointLight::GetPower() const;GetType() Light::Type virtual
Identifies this light as Light::Type::Point.
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.
void PointLight::OnUpdate(float delta) override;| Parameter | Description |
|---|---|
| delta | Time 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.
void PointLight::SetDebugMode(bool is_debug_mode) override;| Parameter | Description |
|---|---|
| is_debug_mode | true to enable debug mode; false to disable. |