Class VolumeDepthMask

java.lang.Object
gaiasky.render.gdx.graphics.VolumeDepthMask
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable

public class VolumeDepthMask extends Object implements com.badlogic.gdx.utils.Disposable
One depth texture per volume, holding the distance to that volume's own first occluding sample, plus the machinery to compose those distances into the scene depth buffer.

The pre-pass must write the dust front into the scene depth so the star, label and point passes are hidden behind it, but that front is still there when the color pass runs, so testing against it compares the volume with itself (the color pass may run at half resolution and dithers). Storing each front separately lets the color pass compare the buffer with a value written by that same pass: equal or farther means this volume is nearest, nearer means something occludes it.

  • Constructor Details

    • VolumeDepthMask

      public VolumeDepthMask()
  • Method Details

    • begin

      public com.badlogic.gdx.graphics.Texture begin(Object key)
      Binds a cleared depth target for this volume; the scene framebuffer and viewport are saved and put back by restore().
      Parameters:
      key - The volume the target belongs to.
      Returns:
      The target's depth texture, or null if depth textures are not available.
    • restore

      public void restore()
      Puts back the framebuffer and viewport saved by begin(Object).
    • texture

      public com.badlogic.gdx.graphics.Texture texture(Object key)
      Parameters:
      key - The volume the target belongs to.
      Returns:
      The volume's own front, or null if it has never been rendered.
    • compose

      public void compose(com.badlogic.gdx.graphics.Texture front)
      Min-composes one front into the depth buffer restored by restore(): a fullscreen quad writing the stored value, with a GL_LEQUAL test.
      Parameters:
      front - The distance to compose, from texture(Object).
    • dispose

      public void dispose()
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
    • disposeAll

      public void disposeAll()
      Frees the compose shader and quad as well. Call once, when the renderer goes away.