Class BaseShaderPacksContext

java.lang.Object
org.boxutil.base.BaseShaderPacksContext

public abstract class BaseShaderPacksContext extends Object
Only and must have a no-parameter constructor.
  • Constructor Details

    • BaseShaderPacksContext

      public BaseShaderPacksContext()
  • Method Details

    • configLoad

      public void configLoad(@Nullable org.json.JSONObject data)
      At saves/common/shaderpacks, file name is shader packs id.
      Parameters:
      data - just load the values, null for load falied.

      Also call configSave(JSONObject) before if null.

    • configSetDefault

      public void configSetDefault()
    • configSave

      public void configSave(org.json.JSONObject data) throws org.json.JSONException
      At saves/common/shaderpacks, file name is shader packs id.
      Parameters:
      data - just set the values.
      Throws:
      org.json.JSONException
    • init

      public boolean init()
      Will call it after switching and applied config to this shader packs.
      Returns:
      false when initialization fails.
    • destroy

      public void destroy()
      Will call it after switching and applied config to other shader packs, or init() return false.
    • applyTexturedAreaLightPreFiltering

      public byte[] applyTexturedAreaLightPreFiltering(int src, int preFiltering, boolean shouldAllocate)
      Parameters:
      preFiltering - for implements, not required to delete it when failed.
      shouldAllocate - should re-allocate memory for pre-filtering texture when true.
      Returns:
      byte[] result = {state, maxLevel};

      state returns BoxEnum.STATE_SUCCESS when success.

      return BoxEnum.STATE_FAILED when implements code(compute shader etc.) not supported.

    • initCampaign

      public void initCampaign(com.fs.starfarer.api.campaign.SectorAPI sector, boolean isCombatEnd, boolean init)
      Will call if the LocationAPI of player fleet has changed.

      Also call after in-campaign quick load.

      After cleanupCampaign(boolean).

    • initCombat

      public void initCombat(com.fs.starfarer.api.combat.CombatEngineAPI engine)
    • applyBeforeLowestLayerRender

      public void applyBeforeLowestLayerRender(com.fs.starfarer.api.combat.ViewportAPI viewport, boolean isCampaign, int fbo, int colorMap, int emissiveMap, int worldPosMap, int worldNormalMap, int worldTangentMap, int worldMaterialMap, int worldDataMap, int auxFBO, int auxEmissive)
    • applyBeforeIlluminationPass

      public void applyBeforeIlluminationPass(com.fs.starfarer.api.combat.ViewportAPI viewport, boolean isCampaign, int fbo, int colorMap, int emissiveMap, int worldPosMap, int worldNormalMap, int worldTangentMap, int worldMaterialMap, int worldDataMap, int auxFBO, int auxEmissive)
    • applyBeforeInfiniteLightShading

      public boolean applyBeforeInfiniteLightShading()
      Returns:
      ignore shading if false.
    • applyInfiniteLightShading

      public void applyInfiniteLightShading(InfiniteLight entity, boolean validInstanceData, boolean notDefaultInstanceDataType)
    • applyBeforePointLightShading

      public boolean applyBeforePointLightShading()
      Returns:
      ignore shading if false.
    • applyPointLightShading

      public void applyPointLightShading(PointLight entity, boolean validInstanceData, boolean notDefaultInstanceDataType)
    • applyBeforeSpotLightShading

      public boolean applyBeforeSpotLightShading()
      Returns:
      ignore shading if false.
    • applySpotLightShading

      public void applySpotLightShading(SpotLight entity, boolean validInstanceData, boolean notDefaultInstanceDataType)
    • applyBeforeLinearLightShading

      public boolean applyBeforeLinearLightShading()
      Returns:
      ignore shading if false.
    • applyLinearLightShading

      public void applyLinearLightShading(LinearLight entity, boolean validInstanceData, boolean notDefaultInstanceDataType)
    • applyBeforeAreaLightShading

      public boolean applyBeforeAreaLightShading()
      Returns:
      ignore shading if false.
    • applyAreaLightShading

      public void applyAreaLightShading(AreaLight entity, boolean validInstanceData, boolean notDefaultInstanceDataType)
    • applyAfterIlluminationPass

      public void applyAfterIlluminationPass(com.fs.starfarer.api.combat.ViewportAPI viewport, boolean isCampaign, int fbo, int colorMap, int emissiveMap, int worldPosMap, int worldNormalMap, int worldTangentMap, int worldMaterialMap, int worldDataMap, int auxFBO, int auxEmissive)
    • applyAAPass

      public void applyAAPass(com.fs.starfarer.api.combat.ViewportAPI viewport, boolean isCampaign, int fbo, int colorMap, int emissiveMap, int worldPosMap, int worldNormalMap, int worldTangentMap, int worldMaterialMap, int worldDataMap)
    • applyBloomPass

      public void applyBloomPass(com.fs.starfarer.api.combat.ViewportAPI viewport, boolean isCampaign, boolean isMultiPassBloom, int fbo, int colorMap, int emissiveMap, int worldPosMap, int worldNormalMap, int worldTangentMap, int worldMaterialMap, int worldDataMap, int auxFBO, int auxEmissive)
      Parameters:
      isMultiPassBloom - if ture, draw to black screen.
    • applyPostEffectPass

      public void applyPostEffectPass(com.fs.starfarer.api.combat.ViewportAPI viewport, boolean isCampaign)
    • applyCombatUIPass

      public void applyCombatUIPass(com.fs.starfarer.api.combat.ViewportAPI viewport)
    • advanceInCombat

      public void advanceInCombat(com.fs.starfarer.api.combat.CombatEngineAPI engine, float amount)
    • cleanupCombat

      public void cleanupCombat()
      Call in campaign, just for OpenGL resource cleanup.
    • advanceInCampaign

      public void advanceInCampaign(com.fs.starfarer.api.campaign.SectorAPI sector, float amount)
    • cleanupCampaign

      public void cleanupCampaign(boolean isSwitchToTitle)
      Will call if the LocationAPI of player fleet has changed, or join battle.

      Also call after in-campaign quick load.

      Before initCampaign(SectorAPI, boolean, boolean).

    • getID

      public String getID()
    • getDisplayName

      public String getDisplayName()
    • getDisplayVersion

      public String getDisplayVersion()
      Returns:
      returns null for hidden.
    • getIconTextureID

      public int getIconTextureID()
      Recommended size: 256*128
      Returns:
      returns less than 0 for none icon, equals for default icon.
    • getIconTextureColor

      public Color getIconTextureColor()
      Returns:
      null for white, the raw texture.
    • isCombatIlluminationSupported

      public boolean isCombatIlluminationSupported()
      Technical hint.

      Combat shading (or with shadowing), without VFX.

    • isCampaignIlluminationSupported

      public boolean isCampaignIlluminationSupported()
      Technical hint.

      Campaign shading (or with shadowing), without VFX.

    • isBloomSupported

      public boolean isBloomSupported()
      Technical hint.
    • isAASupported

      public boolean isAASupported()
      Technical hint.
    • isBaseAnisotropySupported

      public boolean isBaseAnisotropySupported()
      Technical hint.

      The anisotropy shading is only supports for infinite-light / point-light / spot-light, without area-light.

    • isTexturedAreaLightSupported

      public boolean isTexturedAreaLightSupported()
      Technical hint.
    • isCompleteAnisotropySupported

      public boolean isCompleteAnisotropySupported()
      Technical hint.

      For real-time line/area lighting(based LTC, the Linearly-Transformed-Cosines), its high performance cost, difficult and complicated to implement it.

      A compromised and easy way is only implements the anisotropic lighting for except area light(InfiniteLight, PointLight, SpotLight).

    • haveCustomInstanceDataLayout

      public boolean haveCustomInstanceDataLayout()
      For BaseIlluminantData that have custom instance data layout on this shader packs.
      Returns:
      ture if the shader packs use specific instance data layout, like custom SSBOs, custom UBOs, custom TBOs, custom VBOs, storage to any texture object or any other.
    • getCustomInstanceDataLayout

      public IlluminantInstanceDataLayoutAPI getCustomInstanceDataLayout()
      Returns:
      NOT null when haveCustomInstanceDataLayout() returns true, and should implement all the methods.
    • isUsable

      public boolean isUsable(org.lwjgl.opengl.ContextCapabilities glContext)
      To tell players if this shader pack is usable in current hardware.
    • createDetailsPanel

      public void createDetailsPanel(com.fs.starfarer.api.ui.TooltipMakerAPI tooltip, com.fs.starfarer.api.ui.PositionAPI planePos, com.fs.starfarer.api.ui.PositionAPI elementPos)
      With description and config option.
    • detailsPanelAdvance

      public boolean detailsPanelAdvance(float amount, com.fs.starfarer.api.ui.PositionAPI planePos, com.fs.starfarer.api.ui.PositionAPI elementPos)
      Returns:
      returns ture for any valid setting has changed, by OR operation.
    • detailsPanelRender

      public void detailsPanelRender(float alpha, com.fs.starfarer.api.ui.PositionAPI planePos, com.fs.starfarer.api.ui.PositionAPI elementPos)
    • detailsPanelRenderBelow

      public void detailsPanelRenderBelow(float alpha, com.fs.starfarer.api.ui.PositionAPI planePos, com.fs.starfarer.api.ui.PositionAPI elementPos)
    • detailsPanelProcessInput

      public boolean detailsPanelProcessInput(List<com.fs.starfarer.api.input.InputEventAPI> events, com.fs.starfarer.api.ui.PositionAPI planePos, com.fs.starfarer.api.ui.PositionAPI elementPos)
      Returns:
      returns ture for any valid setting has changed.
    • detailsPanelButtonPressed

      public boolean detailsPanelButtonPressed(Object buttonId, com.fs.starfarer.api.ui.PositionAPI planePos, com.fs.starfarer.api.ui.PositionAPI elementPos)
      Returns:
      returns ture for any valid setting has changed.
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object