Class TrailEntity

java.lang.Object
org.boxutil.base.BaseRenderData
org.boxutil.units.standard.entity.TrailEntity
All Implemented Interfaces:
MaterialRenderAPI, RenderDataAPI

public class TrailEntity extends BaseRenderData implements MaterialRenderAPI
This is a 2D trail.

Use vanilla beam texture uv(transversal beam texture).

  • Field Details

    • _BUFFER_DATA_SIZE

      protected static final byte _BUFFER_DATA_SIZE
      See Also:
    • _TBO

      protected final int _TBO
    • _TBOTex

      protected final int _TBOTex
    • _isValid

      protected volatile boolean _isValid
    • nodeList

      protected List<org.lwjgl.util.vector.Vector2f> nodeList
    • _lastNodeLength

      protected int _lastNodeLength
    • _distance

      protected List<Float> _distance
    • shouldRenderingCount

      protected int shouldRenderingCount
    • nodeRefreshState

      protected final int[] nodeRefreshState
    • colorState

      protected final float[] colorState
    • state

      protected final float[] state
    • stateB

      protected final boolean[] stateB
    • material

      protected MaterialData material
    • multiBind

      protected final IntBuffer multiBind
  • Constructor Details

    • TrailEntity

      public TrailEntity()
  • Method Details

    • _StatePackageStack

      protected int _StatePackageStack()
      Overrides:
      _StatePackageStack in class BaseRenderData
    • getNodesTBO

      public int getNodesTBO()
    • getNodesTBOTex

      public int getNodesTBOTex()
    • isValid

      public boolean isValid()
    • _deleteExc

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

      public void glDraw()
      Specified by:
      glDraw in interface RenderDataAPI
      Overrides:
      glDraw in class BaseRenderData
    • _resetExc

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

      public void resetNodes()
    • computePrim

      protected int computePrim(int num)
    • 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 12 Byte * n of vRAM when have number of n nodes(n is non-zero even number), that if it had 8192 nodes will cost 96 KiB of vRAM.

      Returns:
      return BoxEnum.STATE_SUCCESS when success.

      return BoxEnum.STATE_FAILED when an empty node list or refresh count is zero.

      return BoxEnum.STATE_FAILED_OTHER when 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_SUCCESS when success.

      return BoxEnum.STATE_FAILED when parameter error.

      return BoxEnum.STATE_FAILED_OTHER when happened another error.

    • isSynchronousSubmit

      public boolean isSynchronousSubmit()
    • setSynchronousSubmit

      public void setSynchronousSubmit(boolean sync)
      High performance impact when is synchronized.
    • isMappingModeSubmitData

      public boolean isMappingModeSubmitData()
    • setMappingModeSubmitData

      public void setMappingModeSubmitData(boolean mappingMode)
      For some very slight data, use glBufferSubData() 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 use glMapBufferRange(), else use glBufferSubData().
    • 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()
    • getValidNodeCount

      public int getValidNodeCount()
    • isHaveValidNodeCount

      public boolean isHaveValidNodeCount()
    • getNodeRenderingCount

      public int getNodeRenderingCount()
    • setNodeRenderingCount

      public void setNodeRenderingCount(int nodeCount)
    • glPrimCount

      protected int glPrimCount()
    • getNodes

      public List<org.lwjgl.util.vector.Vector2f> getNodes()
    • setNodes

      public void setNodes(@NotNull List<org.lwjgl.util.vector.Vector2f> nodeList)
      Recommend to use relative coordinate.

      Node at index 0 will be the end point of the trail.

      Parameters:
      nodeList - Cannot have any null-node, and at least have two nodes, if not then pass this entity when rendering.
    • addNode

      public void addNode(@NotNull org.lwjgl.util.vector.Vector2f node)
      Node at index 0 will be the end point of the trail, and draw from index end to the last index/ the start point.
    • putShaderTrailData

      public void putShaderTrailData()
    • getColorState

      public float[] getColorState()
    • copyColorState

      public void copyColorState(float[] colorState)
    • getStartColorArray

      public float[] getStartColorArray()
    • getStartColorC

      public Color getStartColorC()
    • getStartColor

      public org.lwjgl.util.vector.Vector4f getStartColor()
    • getStartColorAlpha

      public float getStartColorAlpha()
    • setStartColor

      public void setStartColor(@NotNull org.lwjgl.util.vector.Vector4f color)
    • setStartColor

      public void setStartColor(float r, float g, float b, float a)
    • setStartColor

      public void setStartColor(Color color)
    • setStartColorAlpha

      public void setStartColorAlpha(float alpha)
    • getEndColorArray

      public float[] getEndColorArray()
    • getEndColorC

      public Color getEndColorC()
    • getEndColor

      public org.lwjgl.util.vector.Vector4f getEndColor()
    • getEndColorAlpha

      public float getEndColorAlpha()
    • setEndColor

      public void setEndColor(@NotNull org.lwjgl.util.vector.Vector4f color)
    • setEndColor

      public void setEndColor(float r, float g, float b, float a)
    • setEndColor

      public void setEndColor(Color color)
    • setEndColorAlpha

      public void setEndColorAlpha(float alpha)
    • getStartEmissiveArray

      public float[] getStartEmissiveArray()
    • getStartEmissiveC

      public Color getStartEmissiveC()
    • getStartEmissive

      public org.lwjgl.util.vector.Vector4f getStartEmissive()
    • getStartEmissiveAlpha

      public float getStartEmissiveAlpha()
    • setStartEmissive

      public void setStartEmissive(@NotNull org.lwjgl.util.vector.Vector4f color)
    • setStartEmissive

      public void setStartEmissive(float r, float g, float b, float a)
    • setStartEmissive

      public void setStartEmissive(Color color)
    • setStartEmissiveAlpha

      public void setStartEmissiveAlpha(float alpha)
    • getEndEmissiveArray

      public float[] getEndEmissiveArray()
    • getEndEmissiveC

      public Color getEndEmissiveC()
    • getEndEmissive

      public org.lwjgl.util.vector.Vector4f getEndEmissive()
    • getEndEmissiveAlpha

      public float getEndEmissiveAlpha()
    • setEndEmissive

      public void setEndEmissive(@NotNull org.lwjgl.util.vector.Vector4f color)
    • setEndEmissive

      public void setEndEmissive(float r, float g, float b, float a)
    • setEndEmissive

      public void setEndEmissive(Color color)
    • setEndEmissiveAlpha

      public void setEndEmissiveAlpha(float alpha)
    • getStartWidth

      public float getStartWidth()
    • setStartWidth

      public void setStartWidth(float width)
    • setStartWidthDirect

      public void setStartWidthDirect(float widthHalf)
    • getEndWidth

      public float getEndWidth()
    • setEndWidth

      public void setEndWidth(float width)
    • setEndWidthDirect

      public void setEndWidthDirect(float widthHalf)
    • getMixFactor

      public float getMixFactor()
    • setMixFactor

      public void setMixFactor(float factor)
    • getTextureSpeed

      public float getTextureSpeed()
    • setTextureSpeed

      public void setTextureSpeed(float textureSpeed)
      It is working together with CurveEntity.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)
    • getJitterPower

      public float getJitterPower()
    • setJitterPower

      public void setJitterPower(float power)
      perpendicular to trail, effect on trail texture uv.
    • isFlick

      public boolean isFlick()
    • setFlick

      public void setFlick(boolean flick)
    • isFlickWhenPaused

      public boolean isFlickWhenPaused()
    • setFlickWhenPaused

      public void setFlickWhenPaused(boolean flick)
    • getFlickMixValue

      public float getFlickMixValue()
    • setFlickMixValue

      public void setFlickMixValue(float mix)
    • getCurrentFlickerSyncValue

      public float getCurrentFlickerSyncValue()
    • isSyncFlick

      public boolean isSyncFlick()
    • setSyncFlick

      public void setSyncFlick(boolean syncFlick)
      For each line segments.
    • isStripLineMode

      public boolean isStripLineMode()
      Returns:
      true for default.
    • setStripLineMode

      public void setStripLineMode(boolean isStripLine)
      Parameters:
      isStripLine - false that draw dotted line as GL_LINES style, else GL_LINE_STRIP style.
    • setFlickerSyncCode

      public void setFlickerSyncCode(int code)
      Parameters:
      code - java instance Object.hashCode() * 0.00066667f for default.
    • getMaterialData

      @NotNull public MaterialData getMaterialData()
      Specified by:
      getMaterialData in interface MaterialRenderAPI
    • setMaterialData

      public void setMaterialData(@NotNull MaterialData material)
      Specified by:
      setMaterialData in interface MaterialRenderAPI
    • 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 BaseRenderData
    • entityType

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