Unresolved Object

template<IsSpectral TSpectral>
class UnresolvedObject : public huira::SceneObject<UnresolvedObject<TSpectral>>

Represents an unresolved object to be rendered.

UnresolvedObject serves as a base class for objects whose irradiance at the camera is computed from the state of the scene. A scene view resolves the irradiance of each of its instances, at each of the instance’s temporal samples, by resolve_irradiance(), which subclasses override. This base class gives the irradiance it is given, wherever and however often it is placed.

The irradiance resolved for an instance belongs to the scene view (see SceneView::unresolved_irradiance()), not to the object: one object can be placed several times, and be seen by several views, each instance with its own.

Template Parameters:

TSpectral – The spectral type (e.g., RGB, Visible8)

Subclassed by huira::UnresolvedAsteroid< TSpectral >, huira::UnresolvedEmitter< TSpectral >, huira::UnresolvedLambertianSphere< TSpectral >

Public Functions

UnresolvedObject() = default
UnresolvedObject(const units::SpectralWattsPerMeterSquared<TSpectral> &spectral_irradiance)

Constructs an UnresolvedObject with specified spectral irradiance.

Creates an unresolved object and initializes its spectral irradiance value. The provided irradiance is validated to ensure all components are non-negative and finite.

Parameters:

spectral_irradiance – The initial spectral irradiance in \(W \cdot m^{-2}\).

Throws:

std::runtime_error – if the irradiance contains invalid values.

UnresolvedObject(const units::WattsPerMeterSquared &irradiance)

Constructs an UnresolvedObject from total irradiance.

Creates an unresolved object with a total irradiance value that is distributed across spectral bins proportionally to their wavelength widths.

Parameters:

irradiance – The total irradiance in \(W \cdot m^{-2}\).

Throws:

std::runtime_error – if the irradiance is negative, NaN, or infinite.

UnresolvedObject(const UnresolvedObject&) = delete
UnresolvedObject &operator=(const UnresolvedObject&) = delete
void set_irradiance(const units::SpectralWattsPerMeterSquared<TSpectral> &spectral_irradiance)

Sets the spectral irradiance of the unresolved object.

Updates the object’s irradiance. All spectral components must be non-negative, as negative irradiance is physically meaningless.

Parameters:

spectral_irradiance – The new spectral irradiance value in \(W \cdot m^{-2}\).

Throws:

std::runtime_error – if any irradiance component is negative.

void set_irradiance(const units::WattsPerMeterSquared &irradiance)

Sets the total irradiance of the unresolved object.

Updates the object’s irradiance by converting a total irradiance value (in watts per square meter) to the spectral representation. The total irradiance must be non-negative, as negative values are physically meaningless.

Parameters:

irradiance – The new total irradiance value in \(W \cdot m^{-2}\).

Throws:

std::runtime_error – if the total irradiance is negative, NaN, or infinite.

inline TSpectral get_irradiance() const

The irradiance it was given, by its constructor or set_irradiance().

virtual std::vector<TSpectral> resolve_irradiance(const std::vector<Transform<float>> &self_transforms, const std::vector<Time> &times, const SceneView<TSpectral> &scene_view, RandomSampler<float> &sampler) const

Resolves the spectral irradiance of an instance from the scene’s state.

This method provides a hook for subclasses to compute an instance’s irradiance at the camera at each of its temporal samples, from its transforms and the contents of the scene view (lights, occluders, indirect sources). It is called by SceneView for each instance, after the acceleration structure has been built, so implementations may cast rays through the view; the view keeps what it returns, for that instance (see SceneView::unresolved_irradiance()). The default gives the irradiance the object was given.

Parameters:
  • self_transforms – Camera-relative transforms of the instance, one per temporal sample.

  • times – Absolute times of the temporal samples (same size as self_transforms).

  • scene_view – The fully constructed scene view.

  • sampler – Random sampler for stochastic irradiance estimation.

Returns:

The irradiance at each temporal sample, or one for all of them. Each must be finite and non-negative.

inline virtual std::string type() const override

Get the object’s type string.

Returns:

std::string Type

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

inline virtual std::uint64_t id() const

Get the object’s unique ID.

Returns:

std::uint64_t ID

inline virtual std::string get_info() const

Get a descriptive info string for the object.

Returns:

std::string Info string

Protected Attributes

TSpectral irradiance_ = {0}

The irradiance it was given.