t
Loading...
Searching...
No Matches
t::PointLight Class Reference

The point light, which gets emitted from a single point in all directions. More...

#include <PointLight.hpp>

Inheritance diagram for t::PointLight:
t::Light t::Object3D

Public Member Functions

 PointLight (Color color, double intensity)
 Creates a new point light with the specified color and intensity.
 
bool isPointLight () const override
 Returns whether or not this light is a point light.
 
double power () const
 Returns the power of this light.
 
- Public Member Functions inherited from t::Light
bool isLight () const override
 Returns whether or not this 3D object is a light.
 
virtual bool isAmbientLight () const
 Returns whether or not this light is an ambient light.
 
virtual bool isDirectionalLight () const
 Returns whether or not this light is a directional light.
 
virtual bool isSpotLight () const
 Returns whether or not this light is a spot light.
 
- Public Member Functions inherited from t::Object3D
virtual bool isMesh () const
 Returns whether this 3D object is a mesh.
 
Object3Dadd (Object3D &child)
 Adds another 3D object as a child of this 3D object.
 
Object3Dtranslate (double x, double y, double z)
 Translates this 3D object by the specified amounts along the x, y, and z axes in local space.
 
Object3Drotate (double x, double y, double z, EulerRotationOrder order)
 Rotates this 3D object by the specified angles around the x, y, and z axes in local space.
 
Object3Dscale (double x, double y, double z)
 Scales this 3D object by the specified amounts along the x, y, and z axes in local space.
 
Object3DupdateLocalMatrix ()
 Updates the local transformation matrix of this 3D object.
 
Object3DupdateModelMatrix ()
 Updates the model matrix of this 3D object.
 

Public Attributes

Color color
 The color of this point light.
 
double intensity
 The intensity of this point light in candela (cd).
 
- Public Attributes inherited from t::Object3D
std::optional< std::reference_wrapper< Object3D > > parent
 The parent of this 3D object.
 
Vector3 up = DEFAULT_UP
 The vector pointing to the up direction in object space.
 
Vector3 localPosition
 The position of this 3D object relative to its parent.
 
EulerRotation localRotation
 The rotation of this 3D object relative to its parent.
 
Vector3 localScale
 The scale of this 3D object relative to its parent.
 
Matrix4x4 localMatrix
 The matrix of the local transformation of this 3D object.
 
Matrix4x4 modelMatrix
 The model matrix of this 3D object, transformating local space to world space.
 
std::vector< std::reference_wrapper< Object3D > > children
 The children of this 3D object.
 

Detailed Description

The point light, which gets emitted from a single point in all directions.

Point lights are some of the most common lights in 3D graphics. They can be used, for example, to represent lights from light bulbs or fireflies.

For the BlinnPhong material, the light's color contribution will be \(c = \text{diffuse color} \times \text{light's intensity} \times (\text{specular} + \text{diffuse})\). The specular and diffuse components do not rely on the light's intensity.

Constructor & Destructor Documentation

◆ PointLight()

t::PointLight::PointLight ( Color color,
double intensity )
inline

Creates a new point light with the specified color and intensity.

Parameters
colorThe color of the new point light.
intensityThe intensity of the new point light in candela (cd).

Member Function Documentation

◆ isPointLight()

bool t::PointLight::isPointLight ( ) const
inlineoverridevirtual

Returns whether or not this light is a point light.

Always returns true. May be used in vertex and fragment shaders to determine the type of light and make a cast from Light appropriately.

Returns
true

Reimplemented from t::Light.

◆ power()

double t::PointLight::power ( ) const
inline

Returns the power of this light.

The power of this light is in lumens (lm) and is calculated as \(\text{intensity} \times 4 \times \pi\).

Returns
The power of this light in lumens (lm).

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