Class LightSource

java.lang.Object
com.github.yellowstonegames.grid.LightSource
All Implemented Interfaces:
com.github.yellowstonegames.core.ISerializersNeeded

public class LightSource extends Object implements com.github.yellowstonegames.core.ISerializersNeeded
A tiny data wrapper around a radiance and a Coord position for that Radiance, as well as, optionally, an angle to project a cone of light in and a span for how wide of a cone to project.
  • Field Details

    • radiance

      public Radiance radiance
    • position

      public Coord position
    • span

      public float span
      How wide of an arc the light source covers, measured in turns (0-1).
    • direction

      public float direction
      The angle the light source emits light towards, measured in turns (0-1, counterclockwise from right). If span is 1 or greater, this has no effect.
  • Constructor Details

    • LightSource

      public LightSource()
    • LightSource

      public LightSource(Coord position, Radiance radiance)
    • LightSource

      public LightSource(Coord position, Radiance radiance, float spanTurns, float directionTurns)
  • Method Details

    • getRadiance

      public Radiance getRadiance()
    • setRadiance

      public void setRadiance(Radiance radiance)
    • getPosition

      public Coord getPosition()
    • setPosition

      public void setPosition(Coord position)
    • getSpan

      public float getSpan()
    • setSpan

      public void setSpan(float spanTurns)
      Parameters:
      spanTurns - how wide of an arc this should spread light into, measured in turns (0-1)
    • getDirection

      public float getDirection()
    • setDirection

      public void setDirection(float directionTurns)
      Parameters:
      directionTurns - what angle the light should project in, measured in turns (0-1, counterclockwise from right)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • stringSerialize

      public String stringSerialize()
    • stringDeserialize

      public LightSource stringDeserialize(String data)
    • recreateFromString

      public static LightSource recreateFromString(String data)
    • getSerializersNeeded

      public List<Class<?>> getSerializersNeeded()
      Specified by:
      getSerializersNeeded in interface com.github.yellowstonegames.core.ISerializersNeeded