Record Class PointLight

java.lang.Object
java.lang.Record
ke.ric.renderer.api.PointLight
Record Components:
space - coordinate system for the position
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
intensity - finite artistic intensity in 0..64
range - finite maximum reach in blocks, greater than 0 and at most 64
shadows - whether this emitter casts hard shadows
All Implemented Interfaces:
VirtualLight

public record PointLight(LightSpace space, int rgb, double x, double y, double z, double intensity, double range, boolean shadows) extends Record implements VirtualLight
Immutable omnidirectional point emitter with optional hard shadows. Intensity is an artistic multiplier, not a physical unit; illumination attenuates with distance and stops at range. Use LightSpace.CAMERA to make a light follow camera position, yaw, pitch and roll.

 var key = new PointLight(LightSpace.WORLD, 0xffe2b8,
         12, 68, -4, 8, 16, true);
 var lighting = RenderLighting.studio().ambient(0.1).add(key);
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    PointLight(LightSpace space, int rgb, double x, double y, double z, double intensity, double range, boolean shadows)
    Constructs a validated immutable value.
  • Method Summary

    Modifier and Type
    Method
    Description
    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 intensity 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

    • PointLight

      public PointLight(LightSpace space, int rgb, double x, double y, double z, double intensity, double range, boolean shadows)
      Constructs a validated immutable value.
      Throws:
      IllegalArgumentException - for invalid colour, position, intensity or range
      NullPointerException - if space 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
    • 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
    • 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