Record Class SpotLight

java.lang.Object
java.lang.Record
ke.ric.renderer.api.SpotLight
Record Components:
space - coordinate system for both position and direction
rgb - 24-bit sRGB colour, 0x000000..0xffffff (no alpha channel)
x - world X, or camera-right offset, in blocks
y - world Y, or camera-up offset, in blocks
z - world Z, or camera-forward offset, in blocks
direction - normalized direction in which the emitter points
intensity - finite artistic intensity in 0..64
range - finite maximum reach in blocks, greater than 0 and at most 64
innerConeDegrees - finite full angle at which the smooth transition begins, at least 0
outerConeDegrees - finite full cutoff angle, greater than inner and at most 180
shadows - 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

    Constructors
    Constructor
    Description
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the direction record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    Returns the value of the innerConeDegrees record component.
    double
    Returns the value of the intensity record component.
    double
    Returns the value of the outerConeDegrees record component.
    double
    Returns the value of the range record component.
    int
    rgb()
    Returns the value of the rgb record component.
    boolean
    Returns the value of the shadows record component.
    Returns the value of the space record component.
    final String
    Returns a string representation of this record class.
    double
    x()
    Returns the value of the x record component.
    double
    y()
    Returns the value of the y record component.
    double
    z()
    Returns the value of the z record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 angles
      NullPointerException - if space or direction is null
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • space

      public LightSpace space()
      Returns the value of the space record component.
      Specified by:
      space in interface VirtualLight
      Returns:
      the value of the space record component
    • rgb

      public int rgb()
      Returns the value of the rgb record component.
      Specified by:
      rgb in interface VirtualLight
      Returns:
      the value of the rgb record component
    • x

      public double x()
      Returns the value of the x record component.
      Specified by:
      x in interface VirtualLight
      Returns:
      the value of the x record component
    • y

      public double y()
      Returns the value of the y record component.
      Specified by:
      y in interface VirtualLight
      Returns:
      the value of the y record component
    • z

      public double z()
      Returns the value of the z record component.
      Specified by:
      z in interface VirtualLight
      Returns:
      the value of the z record component
    • direction

      public LightDirection direction()
      Returns the value of the direction record component.
      Returns:
      the value of the direction record component
    • intensity

      public double intensity()
      Returns the value of the intensity record component.
      Specified by:
      intensity in interface VirtualLight
      Returns:
      the value of the intensity record component
    • range

      public double range()
      Returns the value of the range record component.
      Specified by:
      range in interface VirtualLight
      Returns:
      the value of the range record component
    • innerConeDegrees

      public double innerConeDegrees()
      Returns the value of the innerConeDegrees record component.
      Returns:
      the value of the innerConeDegrees record component
    • outerConeDegrees

      public double outerConeDegrees()
      Returns the value of the outerConeDegrees record component.
      Returns:
      the value of the outerConeDegrees record component
    • shadows

      public boolean shadows()
      Returns the value of the shadows record component.
      Specified by:
      shadows in interface VirtualLight
      Returns:
      the value of the shadows record component