Interface ReadableDepthRenderTarget

All Known Implementing Classes:
DepthRenderTargetMixin

@API(status=EXPERIMENTAL) public interface ReadableDepthRenderTarget
Implemented by every RenderTarget when the feature is enabled in the config.

This allows access to a depth texture that the render target writes to instead of the usual render buffer.

  • Method Details

    • getStillDepthMap

      @API(status=EXPERIMENTAL) int getStillDepthMap()
      Returns a still of this render target's depth texture. For most intents and purposes, this is the texture that API consumers should read from.

      This texture is updated only when freezeDepthMap() is called. For the main render target, it is updated automatically right before PostLevelRenderCallback.EVENT is fired. Note that the content of the main render target's depth texture depends on the graphic quality setting. With GraphicsStatus.FABULOUS, no translucent object will appear on the main depth texture, so consumers may need to also use the depth textures from the various layers used by the LevelRenderer's transparency shader.

      Because this texture is independent from the render target's actual depth texture, it is safe to use anytime (whereas using the actual depth texture may cause corruption if it is simultaneously written to).

      The returned value may be -1 if the render target does not have a depth attachment. This should never be the case for the main render target.

      Returns:
      a still of this render target's depth texture
    • freezeDepthMap

      @API(status=EXPERIMENTAL) void freezeDepthMap()
      Freezes the current depth texture for use in getStillDepthMap().

      This is called by default on the Minecraft.getMainRenderTarget() main render target once every frame, right before PostLevelRenderCallback is fired.

      Calling this method will bind this render target.

    • getFrom

      static ReadableDepthRenderTarget getFrom(com.mojang.blaze3d.pipeline.RenderTarget target)
    • getStillDepthMap

      static int getStillDepthMap(com.mojang.blaze3d.pipeline.RenderTarget target)
    • freezeDepthMap

      static void freezeDepthMap(com.mojang.blaze3d.pipeline.RenderTarget target)