Package ke.ric.renderer.api
Record Class SpotLight
java.lang.Object
java.lang.Record
ke.ric.renderer.api.SpotLight
- Record Components:
space- coordinate system for both position and directionrgb- 24-bit sRGB colour, 0x000000..0xffffff (no alpha channel)x- world X, or camera-right offset, in blocksy- world Y, or camera-up offset, in blocksz- world Z, or camera-forward offset, in blocksdirection- normalized direction in which the emitter pointsintensity- finite artistic intensity in 0..64range- finite maximum reach in blocks, greater than 0 and at most 64innerConeDegrees- finite full angle at which the smooth transition begins, at least 0outerConeDegrees- finite full cutoff angle, greater than inner and at most 180shadows- whether this emitter casts hard shadows
- All Implemented Interfaces:
VirtualLight
public record SpotLight(LightSpace space, int rgb, double x, double y, double z, LightDirection direction, double intensity, double range, double innerConeDegrees, double outerConeDegrees, boolean shadows)
extends Record
implements VirtualLight
Immutable directional spot emitter with a smooth falloff between its inner and outer cones.
Cone values are full angles in degrees, not half-angles. Position and direction use the same
LightSpace; camera-relative lights follow position, yaw, pitch and roll even during reuse.
Intensity is artistic rather than a physical unit. Requested shadows are hard shadows.
var flash = new SpotLight(LightSpace.CAMERA, 0xffffff,
0, 0, 0, new LightDirection(0, 0, 1), 8, 16, 30, 60, true);
-
Constructor Summary
ConstructorsConstructorDescriptionSpotLight(LightSpace space, int rgb, double x, double y, double z, LightDirection direction, double intensity, double range, double innerConeDegrees, double outerConeDegrees, boolean shadows) Constructs a validated immutable value. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleReturns the value of theinnerConeDegreesrecord component.doubleReturns the value of theintensityrecord component.doubleReturns the value of theouterConeDegreesrecord component.doublerange()Returns the value of therangerecord component.intrgb()Returns the value of thergbrecord component.booleanshadows()Returns the value of theshadowsrecord component.space()Returns the value of thespacerecord component.final StringtoString()Returns a string representation of this record class.doublex()Returns the value of thexrecord component.doubley()Returns the value of theyrecord component.doublez()Returns the value of thezrecord component.
-
Constructor Details
-
SpotLight
public SpotLight(LightSpace space, int rgb, double x, double y, double z, LightDirection direction, double intensity, double range, double innerConeDegrees, double outerConeDegrees, boolean shadows) Constructs a validated immutable value.- Throws:
IllegalArgumentException- for invalid colour, position, intensity, range or cone anglesNullPointerException- if space or direction is null
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
space
Returns the value of thespacerecord component.- Specified by:
spacein interfaceVirtualLight- Returns:
- the value of the
spacerecord component
-
rgb
public int rgb()Returns the value of thergbrecord component.- Specified by:
rgbin interfaceVirtualLight- Returns:
- the value of the
rgbrecord component
-
x
public double x()Returns the value of thexrecord component.- Specified by:
xin interfaceVirtualLight- Returns:
- the value of the
xrecord component
-
y
public double y()Returns the value of theyrecord component.- Specified by:
yin interfaceVirtualLight- Returns:
- the value of the
yrecord component
-
z
public double z()Returns the value of thezrecord component.- Specified by:
zin interfaceVirtualLight- Returns:
- the value of the
zrecord component
-
direction
Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
intensity
public double intensity()Returns the value of theintensityrecord component.- Specified by:
intensityin interfaceVirtualLight- Returns:
- the value of the
intensityrecord component
-
range
public double range()Returns the value of therangerecord component.- Specified by:
rangein interfaceVirtualLight- Returns:
- the value of the
rangerecord component
-
innerConeDegrees
public double innerConeDegrees()Returns the value of theinnerConeDegreesrecord component.- Returns:
- the value of the
innerConeDegreesrecord component
-
outerConeDegrees
public double outerConeDegrees()Returns the value of theouterConeDegreesrecord component.- Returns:
- the value of the
outerConeDegreesrecord component
-
shadows
public boolean shadows()Returns the value of theshadowsrecord component.- Specified by:
shadowsin interfaceVirtualLight- Returns:
- the value of the
shadowsrecord component
-