Class StandardLight

java.lang.Object
org.dark.shaders.light.StandardLight
All Implemented Interfaces:
LightAPI

public class StandardLight extends Object implements LightAPI
A specialization of LightAPI suited for every case wherein the default, automatic lighting behaviors are sufficient.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected float
     
    protected float
     
    protected com.fs.starfarer.api.combat.CombatEntityAPI
     
    protected float
     
    protected com.fs.starfarer.api.combat.BeamAPI
     
    protected com.fs.starfarer.api.combat.BeamAPI
     
    protected final org.lwjgl.util.vector.Vector3f
     
    protected final Deque<Boolean>
     
    protected boolean
     
    protected final org.lwjgl.util.vector.Vector3f
     
    protected float
     
    protected float
     
    protected float
     
    protected float
     
    protected boolean
     
    protected boolean
     
    protected float
     
    protected boolean
     
    protected final org.lwjgl.util.vector.Vector2f
     
    protected final org.lwjgl.util.vector.Vector2f
     
    protected final org.lwjgl.util.vector.Vector2f
     
    protected float
     
    protected float
     
    protected float
     
    protected float
     
    protected int
     
    protected final org.lwjgl.util.vector.Vector2f
     
    protected final org.lwjgl.util.vector.Vector2f
     
    protected static final org.lwjgl.util.vector.Vector2f
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a generic light.
    StandardLight(float intensity, float size)
    Constructs a generic light.
    StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, float arcEnd, float arcStart)
    Constructs a cone light.
    StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, float arcEnd, float arcStart, float intensity, float size)
    Constructs a cone light.
    StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, com.fs.starfarer.api.combat.BeamAPI beamLink, boolean linkToEnd)
    Constructs a point light, attached to a beam endpoint.
    StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, com.fs.starfarer.api.combat.BeamAPI beamLink, boolean linkToEnd, float intensity, float size)
    Constructs a point light, attached to a beam endpoint.
    StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, org.lwjgl.util.vector.Vector2f offset, com.fs.starfarer.api.combat.CombatEntityAPI attach)
    Constructs a point light.
    StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, org.lwjgl.util.vector.Vector2f offset, com.fs.starfarer.api.combat.CombatEntityAPI attach, float intensity, float size)
    Constructs a point light.
    StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f location2, org.lwjgl.util.vector.Vector2f velocity, org.lwjgl.util.vector.Vector2f velocity2, com.fs.starfarer.api.combat.BeamAPI beamAttach)
    Constructs a line light.
    StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f location2, org.lwjgl.util.vector.Vector2f velocity, org.lwjgl.util.vector.Vector2f velocity2, com.fs.starfarer.api.combat.BeamAPI beamAttach, float intensity, float size)
    Constructs a line light.
    StandardLight(org.lwjgl.util.vector.Vector3f direction)
    Constructs a directional light.
    StandardLight(org.lwjgl.util.vector.Vector3f direction, float intensity)
    Constructs a directional light.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    advance(float amount)
    Runs once per frame.
    void
    attachTo(com.fs.starfarer.api.combat.CombatEntityAPI attach)
    Attaches the light to an entity.
    void
    attachToBeam(com.fs.starfarer.api.combat.BeamAPI beamAttach)
    Attaches the light to a beam.
    protected static org.lwjgl.util.vector.Vector2f
    computeOffset(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f offset, float angle)
     
    void
    fadeIn(float seconds)
    Fades in the light over a period of time.
    void
    fadeOut(float seconds)
    Fades the light out over a period of time.
    float
    The end of the current visible arc of the light, in degrees.
    float
    The start of the current visible arc of the light, in degrees.
    com.fs.starfarer.api.combat.CombatEntityAPI
    Gets the entity that the light is attached to.
    float
    Gets the time the light takes to fade out if it is automatically flagged to fade out by the lighting system.
    com.fs.starfarer.api.combat.BeamAPI
    Gets the beam that the light is attached to.
    com.fs.starfarer.api.combat.BeamAPI
    Gets the location that the light is attached to, if it is attached to a beam's origin or endpoint.
    org.lwjgl.util.vector.Vector3f
    Gets the light's color.
    org.lwjgl.util.vector.Vector3f
    Gets the light's directional vector.
    float
    Gets the height of the light, in world-space units.
    float
    Gets the light's intensity.
    float
    Gets the change in intensity over time.
    float
    Gets the maximum intensity to reach.
    org.lwjgl.util.vector.Vector2f
    Gets the current location of the light.
    org.lwjgl.util.vector.Vector2f
    Gets the current location of the light's secondary endpoint.
    org.lwjgl.util.vector.Vector2f
    Gets the attachment offset of the light.
    float
    Gets the remaining time the light has before it fades or disappears, depending on parameters.
    float
    Gets the light's size.
    float
    Gets the specular intensity of the light.
    float
    Gets the specular multiplier of the light.
    int
    Gets the light's type.
    org.lwjgl.util.vector.Vector2f
    Gets the current velocity of the light.
    org.lwjgl.util.vector.Vector2f
    Gets the current velocity of the secondary endpoint of the light.
    boolean
    Returns whether the light is fading in or not.
    boolean
    Returns whether the light is fading out or not.
    void
    linkToBeam(com.fs.starfarer.api.combat.BeamAPI beamLink, boolean linkToEnd)
    Attaches the light to the origin or the endpoint of a beam.
    void
    Makes the light permanent.
    void
    setArc(float start, float end)
    Sets the visible arc of the light, in degrees.
    void
    setAutoFadeOutTime(float autoFadeOutTime)
    Sets the time the light takes to fade out if it is automatically flagged to fade out by the lighting system.
    void
    setColor(float red, float green, float blue)
    Sets the light to a particular color.
    void
    setColor(Color color)
    Sets the light to a particular color.
    void
    setColor(org.lwjgl.util.vector.Vector3f color)
    Sets the light to a particular color.
    void
    setDirection(org.lwjgl.util.vector.Vector3f direction)
    Sets the light's directional vector.
    void
    setHeight(float height)
    Sets the height of the light, in world-space units.
    void
    setIntensity(float intensity)
    Sets the light's intensity.
    void
    setIntensityFade(float intensityFade)
    Sets the change in intensity over time.
    void
    setIntensityMax(float intensityMax)
    Sets the maximum intensity to reach.
    void
    setLifetime(float lifetime)
    Gives the light a lifetime timer.
    void
    setLocation(org.lwjgl.util.vector.Vector2f location)
    Sets the location of the light.
    void
    setLocation2(org.lwjgl.util.vector.Vector2f location)
    Sets the secondary endpoint of the light.
    void
    setOffset(org.lwjgl.util.vector.Vector2f offset)
    Sets the attachment offset of the light.
    void
    setSize(float size)
    Sets the light's size.
    void
    setSpecularIntensity(float intensity)
    Sets the specular intensity of the light.
    void
    setSpecularMult(float multiplier)
    Sets the specular multiplier of the light.
    void
    setType(int type)
    Sets the light's type.
    void
    setVelocity(org.lwjgl.util.vector.Vector2f velocity)
    Sets the velocity for the light.
    void
    setVelocity2(org.lwjgl.util.vector.Vector2f velocity)
    Sets the velocity for the secondary endpoint of the light.
    void
    Unlatches the light from any attachments.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ZERO

      protected static final org.lwjgl.util.vector.Vector2f ZERO
    • arcEnd

      protected float arcEnd
    • arcStart

      protected float arcStart
    • attach

      protected com.fs.starfarer.api.combat.CombatEntityAPI attach
    • autoFadeOutTime

      protected float autoFadeOutTime
    • beamAttach

      protected com.fs.starfarer.api.combat.BeamAPI beamAttach
    • color

      protected final org.lwjgl.util.vector.Vector3f color
    • damageFrames

      protected final Deque<Boolean> damageFrames
    • damageInLastFewFrames

      protected boolean damageInLastFewFrames
    • direction

      protected final org.lwjgl.util.vector.Vector3f direction
    • height

      protected float height
    • intensity

      protected float intensity
    • intensityFade

      protected float intensityFade
    • intensityMax

      protected float intensityMax
    • isFadingIn

      protected boolean isFadingIn
    • isFadingOut

      protected boolean isFadingOut
    • lifetime

      protected float lifetime
    • linkToEnd

      protected boolean linkToEnd
    • location

      protected final org.lwjgl.util.vector.Vector2f location
    • location2

      protected final org.lwjgl.util.vector.Vector2f location2
    • offset

      protected final org.lwjgl.util.vector.Vector2f offset
    • size

      protected float size
    • specularIntensity

      protected float specularIntensity
    • specularMultiplier

      protected float specularMultiplier
    • superLifetime

      protected float superLifetime
    • type

      protected int type
    • velocity

      protected final org.lwjgl.util.vector.Vector2f velocity
    • velocity2

      protected final org.lwjgl.util.vector.Vector2f velocity2
  • Constructor Details

    • StandardLight

      public StandardLight()
      Constructs a generic light. Note that the light begins with an initial size and intensity of 0.

      Since:
      Beta 1.02
    • StandardLight

      public StandardLight(float intensity, float size)
      Constructs a generic light.

      Parameters:
      intensity - The desired intensity of the light.
      size - The desired size of the light.

      Since:
      Beta 1.07
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, org.lwjgl.util.vector.Vector2f offset, com.fs.starfarer.api.combat.CombatEntityAPI attach)
      Constructs a point light. Note that the light begins with an initial size and intensity of 0.

      Parameters:
      location - The desired location for the light.
      velocity - The desired velocity for the light.
      offset - The desired attachment offset for the light.
      attach - The desired light attachment. May be null.

      Since:
      Beta 1.02
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, org.lwjgl.util.vector.Vector2f offset, com.fs.starfarer.api.combat.CombatEntityAPI attach, float intensity, float size)
      Constructs a point light.

      Parameters:
      location - The desired location for the light.
      velocity - The desired velocity for the light.
      offset - The desired attachment offset for the light.
      attach - The desired light attachment. May be null.
      intensity - The desired intensity of the light.
      size - The desired size of the light.

      Since:
      Beta 1.07
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, com.fs.starfarer.api.combat.BeamAPI beamLink, boolean linkToEnd)
      Constructs a point light, attached to a beam endpoint. Note that the light begins with an initial size and intensity of 0.

      Parameters:
      location - The desired location for the light.
      velocity - The desired velocity for the light.
      beamLink - The desires beam attachment for the light. May be null.
      linkToEnd - Whether to link the light to the end of the beam or not. Ignored if beamLink is null.

      Since:
      Beta 1.02
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, com.fs.starfarer.api.combat.BeamAPI beamLink, boolean linkToEnd, float intensity, float size)
      Constructs a point light, attached to a beam endpoint.

      Parameters:
      location - The desired location for the light.
      velocity - The desired velocity for the light.
      beamLink - The desires beam attachment for the light. May be null.
      linkToEnd - Whether to link the light to the end of the beam or not. Ignored if beamLink is null.
      intensity - The desired intensity of the light.
      size - The desired size of the light.

      Since:
      Beta 1.07
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f location2, org.lwjgl.util.vector.Vector2f velocity, org.lwjgl.util.vector.Vector2f velocity2, com.fs.starfarer.api.combat.BeamAPI beamAttach)
      Constructs a line light. Note that the light begins with an initial size and intensity of 0.

      Parameters:
      location - The desired origin location for the light.
      location2 - The desired endpoint location for the light.
      velocity - The desired velocity for the light's origin.
      velocity2 - The desired velocity for the light's endpoint.
      beamAttach - The beam attachment for the light. May be null.

      Since:
      Beta 1.02
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f location2, org.lwjgl.util.vector.Vector2f velocity, org.lwjgl.util.vector.Vector2f velocity2, com.fs.starfarer.api.combat.BeamAPI beamAttach, float intensity, float size)
      Constructs a line light.

      Parameters:
      location - The desired origin location for the light.
      location2 - The desired endpoint location for the light.
      velocity - The desired velocity for the light's origin.
      velocity2 - The desired velocity for the light's endpoint.
      beamAttach - The beam attachment for the light. May be null.
      intensity - The desired intensity of the light.
      size - The desired size of the light.

      Since:
      Beta 1.07
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, float arcEnd, float arcStart)
      Constructs a cone light. Note that the light begins with an initial size and intensity of 0.

      Parameters:
      location - The desired location for the light.
      velocity - The desired velocity for the light.
      arcEnd - The desired end of the visible arc of the light, in degrees.
      arcStart - The desired start of the visible arc of the light, in degrees.

      Since:
      Beta 1.02
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f velocity, float arcEnd, float arcStart, float intensity, float size)
      Constructs a cone light.

      Parameters:
      location - The desired location for the light.
      velocity - The desired velocity for the light.
      arcEnd - The desired end of the visible arc of the light, in degrees.
      arcStart - The desired start of the visible arc of the light, in degrees.
      intensity - The desired intensity of the light.
      size - The desired size of the light.

      Since:
      Beta 1.07
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector3f direction)
      Constructs a directional light. Note that the light begins with an initial intensity of 0.

      Parameters:
      direction - The desired 3D directional vector for the light.

      Since:
      Beta 1.02
    • StandardLight

      public StandardLight(org.lwjgl.util.vector.Vector3f direction, float intensity)
      Constructs a directional light.

      Parameters:
      direction - The desired 3D directional vector for the light.
      intensity - The desired intensity of the light.

      Since:
      Beta 1.07
  • Method Details

    • computeOffset

      protected static org.lwjgl.util.vector.Vector2f computeOffset(org.lwjgl.util.vector.Vector2f location, org.lwjgl.util.vector.Vector2f offset, float angle)
    • advance

      public boolean advance(float amount)
      Runs once per frame.

      Specified by:
      advance in interface LightAPI
      Parameters:
      amount - Seconds since last frame.

      Returns:
      True if the light should be destroyed this frame, false if it should not be destroyed this frame.
    • attachTo

      public void attachTo(com.fs.starfarer.api.combat.CombatEntityAPI attach)
      Attaches the light to an entity. Will unlatch the light from any other attachments.

      Parameters:
      attach - The entity to attach to.
    • attachToBeam

      public void attachToBeam(com.fs.starfarer.api.combat.BeamAPI beamAttach)
      Attaches the light to a beam. Will unlatch the light from any other attachments.

      Parameters:
      beamAttach - The beam to attach to.
    • fadeIn

      public void fadeIn(float seconds)
      Fades in the light over a period of time. This method will also temporarily zero-out the light's intensity.

      Parameters:
      seconds - The period of time desired for the light to fade in over. If zero, will immediately complete an existing fade-in.
    • fadeOut

      public void fadeOut(float seconds)
      Fades the light out over a period of time. Giving a negative or zero value will cause the light to instantly disappear.

      Parameters:
      seconds - The period of time desired for the light to fade out over. A negative or zero value will cause the light to instantly disappear.
    • getArcEnd

      public float getArcEnd()
      The end of the current visible arc of the light, in degrees. Only used for cone-type lights.

      Specified by:
      getArcEnd in interface LightAPI
      Returns:
      The current facing direction of the light.

      Since:
      Alpha 1.4
    • getArcStart

      public float getArcStart()
      The start of the current visible arc of the light, in degrees. Only used for cone-type lights.

      Specified by:
      getArcStart in interface LightAPI
      Returns:
      The start of the current visible arc of the light, in degrees.

      Since:
      Alpha 1.4
    • getAttachment

      public com.fs.starfarer.api.combat.CombatEntityAPI getAttachment()
      Gets the entity that the light is attached to.

      Returns:
      The entity that the light is attached to. Returns null if there is no such attachment.
    • getAutoFadeOutTime

      public float getAutoFadeOutTime()
      Gets the time the light takes to fade out if it is automatically flagged to fade out by the lighting system.

      Returns:
      The time the light takes to fade out if it is automatically flagged to fade out by the lighting system.
    • setAutoFadeOutTime

      public void setAutoFadeOutTime(float autoFadeOutTime)
      Sets the time the light takes to fade out if it is automatically flagged to fade out by the lighting system.

      Parameters:
      autoFadeOutTime - The time desired for the light to take to fade out if it is automatically flagged to fade out by the lighting system.
    • getBeamAttachment

      public com.fs.starfarer.api.combat.BeamAPI getBeamAttachment()
      Gets the beam that the light is attached to.

      Returns:
      The beam that the light is attached to. Returns null if there is no such attachment.
    • getBeamLink

      public com.fs.starfarer.api.combat.BeamAPI getBeamLink()
      Gets the location that the light is attached to, if it is attached to a beam's origin or endpoint.

      Returns:
      The origin or endpoint of a beam that the light is attached to. Returns null if there is no such attachment.
    • getColor

      public org.lwjgl.util.vector.Vector3f getColor()
      Gets the light's color.

      Specified by:
      getColor in interface LightAPI
      Returns:
      An object whose xyz components correspond to rgb, in terms of values between 0.0 and 1.0.
    • setColor

      public void setColor(Color color)
      Sets the light to a particular color.

      Parameters:
      color - The color to set the light to, given by a Color object.
    • setColor

      public void setColor(org.lwjgl.util.vector.Vector3f color)
      Sets the light to a particular color.

      Parameters:
      color - The color to set the light to, given by an object whose xyz components correspond to rgb. Uses values between 0.0 and 1.0.
    • getDirection

      public org.lwjgl.util.vector.Vector3f getDirection()
      Gets the light's directional vector. Only used for directional-type lights.

      Specified by:
      getDirection in interface LightAPI
      Returns:
      The light's directional vector.

      Since:
      Alpha 1.4
    • setDirection

      public void setDirection(org.lwjgl.util.vector.Vector3f direction)
      Sets the light's directional vector. Only used for directional-type lights.

      Parameters:
      direction - The directional vector for the light.

      Since:
      Alpha 1.4
    • getHeight

      public float getHeight()
      Gets the height of the light, in world-space units. Only used for the purposes of normal maps.

      Specified by:
      getHeight in interface LightAPI
      Returns:
      The world-space height of the light.

      Since:
      Alpha 1.4
    • setHeight

      public void setHeight(float height)
      Sets the height of the light, in world-space units. Only used for the purposes of normal maps.

      Parameters:
      height - The world-space height of the light.

      Since:
      Alpha 1.4
    • getIntensity

      public float getIntensity()
      Gets the light's intensity.

      Specified by:
      getIntensity in interface LightAPI
      Returns:
      The light's intensity, in terms of lumens at the center of the light. This value is modulated by the brightness of the beam it is attached to, if any.
    • setIntensity

      public void setIntensity(float intensity)
      Sets the light's intensity. A value of 1 will increase the luminosity of the pixel at the center of the light by 1 times the pixel's current luminosity (e.g. a luminosity of 0.5 will become 1.0). This formula may change if materials are added in the future.

      Parameters:
      intensity - The desired intensity of the light.
    • setLifetime

      public void setLifetime(float lifetime)
      Gives the light a lifetime timer. If the timer runs out, the light will fade or disappear, depending on parameters. Lights last forever by default. Lifetime will only decrement when the light is not fading.

      Parameters:
      lifetime - The desired lifetime for the light.
    • getLocation

      public org.lwjgl.util.vector.Vector2f getLocation()
      Gets the current location of the light.

      Specified by:
      getLocation in interface LightAPI
      Returns:
      The current location of the light, with respect to attachments.
    • setLocation

      public void setLocation(org.lwjgl.util.vector.Vector2f location)
      Sets the location of the light. Has no effect if the light is attached to something.

      Parameters:
      location - The location to set the light to.
    • getLocation2

      public org.lwjgl.util.vector.Vector2f getLocation2()
      Gets the current location of the light's secondary endpoint. Only used for line-type lights.

      Specified by:
      getLocation2 in interface LightAPI
      Returns:
      The current location of the light's secondary endpoint, with respect to attachments.
    • setLocation2

      public void setLocation2(org.lwjgl.util.vector.Vector2f location)
      Sets the secondary endpoint of the light. Only used for line-type lights. Has no effect if the light is attached to something.

      Parameters:
      location - The secondary endpoint of the light.
    • getOffset

      public org.lwjgl.util.vector.Vector2f getOffset()
      Gets the attachment offset of the light.

      Returns:
      The attachment offset of the light, ignoring attachment rotation.
    • setOffset

      public void setOffset(org.lwjgl.util.vector.Vector2f offset)
      Sets the attachment offset of the light. Note that this will offset both location vectors. Has no effect if the light is not attached to something. Does not work with beam attachments.

      Parameters:
      offset - The attachment offset to give the light, before attachment rotation.
    • getRemainingLifetime

      public float getRemainingLifetime()
      Gets the remaining time the light has before it fades or disappears, depending on parameters.

      Returns:
      The remaining time the light has before it fades or disappears, depending on parameters.
    • getSize

      public float getSize()
      Gets the light's size.

      Specified by:
      getSize in interface LightAPI
      Returns:
      The light's size, in units.
    • setSize

      public void setSize(float size)
      Sets the light's size.

      Parameters:
      size - The size to set the light to, in units.
    • getSpecularIntensity

      public float getSpecularIntensity()
      Gets the specular intensity of the light. Only used for directional-type lights.

      Specified by:
      getSpecularIntensity in interface LightAPI
      Returns:
      The specular intensity of the light.

      Since:
      Alpha 1.4
    • setSpecularIntensity

      public void setSpecularIntensity(float intensity)
      Sets the specular intensity of the light. Only used for directional-type lights.

      Parameters:
      intensity - The specular intensity of the light.

      Since:
      Alpha 1.4
    • getSpecularMult

      public float getSpecularMult()
      Gets the specular multiplier of the light. Only used for point-type lights.

      Specified by:
      getSpecularMult in interface LightAPI
      Returns:
      The specular multiplier of the light.

      Since:
      1.4.0
    • setSpecularMult

      public void setSpecularMult(float multiplier)
      Sets the specular multiplier of the light. Only used for point-type lights.

      Parameters:
      multiplier - The specular multiplier of the light.

      Since:
      1.4.0
    • getType

      public int getType()
      Gets the light's type.

      Specified by:
      getType in interface LightAPI
      Returns:
      The light's current type. Type 0: point light (default). Type 1: line light. Type 2: cone light. Type 3: directional light.
    • setType

      public void setType(int type)
      Sets the light's type.

      Parameters:
      type - The type of light to set it to. Type 0: point light (default). Type 1: line light. Type 2: cone light. Type 3: directional light.
    • getVelocity

      public org.lwjgl.util.vector.Vector2f getVelocity()
      Gets the current velocity of the light. Returns zero if the light is attached to anything.

      Returns:
      The current velocity of the light.

      Since:
      Alpha 1.2
    • setVelocity

      public void setVelocity(org.lwjgl.util.vector.Vector2f velocity)
      Sets the velocity for the light. Has no effect if the light is attached to something.

      Parameters:
      velocity - The velocity to apply to the light.

      Since:
      Alpha 1.2
    • getVelocity2

      public org.lwjgl.util.vector.Vector2f getVelocity2()
      Gets the current velocity of the secondary endpoint of the light. Only used for line-type lights. Returns zero if the light is attached to anything.

      Returns:
      The current velocity of the light's secondary endpoint.

      Since:
      Alpha 1.2
    • setVelocity2

      public void setVelocity2(org.lwjgl.util.vector.Vector2f velocity)
      Sets the velocity for the secondary endpoint of the light. Only used for line-type lights. Has no effect if the light is attached to something.

      Parameters:
      velocity - The velocity to apply to the secondary endpoint of the light.

      Since:
      Alpha 1.2
    • isFadingIn

      public boolean isFadingIn()
      Returns whether the light is fading in or not.

      Returns:
      Whether the light is fading in or not.
    • isFadingOut

      public boolean isFadingOut()
      Returns whether the light is fading out or not.

      Returns:
      Whether the light is fading out or not.
    • linkToBeam

      public void linkToBeam(com.fs.starfarer.api.combat.BeamAPI beamLink, boolean linkToEnd)
      Attaches the light to the origin or the endpoint of a beam. Will unlatch the light from any other attachments.

      Parameters:
      beamLink - The beam to attach to the origin or endpoint of.
      linkToEnd - Whether the light should be attached to the beam's origin or its endpoint.
    • makePermanent

      public void makePermanent()
      Makes the light permanent. This sets the lifetime of the light to -1 and sets the internal failsafe lifetime to -1 as well, making it truly permanent until destroyed or otherwise made mortal. By default, lights disappear after one minute to avoid "light leaks".

      Since:
      Alpha 1.62
    • setArc

      public void setArc(float start, float end)
      Sets the visible arc of the light, in degrees. Only used for cone-type lights.

      Parameters:
      start - The start of the light's visible arc, in degrees.
      end - The end of the light's visible arc, in degrees.

      Since:
      Alpha 1.4
    • setColor

      public void setColor(float red, float green, float blue)
      Sets the light to a particular color.

      Parameters:
      red - The red component to set the light to. Uses a value between 0.0 and 1.0.
      green - The green component to set the light to. Uses a value between 0.0 and 1.0.
      blue - The blue component to set the light to. Uses a value between 0.0 and 1.0.
    • unattach

      public void unattach()
      Unlatches the light from any attachments.
    • getIntensityFade

      public float getIntensityFade()
      Gets the change in intensity over time.

      Returns:
      The rate of change of the intensity of the light.

      Since:
      1.8.0
    • setIntensityFade

      public void setIntensityFade(float intensityFade)
      Sets the change in intensity over time.

      Parameters:
      intensityFade - The rate of change of intensity to apply to the light. Positive for fade-in, negative for fade-out, zero for no fading.

      Since:
      1.8.0
    • getIntensityMax

      public float getIntensityMax()
      Gets the maximum intensity to reach.

      Returns:
      The maximum intensity that the light can reach.

      Since:
      1.8.0
    • setIntensityMax

      public void setIntensityMax(float intensityMax)
      Sets the maximum intensity to reach.

      Parameters:
      intensityMax - The maximum intensity that the light should reach.

      Since:
      1.8.0