Interface Light
- All Known Implementing Classes:
AbstractLight, DistantLight, PointLight, SpotLight
public interface Light
Top level interface to model a light element. A light is responsible for
computing the light vector on a given point of a surface. A light is
typically in a 3 dimensional space and the methods assumes the surface
is at elevation 0.
-
Method Summary
Modifier and TypeMethodDescriptiondouble[]getColor(boolean linear) voidgetLight(double x, double y, double z, double[] L) Computes the light vector in (x, y)double[][][]getLightMap(double x, double y, double dx, double dy, int width, int height, double[][][] z) Returns a light map, starting in (x, y) with dx, dy increments, a given width and height, and z elevations stored in the fourth component on the N array.double[][]getLightRow(double x, double y, double dx, int width, double[][] z, double[][] lightRow) Returns a row of the light map, starting at (x, y) with dx increments, a given width, and z elevations stored in the fourth component on the N array.booleanvoidSets the light color to a new value
-
Method Details
-
isConstant
boolean isConstant()- Returns:
- true if the light is constant over the whole surface
-
getLight
void getLight(double x, double y, double z, double[] L) Computes the light vector in (x, y)- Parameters:
x- x-axis coordinate where the light should be computedy- y-axis coordinate where the light should be computedz- z-axis coordinate where the light should be computedL- array of length 3 where the result is stored
-
getLightMap
double[][][] getLightMap(double x, double y, double dx, double dy, int width, int height, double[][][] z) Returns a light map, starting in (x, y) with dx, dy increments, a given width and height, and z elevations stored in the fourth component on the N array.- Parameters:
x- x-axis coordinate where the light should be computedy- y-axis coordinate where the light should be computeddx- delta x for computing light vectors in user spacedy- delta y for computing light vectors in user spacewidth- number of samples to compute on the x axisheight- number of samples to compute on the y axisz- array containing the z elevation for all the points- Returns:
- an array of height rows, width columns where each element is an array of three components representing the x, y and z components of the light vector.
-
getLightRow
double[][] getLightRow(double x, double y, double dx, int width, double[][] z, double[][] lightRow) Returns a row of the light map, starting at (x, y) with dx increments, a given width, and z elevations stored in the fourth component on the N array.- Parameters:
x- x-axis coordinate where the light should be computedy- y-axis coordinate where the light should be computeddx- delta x for computing light vectors in user spacewidth- number of samples to compute on the x axisz- array containing the z elevation for all the pointslightRow- array to store the light info to, if null it will be allocated for you and returned.- Returns:
- an array width columns where each element is an array of three components representing the x, y and z components of the light vector.
-
getColor
double[] getColor(boolean linear) - Parameters:
linear- if true the color is returned in the Linear sRGB colorspace otherwise the color is in the gamma corrected sRGB color space.- Returns:
- the light's color
-
setColor
Sets the light color to a new value
-