Skip to content

Light

Abstract base class for all light types.

This class is not intended to be used directly. Use one of the concrete light types such as DirectionalLight, PointLight, or SpotLight unless defining a custom light implementation.

INFO

Derives from Node and inherits all public properties and methods.

Construction

Constructors


Light()

Constructs a new light.

cpp
Light::Light(Color color, float intensity);
ParameterDescription
colorLight color.
intensityLight intensity multiplier.

Types

Light::Type enum

Enumerates all supported light types.

ValueDescription
AmbientNon-directional constant light.
DirectionalInfinitely distant light with parallel rays.
PointOmnidirectional light emitting from a single point.
SpotLight emitting in a cone from a single point.

Light::Attenuation struct

Defines how light intensity diminishes over distance.

Used by point and spot lights to simulate physical light falloff. The attenuation model follows the classic convention:

where , , and correspond to base, linear, and quadratic components respectively, and is the distance from the light source.

ParameterDescription
base floatConstant term unaffected by distance.
linear floatLinear fade with distance.
quadratic floatQuadratic fade (inverse-square falloff).

Properties

color Color

Light color represented as RGB components.

cpp
Color color {0xffffff};

intensity float

Intensity multiplier applied to color.

cpp
float intensity {1.0f};

Functions

GetNodeType() Node::Type virtual

Identifies this node as Node::Type::Light.

cpp
Type vglx::Light::GetNodeType() const override;

GetType() Light::Type pure virtual

Returns the specific Type of this light.

cpp
virtual Type vglx::Light::GetType() const=0;

SetDebugMode() void virtual

Enables or disables debug visualization mode.

This mode can be used by renderers to draw light representations such as frustums, spheres, or cones for debugging purposes.

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

Released under the MIT License.