Light

enum class huira::LightType

Specifies the type of light source.

Values:

enumerator Point
enumerator Sphere
template<IsSpectral TSpectral>
struct LightSample

Represents a sampled light contribution at a point.

Template Parameters:

TSpectral – The spectral representation type.

Public Members

Vec3<float> wi

Incident direction from surface to light (normalized)

TSpectral Li

Incident radiance from the light.

float distance

Distance from the surface point to the light.

float pdf

Probability density function value for this sample.

template<IsSpectral TSpectral>
class Light : public huira::SceneObject<Light<TSpectral>, TSpectral>

Abstract base class for all light sources in the scene.

Provides an interface for sampling light contributions, evaluating PDFs, and computing irradiance. All lights have a unique ID for identification.

Template Parameters:

TSpectral – The spectral representation type.

Subclassed by huira::PointLight< TSpectral >

Public Functions

inline Light()
Light(const Light&) = delete
Light &operator=(const Light&) = delete
virtual ~Light() override = default
virtual std::optional<LightSample<TSpectral>> sample_li(const Interaction<TSpectral> &ref, const Transform<float> &light_to_world, const Sampler<float> &sampler) const = 0
virtual float pdf_li(const Interaction<TSpectral> &ref, const Transform<float> &light_to_world, const Vec3<float> &wi) const = 0
virtual TSpectral irradiance_at(const Vec3<float> &position, const Transform<float> &light_to_world) const = 0
virtual LightType get_type() const = 0
inline virtual std::uint64_t id() const override

Get the object’s unique ID.

Returns:

std::uint64_t ID

inline bool is_scene_owned() const

Check if the object is owned by the scene.

Returns:

bool True if owned

inline void set_scene_owned(bool owned)

Set scene ownership flag.

Parameters:

owned – True if owned

inline std::string name() const

Get the object’s name.

Returns:

std::string Name

virtual std::string type() const = 0

Get the object’s type string.

Returns:

std::string Type

inline virtual std::string get_info() const

Get a descriptive info string for the object.

Returns:

std::string Info string

Protected Attributes

std::uint64_t id_ = 0

Protected Static Attributes

static std::uint64_t next_id_ = 0