Class CurveEntity
- All Implemented Interfaces:
InstanceRenderAPI,MaterialRenderAPI,RenderDataAPI
Curve entity will not apply AA if depth based AA is enabled.
Use vanilla beam texture uv(transversal beam texture).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final floatprotected final intprotected booleanprotected intprotected intprotected static final byteprotected final intprotected shortprotected final int[]protected intprotected final float[]protected final boolean[]Fields inherited from class org.boxutil.base.BaseMIRenderData
materialFields 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 intvoidintfloat[]floatfloatfloatfloatintintintgetNodes()intintintfloatfloatfloatintvoidglDraw()initCircle(org.lwjgl.util.vector.Vector2f offset, float radius, Color color, Color emissiveColor, float width) Rough fitting but more performance.initElliptic(org.lwjgl.util.vector.Vector2f offset, float radiusW, float radiusH, Color color, Color emissiveColor, float width) Rough fitting but more performance.initLine(org.lwjgl.util.vector.Vector2f offset, float length, Color color, Color emissiveColor, float width) Create a two-points line, and submit nodeList.initLineStrip(List<org.lwjgl.util.vector.Vector2f> points, Color color, Color emissiveColor, float width, boolean closed) Create a line-strip asGL_LINE_STRIP, and submit nodeList.protected voidinitSmoothLine(org.lwjgl.util.vector.Vector2f offset, float length, Color color, Color emissiveColor, float width, float smoothFactor) Create a three-points line with smooth both ends, and submit nodeList.booleanbooleanbooleanbooleanDefault value istrue.booleanDefault value isfalse.booleanisValid()bytemallocNodeData(int nodeNum) Optional.voidreset()Excludes nodeList data.voidvoidsetFillEndAlpha(float alpha) voidsetFillEndFactor(float factor) voidsetFillStartAlpha(float alpha) voidsetFillStartFactor(float factor) voidsetFlowWhenPaused(boolean flow) voidsetGlobalUV(boolean useGlobal) Force uv mapping to [0, 1] from the first node to the last node, such as used for flag or tentacle.voidsetInterpolation(short interpolation) From zero.voidsetMappingModeSubmitData(boolean mappingMode) For some very slight data, useglBufferSubData()may faster.voidvoidsetNodeRefreshIndex(int index) voidsetNodeRefreshSize(int size) voidsetNodeRenderingCount(int nodeCount) voidvoidsetSubmitLengthCalculatingStep(int step) voidsetSynchronousSubmit(boolean sync) High performance impact when is synchronized.voidsetTexturePixels(float texturePixels) voidsetTextureSpeed(float textureSpeed) It is working together withsetTexturePixels(float).voidsetUVOffset(float offset) voidWithout matrix data or timer settings.byteUse it when you changed the node data.Methods inherited from class org.boxutil.base.BaseMIRenderData
getMaterialData, setMaterialDataMethods inherited from class org.boxutil.base.BaseInstanceRenderData
_packingInstanceData, addInstanceData, callRefreshInstanceData, copyInstanceTimerOverride, delete, getGlobalTimerState, getInstanceData, getInstanceDataMemory, getInstanceDataRefreshIndex, getInstanceDataRefreshOffset, getInstanceDataRefreshSize, getInstanceTimerOverride, getRenderingCount, getRenderingOffset, getValidInstanceDataCount, haveValidInstanceData, isAlwaysRefreshInstanceData, isMappingInstanceSubmit, isNeedRefreshInstanceData, mallocInstance, resetInstanceData, resetInstanceDataClient, resetInstanceDataResource, resetMemory, resetMemory, setAlwaysRefreshInstanceData, setInstanceData, setInstanceData, setInstanceDataRefreshAllFromCurrentIndex, setInstanceDataRefreshIndex, setInstanceDataRefreshOffset, setInstanceDataRefreshSize, setInstanceTimerOverride, setMappingInstanceSubmit, setRenderingAllInstanceFromCurrentOffset, setRenderingCount, setRenderingOffset, setSharedInstanceData, submitInstanceMethods 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, pickDataPackage_vec4, pickModelMatrixPackage_mat4, pickPrimeMatrixPackage_mat4, 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
-
_CIRCLE_FIX
protected static final float _CIRCLE_FIX- See Also:
-
_NODE_LENGTH
protected static final byte _NODE_LENGTH- See Also:
-
_curveID
protected final int _curveID -
_nodesVBO
protected final int _nodesVBO -
_isValid
protected volatile boolean _isValid -
nodeList
-
_lastNodeLength
protected int _lastNodeLength -
_lastNodeLengthReal
protected int _lastNodeLengthReal -
_distance
-
shouldRenderingCount
protected int shouldRenderingCount -
nodeRefreshState
protected final int[] nodeRefreshState -
interpolation
protected short interpolation -
state
protected final float[] state -
stateB
protected final boolean[] stateB
-
-
Constructor Details
-
CurveEntity
public CurveEntity() -
CurveEntity
-
-
Method Details
-
_StatePackageStack
protected int _StatePackageStack()- Overrides:
_StatePackageStackin classBaseMIRenderData
-
initResourceLayout
protected void initResourceLayout() -
getCurveID
public int getCurveID() -
getNodesVBO
public int getNodesVBO() -
isValid
public boolean isValid() -
_deleteExc
protected void _deleteExc()- Overrides:
_deleteExcin classBaseMIRenderData
-
glDraw
public void glDraw()- Specified by:
glDrawin interfaceRenderDataAPI- Overrides:
glDrawin classBaseInstanceRenderData
-
_resetExc
protected void _resetExc()- Overrides:
_resetExcin classBaseRenderData
-
reset
public void reset()Excludes nodeList data.- Specified by:
resetin interfaceRenderDataAPI- Overrides:
resetin classBaseRenderData
-
resetNodes
public void resetNodes() -
submitNodes
public byte submitNodes()Use it when you changed the node data.Will not keeping any node data if beyonds the initial size or the maximum submit size, recommend to call
mallocNodeData(int)for allocate enough size before.Cost
26 Byte * (2n - 2)of vRAM when have number ofnnodes, that if it had8192nodes will cost415.95 KBof vRAM.- Returns:
- return
BoxEnum.STATE_SUCCESSwhen success.return
BoxEnum.STATE_FAILEDwhen an empty node list or refresh count is zero.return
BoxEnum.STATE_FAILED_OTHERwhen happened another error.
-
mallocNodeData
public byte mallocNodeData(int nodeNum) Optional.Just
malloc()without any submit call.- Parameters:
nodeNum- must be positive integer.- Returns:
- return
BoxEnum.STATE_SUCCESSwhen success.return
BoxEnum.STATE_FAILEDwhen parameter error.return
BoxEnum.STATE_FAILED_OTHERwhen happened another error.
-
isSynchronousSubmit
public boolean isSynchronousSubmit()Default value isfalse. -
setSynchronousSubmit
public void setSynchronousSubmit(boolean sync) High performance impact when is synchronized. -
isMappingModeSubmitData
public boolean isMappingModeSubmitData()Default value istrue. -
setMappingModeSubmitData
public void setMappingModeSubmitData(boolean mappingMode) For some very slight data, useglBufferSubData()may faster.Besides, some devices(some ARM SoC) may slower with
glMapBufferRange(), decided by the drive how implements it.- Parameters:
mappingMode- to controls whether submit useglMapBufferRange(), else useglBufferSubData().
-
getNodeRefreshIndex
public int getNodeRefreshIndex() -
setNodeRefreshIndex
public void setNodeRefreshIndex(int index) - Parameters:
index- Will refresh node data start from this index.
-
setNodeRefreshSize
public void setNodeRefreshSize(int size) - Parameters:
size- Will refresh node data count.
-
setNodeRefreshAllFromCurrentIndex
public void setNodeRefreshAllFromCurrentIndex() -
getSubmitLengthCalculatingStep
public int getSubmitLengthCalculatingStep() -
setSubmitLengthCalculatingStep
public void setSubmitLengthCalculatingStep(int step) - Parameters:
step- must be greater than zero.
-
getValidNodeCount
public int getValidNodeCount() -
isHaveValidNodeCount
public boolean isHaveValidNodeCount() -
getRealValidNodeCount
public int getRealValidNodeCount() -
getNodeRenderingCount
public int getNodeRenderingCount() -
setNodeRenderingCount
public void setNodeRenderingCount(int nodeCount) -
getNodes
-
setNodes
- Parameters:
nodeList- Cannot have any null-node, and at least have two nodeList, if not then pass this entity when rendering.
-
addNode
-
initLineStrip
public CurveEntity initLineStrip(@NotNull List<org.lwjgl.util.vector.Vector2f> points, Color color, Color emissiveColor, float width, boolean closed) Create a line-strip asGL_LINE_STRIP, and submit nodeList.Flat tangent, just a line-strip.
- Parameters:
points- size must be larger than 2.
-
initLine
public CurveEntity initLine(@Nullable org.lwjgl.util.vector.Vector2f offset, float length, Color color, Color emissiveColor, float width) Create a two-points line, and submit nodeList.Flat tangent, just a line.
-
initSmoothLine
public CurveEntity initSmoothLine(@Nullable org.lwjgl.util.vector.Vector2f offset, float length, Color color, Color emissiveColor, float width, float smoothFactor) Create a three-points line with smooth both ends, and submit nodeList. -
initCircle
public CurveEntity initCircle(@Nullable org.lwjgl.util.vector.Vector2f offset, float radius, Color color, Color emissiveColor, float width) Rough fitting but more performance.Create a circle with three-points, and submit nodeList.
Interpolation should be greater than zero.
-
initElliptic
public CurveEntity initElliptic(@Nullable org.lwjgl.util.vector.Vector2f offset, float radiusW, float radiusH, Color color, Color emissiveColor, float width) Rough fitting but more performance.Create an elliptic with three-points, and submit nodeList.
Interpolation should be greater than zero.
-
getInterpolation
public int getInterpolation() -
setInterpolation
public void setInterpolation(short interpolation) From zero.Will add points at geometry shader.
-
getCurveState
public float[] getCurveState() -
getTextureSpeed
public float getTextureSpeed() -
setTextureSpeed
public void setTextureSpeed(float textureSpeed) It is working together withsetTexturePixels(float).- Parameters:
textureSpeed- looks flowing forward when less than zero.
-
getTexturePixels
public float getTexturePixels() -
setTexturePixels
public void setTexturePixels(float texturePixels) - Parameters:
texturePixels- texture fill size.
-
isFlowWhenPaused
public boolean isFlowWhenPaused() -
setFlowWhenPaused
public void setFlowWhenPaused(boolean flow) -
isGlobalUV
public boolean isGlobalUV() -
setGlobalUV
public void setGlobalUV(boolean useGlobal) Force uv mapping to [0, 1] from the first node to the last node, such as used for flag or tentacle. -
getUVOffset
public float getUVOffset() -
setUVOffset
public void setUVOffset(float offset) -
getFillStartAlpha
public float getFillStartAlpha() -
setFillStartAlpha
public void setFillStartAlpha(float alpha) -
getFillEndAlpha
public float getFillEndAlpha() -
setFillEndAlpha
public void setFillEndAlpha(float alpha) -
getFillStartFactor
public float getFillStartFactor() -
setFillStartFactor
public void setFillStartFactor(float factor) -
getFillEndFactor
public float getFillEndFactor() -
setFillEndFactor
public void setFillEndFactor(float factor) -
submitEntityData
public void submitEntityData()Description copied from class:BaseRenderDataWithout matrix data or timer settings.- Specified by:
submitEntityDatain interfaceRenderDataAPI- Overrides:
submitEntityDatain classBaseMIRenderData
-
entityType
- Specified by:
entityTypein interfaceRenderDataAPI- Overrides:
entityTypein classBaseRenderData
-