org.sunflow.core
Class LightSample
java.lang.Object
org.sunflow.core.LightSample
public class LightSample
extends java.lang.Object
Represents a sample taken from a light source that faces a point being
shaded.
LightSample() - Creates a new light sample object (invalid by default).
|
LightSample
public LightSample()
Creates a new light sample object (invalid by default).
dot
public float dot(Vector3 v)
Compute a dot product between the current shadow ray direction and the
specified vector.
- dot product of the vector with the shadow ray direction
getDiffuseRadiance
public Color getDiffuseRadiance()
Get diffuse radiance.
getShadowRay
public Ray getShadowRay()
Get the sample's shadow ray.
getSpecularRadiance
public Color getSpecularRadiance()
Get specular radiance.
setRadiance
public void setRadiance(Color d,
Color s)
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.
d
- diffuse radiances
- specular radiance
setShadowRay
public void setShadowRay(Ray shadowRay)
Set the current shadow ray. The ray's direction is used as the sample's
orientation.
shadowRay
- shadow ray from the point being shaded towards the light
traceShadow
public final void traceShadow(ShadingState state)
Trace the shadow ray, attenuating the sample's color by the opacity of
intersected objects.
state
- shading state representing the point to be shaded