Class AreaLight

All Implemented Interfaces:
DirectDrawEntity, IlluminantAPI, InstanceRenderAPI, RenderDataAPI

public class AreaLight extends BaseIlluminantData
Highest performance cost in all illuminates.

Default rectangle normal direction is vec3(0.0, 0.0, -1.0)

For textured area lighting: OpenGL 4.3 required, compute shader required, texture storage supported required.

For instanced data: scaleX and scaleY to controls rectangle size (larger value will be the attenuation radius scale).

  • Field Details

    • lightTex

      protected com.fs.starfarer.api.graphics.SpriteAPI lightTex
    • size

      protected float[] size
    • texturedLightingState

      protected int[] texturedLightingState
    • texturedLightingMapping

      protected float[] texturedLightingMapping
    • textureMaxLevel

      protected byte textureMaxLevel
    • stateB

      protected boolean[] stateB
  • Constructor Details

    • AreaLight

      public AreaLight()
  • Method Details

    • _StatePackageStack

      protected int _StatePackageStack()
      Overrides:
      _StatePackageStack in class BaseIlluminantData
    • _deleteExc

      protected void _deleteExc()
      Overrides:
      _deleteExc in class BaseRenderData
    • _resetExc

      protected void _resetExc()
      Overrides:
      _resetExc in class BaseIlluminantData
    • getLightTexture

      @Nullable public com.fs.starfarer.api.graphics.SpriteAPI getLightTexture()
    • getLightTextureID

      public int getLightTextureID()
    • setLightTexture

      public void setLightTexture(@Nullable com.fs.starfarer.api.graphics.SpriteAPI texture)
      RGBA8 texture only.

      OpenGL 4.3 required, compute shader required.

    • setLightTexture

      public void setLightTexture(int texture)
      RGBA8 texture only.

      OpenGL 4.3 required, compute shader required.

    • resetLightTexture

      public void resetLightTexture()
      Must call it after changed light texture if with different texture size.
    • getLightTextureXOffset

      public float getLightTextureXOffset()
    • getLightTextureYOffset

      public float getLightTextureYOffset()
    • getLightTextureWidth

      public float getLightTextureWidth()
    • getLightTextureHeight

      public float getLightTextureHeight()
    • setLightTextureRange

      public void setLightTextureRange(float uvXOffset, float uvYOffset, float uvWidth, float uvHeight)
    • getPreFilteringTextureMaxLevel

      public byte getPreFilteringTextureMaxLevel()
    • isDirectAllocatePreFilteringTexture

      public boolean isDirectAllocatePreFilteringTexture()
    • directAllocatePreFilteringTexture

      public void directAllocatePreFilteringTexture(int texture, byte maxLevel)
    • submitLightTexture

      public byte submitLightTexture(boolean refreshCurrFilteringTex)
      Call it if you want to use textured area light.

      High performance cost in once pre-filtering, use it carefully.

      The pre-filtering texture will cost VRAM about 133.333~% of origin texture (in the case of performance priority). RGBA8 texture only.

      Normally: OpenGL 4.3 required, compute shader required.

      Parameters:
      refreshCurrFilteringTex - recommend set to false if the size of new texture is equal to old texture.
      Returns:
      returns BoxEnum.STATE_SUCCESS when success.

      return BoxEnum.STATE_FAILED when context or shader packs not supported.

      return BoxEnum.STATE_FAILED_OTHER when use a direct allocate pre-filtering texture.

    • getPreFilteringLightTextureID

      public int getPreFilteringLightTextureID()
      The pre-filtering texture after submit.
    • havePreFilteringLightTexture

      public boolean havePreFilteringLightTexture()
    • isTexturedLighting

      public boolean isTexturedLighting()
    • setTexturedLighting

      public void setTexturedLighting(boolean use)
    • isTwoSided

      public boolean isTwoSided()
    • setTwoSided

      public void setTwoSided(boolean twoSided)
    • getWidth

      public float getWidth()
    • getHeight

      public float getHeight()
    • setWidth

      public void setWidth(float width)
    • setHeight

      public void setHeight(float height)
    • setWidthDirect

      public void setWidthDirect(float widthHalf)
    • setHeightDirect

      public void setHeightDirect(float heightHalf)
    • setSize

      public void setSize(float width, float height)
    • setSizeDirect

      public void setSizeDirect(float widthHalf, float heightHalf)
    • submitEntityData

      public void submitEntityData()
      Description copied from class: BaseRenderData
      Without matrix data or timer settings.
      Specified by:
      submitEntityData in interface RenderDataAPI
      Overrides:
      submitEntityData in class BaseIlluminantData
    • entityType

      public Object entityType()
      Specified by:
      entityType in interface RenderDataAPI
      Overrides:
      entityType in class BaseRenderData