Class VolumeDepthMask
java.lang.Object
gaiasky.render.gdx.graphics.VolumeDepthMask
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.graphics.TextureBinds a cleared depth target for this volume; the scene framebuffer and viewport are saved and put back byrestore().voidcompose(com.badlogic.gdx.graphics.Texture front) Min-composes one front into the depth buffer restored byrestore(): a fullscreen quad writing the stored value, with aGL_LEQUALtest.voiddispose()voidFrees the compose shader and quad as well.voidrestore()Puts back the framebuffer and viewport saved bybegin(Object).com.badlogic.gdx.graphics.Texture
-
Constructor Details
-
VolumeDepthMask
public VolumeDepthMask()
-
-
Method Details
-
begin
Binds a cleared depth target for this volume; the scene framebuffer and viewport are saved and put back byrestore().- 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 bybegin(Object). -
texture
- 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 byrestore(): a fullscreen quad writing the stored value, with aGL_LEQUALtest.- Parameters:
front- The distance to compose, fromtexture(Object).
-
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
disposeAll
public void disposeAll()Frees the compose shader and quad as well. Call once, when the renderer goes away.
-