Class SimpleParticleControlData

java.lang.Object
org.boxutil.base.BaseControlData
org.boxutil.base.SimpleParticleControlData
All Implemented Interfaces:
ControlDataAPI

public class SimpleParticleControlData extends org.boxutil.base.BaseControlData
Very^32 simple particle dynamic resource manager.

Only for one entity.

For reference.

See Also:
  • Field Details

    • _sync_lock

      protected final ReentrantSpinLock _sync_lock
    • entity

      protected InstanceRenderAPI entity
    • stateB

      protected final boolean[] stateB
    • state

      protected final int[] state
    • stateF

      protected final float[] stateF
  • Constructor Details

    • SimpleParticleControlData

      public SimpleParticleControlData(int maxParticles, float maxDur, float dataDur, boolean ignorePaused, boolean use3D)
      Parameters:
      maxDur - The maximum duration for all particles. When a particle is added (unless setRemainingTimeToReset(float) or refreshRemainingTimeToReset(float) called after that), the internal timer is set to this value. Once the timer expires, all particles are considered to have finished playing, at which point the data is reset and rendering is paused until new particles are added.
      dataDur - rendering once if at (-3000.0f, -1000.0f), always active if less than -3000.0f.
    • SimpleParticleControlData

      public SimpleParticleControlData(int maxParticles, float maxDur, float dataDur, boolean ignorePaused)
      Parameters:
      maxDur - The maximum duration for all particles. When a particle is added (unless setRemainingTimeToReset(float) or refreshRemainingTimeToReset(float) called after that), the internal timer is set to this value. Once the timer expires, all particles are considered to have finished playing, at which point the data is reset and rendering is paused until new particles are added.
      dataDur - rendering once if at (-3000.0f, -1000.0f), always active if less than -3000.0f.
  • Method Details

    • toAddBefore

      protected boolean toAddBefore()
    • toAddAfter

      protected InstanceDataAPI toAddAfter(float setRemaining)
    • addParticle

      @Nullable public Instance2Data addParticle()
      Returns:
      null if it cannot add.
    • addParticle3D

      @Nullable public Instance3Data addParticle3D()
      Returns:
      null if it cannot add.
    • addParticle

      public Instance2Data addParticle(org.lwjgl.util.vector.Vector2f location, float facing, float turnRate, org.lwjgl.util.vector.Vector2f velocity, org.lwjgl.util.vector.Vector2f scale, org.lwjgl.util.vector.Vector2f scaleRate, Color basecolor, Color emissive, float in, float full, float out)
    • addParticle

      public Instance2Data addParticle(float spawnStartRadius, float velAngRad, float velocity, float scale, Color basecolor, Color emissive, float in, float full, float out)
    • addParticle

      public Instance2Data addParticle(float spawnStartRadius, float velocity, float scale, Color basecolor, Color emissive, float in, float full, float out)
    • addParticle

      public Instance2Data addParticle(float spawnStartRadius, float velocity, float scale, float in, float full, float out)
    • addParticle

      public Instance2Data addParticle(float spawnStartRadius, float velocity, float scale, float out)
    • setRemainingTimeToReset

      public void setRemainingTimeToReset(float duration)
    • refreshRemainingTimeToReset

      public void refreshRemainingTimeToReset(float duration)
    • clearParticles

      public void clearParticles()
    • forceDelete

      public void forceDelete()
    • isEntityExpired

      public boolean isEntityExpired()
    • getEntity

      public InstanceRenderAPI getEntity()
    • controlInit

      public void controlInit(@NotNull RenderDataAPI renderEntity)
      Description copied from class: BaseControlData
      Run once as long as linked to a render entity.
      Specified by:
      controlInit in interface ControlDataAPI
      Overrides:
      controlInit in class org.boxutil.base.BaseControlData
    • controlAdvance

      public void controlAdvance(@NotNull RenderDataAPI renderEntity, float amount)
      Description copied from class: BaseControlData
      Running on another thread.

      Executes in the logical advance.

      Invalid when ControlDataAPI.controlIsOnceRender(RenderDataAPI) is ture.

      Specified by:
      controlAdvance in interface ControlDataAPI
      Overrides:
      controlAdvance in class org.boxutil.base.BaseControlData
    • controlAlphaBasedTimer

      public boolean controlAlphaBasedTimer(@NotNull RenderDataAPI renderEntity)
      Description copied from interface: ControlDataAPI
      Specified by:
      controlAlphaBasedTimer in interface ControlDataAPI
      Overrides:
      controlAlphaBasedTimer in class org.boxutil.base.BaseControlData
    • controlRemoveBasedTimer

      public boolean controlRemoveBasedTimer(@NotNull RenderDataAPI renderEntity)
      Description copied from class: BaseControlData
      Will call ControlDataAPI.controlRemove(RenderDataAPI) when timer of entity is out.
      Specified by:
      controlRemoveBasedTimer in interface ControlDataAPI
      Overrides:
      controlRemoveBasedTimer in class org.boxutil.base.BaseControlData
    • controlRunWhilePaused

      public boolean controlRunWhilePaused(@NotNull RenderDataAPI renderEntity)
      Description copied from class: BaseControlData
      Affects ControlDataAPI.controlAdvance(RenderDataAPI, float) and compute instance data.
      Specified by:
      controlRunWhilePaused in interface ControlDataAPI
      Overrides:
      controlRunWhilePaused in class org.boxutil.base.BaseControlData
    • controlIsOnceRender

      public boolean controlIsOnceRender(@NotNull RenderDataAPI renderEntity)
      Description copied from class: BaseControlData
      Force remove entity after init and render one frame.
      Specified by:
      controlIsOnceRender in interface ControlDataAPI
      Overrides:
      controlIsOnceRender in class org.boxutil.base.BaseControlData
    • controlIsDone

      public boolean controlIsDone(@NotNull RenderDataAPI renderEntity)
      Description copied from class: BaseControlData
      Force remove entity if true.
      Specified by:
      controlIsDone in interface ControlDataAPI
      Overrides:
      controlIsDone in class org.boxutil.base.BaseControlData
    • controlCanRenderNow

      public boolean controlCanRenderNow(@NotNull RenderDataAPI renderEntity)
      Description copied from class: BaseControlData
      Check it in each rendering frame.
      Specified by:
      controlCanRenderNow in interface ControlDataAPI
      Overrides:
      controlCanRenderNow in class org.boxutil.base.BaseControlData