Class SegmentEntity
- All Implemented Interfaces:
MaterialRenderAPI,RenderDataAPI
Segment 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 byteprotected final byteprotected booleanprotected intprotected static final byteprotected static final byteprotected final intprotected final intprotected final booleanprotected shortprotected MaterialDataprotected final int[]protected intprotected final float[]protected boolean[]Fields 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 intvoidfloat[]floatfloatfloatfloatintintintgetNodes()intprotected static intgetRealNodeCount(int num) 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 voidprotected static booleanisEndNode(int index) booleanbooleanbooleanbooleanDefault value istrue.booleanDefault value isfalse.booleanisValid()bytemallocNodeData(int nodeNum) Optional.voidvoidsetFillEndAlpha(float alpha) voidsetFillEndFactor(float factor) voidsetFillStartAlpha(float alpha) voidsetFillStartFactor(float factor) voidsetFlowWhenPaused(boolean flow) voidsetInterpolation(short interpolation) From zero.voidsetMappingModeSubmitData(boolean mappingMode) For some very slight data, useglBufferSubData()may faster.voidsetMaterialData(MaterialData material) voidvoidsetNodeRefreshIndex(int index) voidsetNodeRefreshSize(int size) voidEach two nodes be a segment, for example: {Node-0, Node-1, Node-2, Node-3} => {Segment-0{Node-0, Node-1}, Segment-1{Node-2, Node-3}}.voidsetSegmentsRenderingCount(int segmentsCount) voidsetSubmitLengthCalculatingStep(int step) voidsetSynchronousSubmit(boolean sync) High performance impact when is synchronized.voidsetTexturePixels(float texturePixels) voidsetTextureSpeed(float textureSpeed) It is working together withCurveEntity.setTexturePixels(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.BaseRenderData
advanceGlobalTimer, appendToEntity, appendToEntity, appendToEntity, appendToEntity, delete, getBlendAlphaDST, getBlendAlphaSRC, getBlendColorDST, getBlendColorSRC, getBlendEquation, getBlendState, getCampaignLayer, getCombatLayer, getControlData, getCustomData, getGlobalTimer, getGlobalTimerAlpha, getGlobalTimerState, getLayer, getModelMatrix, getModelMatrixBuffer, getPrimeMatrix, getPrimeMatrixBuffer, getPrimeMatrixState, hasDelete, initIdentityModelMatrix, initIdentityPrimeMatrix, isAutoSubmitEntityData, isAutoSubmitModelMatrix, isAutoSubmitPrimeMatrix, isGlobalTimerOnce, isGlobalTimerOver, isTimerPaused, isTimingWhenPaused, pickDataPackage_vec4, 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
-
_CIRCLE_FIX
protected static final float _CIRCLE_FIX- See Also:
-
_NODE_SIZE_F16
protected static final byte _NODE_SIZE_F16- See Also:
-
_NODE_SIZE_F32
protected static final byte _NODE_SIZE_F32- See Also:
-
_segmentID
protected final int _segmentID -
_nodesVBO
protected final int _nodesVBO -
_isValid
protected volatile boolean _isValid -
_useHalfFloat
protected final boolean _useHalfFloat -
_currNodeSize
protected final byte _currNodeSize -
_currNodeBitOffset
protected final byte _currNodeBitOffset -
nodeList
-
_lastNodeLength
protected int _lastNodeLength -
shouldRenderingCount
protected int shouldRenderingCount -
nodeRefreshState
protected final int[] nodeRefreshState -
_distance
-
interpolation
protected short interpolation -
state
protected final float[] state -
stateB
protected boolean[] stateB -
material
-
-
Constructor Details
-
SegmentEntity
public SegmentEntity(boolean useHalfFloat) - Parameters:
useHalfFloat-truethat the data buffer will usehalf-float, else usefloat.
-
SegmentEntity
public SegmentEntity()
-
-
Method Details
-
_StatePackageStack
protected int _StatePackageStack()- Overrides:
_StatePackageStackin classBaseRenderData
-
initResourceLayout
protected void initResourceLayout() -
getSegmentID
public int getSegmentID() -
getNodesVBO
public int getNodesVBO() -
isValid
public boolean isValid() -
isHalfFloatData
public boolean isHalfFloatData() -
_deleteExc
protected void _deleteExc()- Overrides:
_deleteExcin classBaseRenderData
-
glDraw
public void glDraw()- Specified by:
glDrawin interfaceRenderDataAPI- Overrides:
glDrawin classBaseRenderData
-
_resetExc
protected void _resetExc()- Overrides:
_resetExcin classBaseRenderData
-
resetNodes
public void resetNodes() -
getRealNodeCount
protected static int getRealNodeCount(int num) -
isEndNode
protected static boolean isEndNode(int index) -
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.For half-float, cost
22 Byte * nof vRAM when have number ofnnodes(n is non-zero even number), that if it had8192nodes will cost176 KiBof vRAM.For float, cost
36 Byte * nand8192nodes will cost176 KiBof 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().
-
getListValidNodeCount
public int getListValidNodeCount() -
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() -
getSegmentsRenderingCount
public int getSegmentsRenderingCount() -
setSegmentsRenderingCount
public void setSegmentsRenderingCount(int segmentsCount) -
getNodes
-
setNodes
Each two nodes be a segment, for example: {Node-0, Node-1, Node-2, Node-3} => {Segment-0{Node-0, Node-1}, Segment-1{Node-2, Node-3}}.Ignore isolated node.
- Parameters:
nodeList- Cannot have any null-node, and at least have two nodeList, if not then pass this entity when rendering.
-
addNode
-
initLineStrip
public SegmentEntity 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 SegmentEntity 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.
-
initCircle
public SegmentEntity 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 SegmentEntity 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 withCurveEntity.setTexturePixels(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) -
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) -
getMaterialData
- Specified by:
getMaterialDatain interfaceMaterialRenderAPI
-
setMaterialData
- Specified by:
setMaterialDatain interfaceMaterialRenderAPI
-
submitEntityData
public void submitEntityData()Description copied from class:BaseRenderDataWithout matrix data or timer settings.- Specified by:
submitEntityDatain interfaceRenderDataAPI- Overrides:
submitEntityDatain classBaseRenderData
-
entityType
- Specified by:
entityTypein interfaceRenderDataAPI- Overrides:
entityTypein classBaseRenderData
-