Class ParticleSetUpdaterTask

java.lang.Object
gaiasky.scene.task.ParticleSetUpdaterTask
All Implemented Interfaces:
IObserver, Runnable

public class ParticleSetUpdaterTask extends Object implements Runnable, IObserver
The task to update particle sets. A full update operation happens in two steps:
  • Update metadata: particle metadata like positions and proper motions are updated.
  • Sort particles: particles are sorted w.r.t. their distance to the camera and brightness.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final double
     
    protected static final double
     
    protected static final double
     
    protected static final double
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ParticleSetUpdaterTask(com.badlogic.ashley.core.Entity entity, ParticleSet particleSet)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    brightnessProxy(float absMag, double distanceSquared)
    Computes a proxy to the star brightness given its absolute magnitude and distance squared.
    void
     
    void
    notify(Event event, Object source, Object... data)
    Event notification call.
    void
    run()
     
    void
    update(ICamera camera)
    Triggers the update task if the requirements for it are met: Set is not updating. Opacity is not 0. Time since last update is not larger than updateInterval*2. The camera has moved a lot. Time is on and very fast.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • UPDATE_INTERVAL_S

      protected static final double UPDATE_INTERVAL_S
      See Also:
    • UPDATE_INTERVAL_S_2

      protected static final double UPDATE_INTERVAL_S_2
      See Also:
    • CAM_DX_TH

      protected static final double CAM_DX_TH
    • CAM_DX_TH_SQ

      protected static final double CAM_DX_TH_SQ
  • Constructor Details

    • ParticleSetUpdaterTask

      public ParticleSetUpdaterTask(com.badlogic.ashley.core.Entity entity, ParticleSet particleSet)
  • Method Details

    • update

      public void update(ICamera camera)
      Triggers the update task if the requirements for it are met:
      • Set is not updating.
      • Opacity is not 0.
      • Time since last update is not larger than updateInterval*2.
      • The camera has moved a lot.
      • Time is on and very fast.
      Parameters:
      camera - The camera.
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • brightnessProxy

      public static double brightnessProxy(float absMag, double distanceSquared)
      Computes a proxy to the star brightness given its absolute magnitude and distance squared. Uses a pre-computed table to avoid FastMath.pow(double, double) calls.
      Parameters:
      absMag - The absolute magnitude.
      distanceSquared - The distance^2 to the star.
      Returns:
      A proxy to the brightness, useful for comparing stars.
    • notify

      public void notify(Event event, Object source, Object... data)
      Description copied from interface: IObserver
      Event notification call.
      Specified by:
      notify in interface IObserver
      Parameters:
      event - The event type.
      source - The source object, if any.
      data - The data associated with this event.
    • dispose

      public void dispose()