Package org.sunflow.core
Class LightSample
java.lang.Object
org.sunflow.core.LightSample
Represents a sample taken from a light source that faces a point being
shaded.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
Compute a dot product between the current shadow ray direction and the specified vector.Get diffuse radiance.Get the sample's shadow ray.Get specular radiance.void
setRadiance
(Color d, Color s) Set the diffuse and specular radiance emitted by the current light source.void
setShadowRay
(Ray shadowRay) Set the current shadow ray.final void
traceShadow
(ShadingState state) Trace the shadow ray, attenuating the sample's color by the opacity of intersected objects.
-
Constructor Details
-
LightSample
public LightSample()Creates a new light sample object (invalid by default).
-
-
Method Details
-
setShadowRay
Set the current shadow ray. The ray's direction is used as the sample's orientation.- Parameters:
shadowRay
- shadow ray from the point being shaded towards the light
-
traceShadow
Trace the shadow ray, attenuating the sample's color by the opacity of intersected objects.- Parameters:
state
- shading state representing the point to be shaded
-
getShadowRay
Get the sample's shadow ray.- Returns:
- shadow ray
-
getDiffuseRadiance
Get diffuse radiance.- Returns:
- diffuse radiance
-
getSpecularRadiance
Get specular radiance.- Returns:
- specular radiance
-
setRadiance
Set the diffuse and specular radiance emitted by the current light source. These should usually be the same, but are distinguished to allow for non-physical light setups or light source types which compute diffuse and specular responses seperately.- Parameters:
d
- diffuse radiances
- specular radiance
-
dot
Compute a dot product between the current shadow ray direction and the specified vector.- Parameters:
v
- direction vector- Returns:
- dot product of the vector with the shadow ray direction
-