Represents a third-order spherical harmonics (SH). Light probes use this class to encode lighting information.
Constructs a new spherical harmonics.
An array holding the (9) SH coefficients.
This flag can be used for type testing.
Default is true.
Adds the given SH to this instance.
sh
The SH to add.
Returns: A reference to this spherical harmonics.
A convenience method for performing SphericalHarmonics3#add and SphericalHarmonics3#scale at once.
sh
The SH to add.
s
The scale factor.
Returns: A reference to this spherical harmonics.
Returns a new spherical harmonics with copied values from this instance.
Returns: A clone of this instance.
Copies the values of the given spherical harmonics to this instance.
sh
The spherical harmonics to copy.
Returns: A reference to this spherical harmonics.
Returns true if this spherical harmonics is equal with the given one.
sh
The spherical harmonics to test for equality.
Returns: Whether this spherical harmonics is equal with the given one.
Sets the SH coefficients of this instance from the given array.
array
An array holding the SH coefficients.
offset
The array offset where to start copying.
Default is 0.
Returns: A clone of this instance.
Returns the radiance in the direction of the given normal.
normal
The normal vector (assumed to be unit length)
target
The target vector that is used to store the method's result.
Returns: The radiance.
Returns the irradiance (radiance convolved with cosine lobe) in the direction of the given normal.
normal
The normal vector (assumed to be unit length)
target
The target vector that is used to store the method's result.
Returns: The irradiance.
Linear interpolates between the given SH and this instance by the given alpha factor.
sh
The SH to interpolate with.
alpha
The alpha factor.
Returns: A reference to this spherical harmonics.
Scales this SH by the given scale factor.
s
The scale factor.
Returns: A reference to this spherical harmonics.
Sets the given SH coefficients to this instance by copying the values.
coefficients
The SH coefficients.
Returns: A reference to this spherical harmonics.
Returns an array with the SH coefficients, or copies them into the provided array. The coefficients are represented as numbers.
array
The target array.
Default is [].
offset
The array offset where to start copying.
Default is 0.
Returns: An array with flat SH coefficients.
Sets all SH coefficients to 0.
Returns: A reference to this spherical harmonics.
Computes the SH basis for the given normal vector.
normal
The normal.
shBasis
The target array holding the SH basis.