Class Volume

java.lang.Object
gaiasky.scene.component.Volume
All Implemented Interfaces:
com.badlogic.ashley.core.Component

public class Volume extends Object implements com.badlogic.ashley.core.Component
Stores information for volumetric rendering of bodies.
  • Field Details

    • logger

      public static final Logger.Log logger
    • vertexShader

      public String vertexShader
    • fragmentShader

      public String fragmentShader
    • key

      public int key
    • writeDepth

      public boolean writeDepth
      Whether this volume takes part in the depth-only pre-pass. Enabled by default.

      A volume can be a real occluder: its box spans a region of space, and the fragment shader writes the depth of the first sample dense enough to hide what is behind it, so anything drawn after the volume pass (labels, grids, stars, planets) is hidden behind it. Without the write, a ray that crosses dust but no gas emits no colour at all - the dust only attenuates - so everything behind the dust shows through it. Set to false to restore the read-only, always-see-through behaviour.

      Which volumes actually occlude is decided per slot, by MaterialComponent.volumeDepthThreshold: an emissive volume such as gas normally carries no threshold and stays transparent to the depth buffer, while the absorbing one (dust) carries one, so only its dense lanes hide anything. With no threshold set on any slot this flag has no visible effect, and the pre-pass is wasted work.

    • iterations

      public int[] iterations
      Number of iterations for the ray-marching volume shader, per quality preset.
  • Constructor Details

    • Volume

      public Volume()
  • Method Details

    • setWriteDepth

      public void setWriteDepth(Boolean writeDepth)
      Setter used by the scene JSON loader. Accepts Boolean so an explicit "writeDepth": false overrides the default.
    • setIterations

      public void setIterations(Long iterations)
      Sets the iteration count for the ray-marcher on this volume.
      Parameters:
      iterations - Single value: same iteration count for all graphics qualities. The JSON loader hands over a scalar integer as Long, so this must take a Long for the reflective lookup to find it.
    • setRaymarchIterations

      public void setRaymarchIterations(Long iterations)
    • setIterationCount

      public void setIterationCount(Long iterations)
    • setIterations

      public void setIterations(int[] iterations)
      Sets the iteration count for the ray-marcher on this volume.
      Parameters:
      iterations - Array of integers, one per graphics quality [LOW, NORMAL, HIGH, ULTRA].
    • setRaymarchIterations

      public void setRaymarchIterations(int[] iterations)
    • setIterationCount

      public void setIterationCount(int[] iterations)