Class AreaLight
- All Implemented Interfaces:
DirectDrawEntity,IlluminantAPI,InstanceRenderAPI,RenderDataAPI
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 Summary
FieldsModifier and TypeFieldDescriptionprotected com.fs.starfarer.api.graphics.SpriteAPIprotected float[]protected boolean[]protected float[]protected int[]protected byteFields inherited from class org.boxutil.base.BaseIlluminantData
stateBase, stateBaseBitFields inherited from class org.boxutil.base.BaseInstanceRenderData
instanceData, instanceRefreshIndex, instanceRefreshOffset, instanceRefreshSize, instanceRenderingCount, instanceRenderingOffset, instanceTimerOverride, mappingSubmit, memory, needRefreshInstanceDataFields inherited from class org.boxutil.base.BaseRenderData
autoSubmitDataBuffer, autoSubmitModelMat, autoSubmitPrimeMat, blendConfig, blendState, controlData, customData, globalTimer, hasDelete, isTimerPaused, layer, modelMatBuffer, modelMatrix, primeMatBuffer, primeMatrix, primeMatrixState, statePackageBuffer, sync_lock, timingWhenPaused -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected intvoiddirectAllocatePreFilteringTexture(int texture, byte maxLevel) floatcom.fs.starfarer.api.graphics.SpriteAPIfloatintfloatfloatfloatintThe pre-filtering texture after submit.bytefloatgetWidth()booleanbooleanbooleanbooleanvoidMust call it after changed light texture if with different texture size.voidsetHeight(float height) voidsetHeightDirect(float heightHalf) voidsetLightTexture(int texture) RGBA8 texture only.voidsetLightTexture(com.fs.starfarer.api.graphics.SpriteAPI texture) RGBA8 texture only.voidsetLightTextureRange(float uvXOffset, float uvYOffset, float uvWidth, float uvHeight) voidsetSize(float width, float height) voidsetSizeDirect(float widthHalf, float heightHalf) voidsetTexturedLighting(boolean use) voidsetTwoSided(boolean twoSided) voidsetWidth(float width) voidsetWidthDirect(float widthHalf) voidWithout matrix data or timer settings.bytesubmitLightTexture(boolean refreshCurrFilteringTex) Call it if you want to use textured area light.Methods inherited from class org.boxutil.base.BaseIlluminantData
getAttenuationRadius, getColor, getColorArray, getColorC, getStateBit, getStrength, isLinearAttenuation, isNoneAttenuation, isSqrtAttenuation, isSquareAttenuation, mallocInstance, pickDataPackage_vec4, resetInstanceData, setAttenuationRadius, setColor, setColor, setColor, setDefaultAttenuation, setLinearAttenuation, setNoneAttenuation, setSqrtAttenuation, setSquareAttenuation, setStrength, submitInstanceMethods inherited from class org.boxutil.base.BaseInstanceRenderData
_packingInstanceData, addInstanceData, callRefreshInstanceData, copyInstanceTimerOverride, delete, getGlobalTimerState, getInstanceData, getInstanceDataMemory, getInstanceDataRefreshIndex, getInstanceDataRefreshOffset, getInstanceDataRefreshSize, getInstanceTimerOverride, getRenderingCount, getRenderingOffset, getValidInstanceDataCount, glDraw, haveValidInstanceData, isAlwaysRefreshInstanceData, isMappingInstanceSubmit, isNeedRefreshInstanceData, resetInstanceDataClient, resetInstanceDataResource, resetMemory, resetMemory, setAlwaysRefreshInstanceData, setInstanceData, setInstanceData, setInstanceDataRefreshAllFromCurrentIndex, setInstanceDataRefreshIndex, setInstanceDataRefreshOffset, setInstanceDataRefreshSize, setInstanceTimerOverride, setMappingInstanceSubmit, setRenderingAllInstanceFromCurrentOffset, setRenderingCount, setRenderingOffset, setSharedInstanceDataMethods inherited from class org.boxutil.base.BaseRenderData
advanceGlobalTimer, appendToEntity, appendToEntity, appendToEntity, appendToEntity, getBlendAlphaDST, getBlendAlphaSRC, getBlendColorDST, getBlendColorSRC, getBlendEquation, getBlendState, getCampaignLayer, getCombatLayer, getControlData, getCustomData, getGlobalTimer, getGlobalTimerAlpha, getLayer, getModelMatrix, getModelMatrixBuffer, getPrimeMatrix, getPrimeMatrixBuffer, getPrimeMatrixState, hasDelete, initIdentityModelMatrix, initIdentityPrimeMatrix, isAutoSubmitEntityData, isAutoSubmitModelMatrix, isAutoSubmitPrimeMatrix, isGlobalTimerOnce, isGlobalTimerOver, isTimerPaused, isTimingWhenPaused, pickModelMatrixPackage_mat4, pickPrimeMatrixPackage_mat4, reset, setAdditiveBlend, setAutoSubmitEntityData, setAutoSubmitModelMatrix, setAutoSubmitPrimeMatrix, setBlendEquation, setBlendFunc, setBlendFuncSeparate, setControlData, setCustomData, setCustomPrimeMatrix, setDefaultCampaignLayer, setDefaultCombatLayer, setDisableBlend, setFacingScale, setGlobalTimer, setGlobalTimerOnce, setLayer, setLocation, setLocation, setLocation, setLocation, setModelMatrix, setNegativeBlend, setNonePrimeMatrix, setNormalBlend, setPerspectivePrimeMatrix, setPrimeMatrix, setRotateScale, setStateVanilla, setStateVanilla, setTimerPaused, setTimingWhenPaused, setVanillaPrimeMatrix, submitModelMatrix, submitPrimeMatrix
-
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:
_StatePackageStackin classBaseIlluminantData
-
_deleteExc
protected void _deleteExc()- Overrides:
_deleteExcin classBaseRenderData
-
_resetExc
protected void _resetExc()- Overrides:
_resetExcin classBaseIlluminantData
-
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_SUCCESSwhen success.return
BoxEnum.STATE_FAILEDwhen context or shader packs not supported.return
BoxEnum.STATE_FAILED_OTHERwhen 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:BaseRenderDataWithout matrix data or timer settings.- Specified by:
submitEntityDatain interfaceRenderDataAPI- Overrides:
submitEntityDatain classBaseIlluminantData
-
entityType
- Specified by:
entityTypein interfaceRenderDataAPI- Overrides:
entityTypein classBaseRenderData
-