Translucency Glow Depth (#2333)

* Replay translucent-pass block entities into a glow depth so glows sort against translucent terrain

* Let block entities opt out of the glow depth replay

* Keep glow fragments that add no color out of the echoed glow depth
This commit is contained in:
Ruling-0 authored and GitHub committed 2026-11-23 12:44:35 -05:00
1 parent 586cce1c40
commit 1758f3be1a
27 files changed
+867 -101

No files matched your search

@@ -0,0 +1,15 @@
package com.gtnewhorizons.angelica.api.tesr;
import com.gtnewhorizons.angelica.rendering.tesr.GlowReplayExclusions;
/// Under Fancy translucency, block entities drawing glows (blended draws without depth writes) in the translucent
/// pass are rendered a second time. Renderers that advance state per call opt out here.
public final class TesrGlowDepth {
private TesrGlowDepth() {}
/// Excludes block entities of `type`, or rendered by a renderer of `type`, including subclasses.
public static void excludeFromReplay(Class<?> type) {
GlowReplayExclusions.exclude(type);
}
}
@@ -1,5 +1,5 @@
/** TESR mesh cache/batch API (Render thread only) */
@API(owner = "angelica", provides = "angelica|tesr", apiVersion = "3")
@API(owner = "angelica", provides = "angelica|tesr", apiVersion = "4")
package com.gtnewhorizons.angelica.api.tesr;
import cpw.mods.fml.common.API;
@@ -177,6 +177,11 @@ public class AngelicaConfig {
@Config.RequiresMcRestart
public static String[] entityShadowReplayExcludedClasses;
@Config.Comment("Tile entity or renderer classes whose glows Fancy translucency records as they draw instead of rendering the tile entity a second time. For renderers that advance an animation or other state on each render.")
@Config.DefaultStringList({})
@Config.RequiresMcRestart
public static String[] glowDepthReplayExcludedClasses;
@Config.Comment("Skip the end-of-frame shader buffer copy by ping-ponging buffers. Disable if a shader pack misrenders.")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
@@ -301,6 +301,15 @@ public enum Mixins implements IMixins {
)
),
ANGELICA_GLOW_DEPTH_REPLAY(new MixinBuilder("Drop particles and sounds a block entity renderer starts while Fancy translucency replays it into the glow depth")
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableIris)
.addClientMixins(
"angelica.tesr.MixinEffectRenderer_GlowDepthReplay",
"angelica.tesr.MixinSoundHandler_GlowDepthReplay"
)
),
ANGELICA_TESR_PROVIDER_DISPATCH(new MixinBuilder("Route TesrMeshProvider renderers through the batched mesh cache, and observe renderers that mix model parts with their own draws")
.setPhase(Phase.EARLY)
.setApplyIf(() -> AngelicaConfig.enableTESRProviderDispatch || AngelicaConfig.enableEntityBatching)
@@ -44,6 +44,7 @@ import com.gtnewhorizons.angelica.compat.cubicchunks.CubicChunksAPI;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
import com.gtnewhorizons.angelica.dynamiclights.IDynamicLightWorldRenderer;
import com.gtnewhorizons.angelica.glsm.DepthEcho;
import com.gtnewhorizons.angelica.glsm.GLSMAttribStack;
import com.gtnewhorizons.angelica.glsm.GLSMBlend;
import com.gtnewhorizons.angelica.glsm.GLSMCurrentAttribs;
@@ -64,6 +65,7 @@ import com.gtnewhorizons.angelica.rendering.culling.GpuCulling;
import com.gtnewhorizons.angelica.render.WeatherRenderer;
import com.gtnewhorizons.angelica.rendering.culling.GpuTerrainCuller;
import com.gtnewhorizons.angelica.rendering.tesr.AngelicaTesrMeshCache;
import com.gtnewhorizons.angelica.rendering.tesr.GlowReplayExclusions;
import com.gtnewhorizons.angelica.rendering.tesr.ModelPartBatcher;
import com.gtnewhorizons.angelica.rendering.tesr.PendingTesrDraws;
import com.gtnewhorizons.angelica.rendering.tesr.SectionBuiltBlockEntity;
@@ -72,6 +74,7 @@ import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProviderHold
import com.gtnewhorizons.angelica.rendering.tesr.TesrAttribution;
import com.gtnewhorizons.angelica.rendering.tesr.TesrBatchRenderer;
import com.gtnewhorizons.angelica.rendering.tesr.TesrLifecycle;
import com.gtnewhorizons.angelica.rendering.tesr.TesrProviderDispatch;
import com.gtnewhorizons.angelica.rendering.translucency.TranslucencyLayers;
import com.gtnewhorizons.angelica.rendering.translucency.TranslucentLayer;
import net.coderbot.iris.Iris;
@@ -105,6 +108,7 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
private final ObjectArrayList<TileEntity> frameTEs = new ObjectArrayList<>();
private final ObjectArrayList<TileEntity> frameOverride = new ObjectArrayList<>();
private final ObjectArrayList<TileEntity> glowReplay = new ObjectArrayList<>();
private final TileEntityDepthOrder depthOrder = new TileEntityDepthOrder();
private final Matrix4f savedTextureMatrix = new Matrix4f();
@@ -432,6 +436,7 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
public void renderBlockEntitiesBeforeTranslucent(float partialTicks) {
if (passOne != PassOne.PENDING) return;
passOne = PassOne.DRAWN_EARLY;
glowReplay.clear();
if (!anyRendersInPassOne()) return;
final Minecraft mc = Minecraft.getMinecraft();
final boolean layered = TranslucencyLayers.INSTANCE.active();
@@ -460,6 +465,7 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
if (layered) TranslucencyLayers.INSTANCE.begin(TranslucentLayer.BLOCK_ENTITIES);
try {
renderBlockEntitiesInPhase(partialTicks);
if (layered) replayGlowDepth(partialTicks);
} finally {
if (layered) TranslucencyLayers.INSTANCE.end();
}
@@ -472,6 +478,45 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
}
}
private void replayGlowDepth(float partialTicks) {
if (glowReplay.isEmpty()) return;
try {
if (!TranslucencyLayers.INSTANCE.beginGlowReplay()) return;
try {
for (int i = 0; i < glowReplay.size(); i++) {
replayTE(glowReplay.get(i), partialTicks);
}
} finally {
TranslucencyLayers.INSTANCE.endGlowReplay();
}
} finally {
glowReplay.clear();
}
}
/// Calls the renderer directly, since a depth-only replay must not feed the dispatcher's lighting or
/// batch-eligibility tracking.
private static void replayTE(TileEntity tileEntity, float partialTicks) {
final TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileEntity);
if (renderer == null) return;
final double x = tileEntity.xCoord - TileEntityRendererDispatcher.staticPlayerX;
final double y = tileEntity.yCoord - TileEntityRendererDispatcher.staticPlayerY;
final double z = tileEntity.zCoord - TileEntityRendererDispatcher.staticPlayerZ;
final int depth = GLSMAttribStack.pushState(StateSet.BLEND);
GLSMCurrentAttribs.glColor4f(1f, 1f, 1f, 1f);
GLSMTextures.glActiveTexture(GL13.GL_TEXTURE0);
TesrBatchRenderer.INSTANCE.beginScope();
try {
if (AngelicaConfig.enableTESRProviderDispatch && TesrProviderDispatch.tryRender(renderer, tileEntity, x, y, z)) return;
renderer.renderTileEntityAt(tileEntity, x, y, z, partialTicks);
} catch (RuntimeException e) {
if (!tileEntity.isInvalid()) throw e;
} finally {
TesrBatchRenderer.INSTANCE.endScope();
GLSMAttribStack.popStateTo(depth);
}
}
private boolean anyRendersInPassOne() {
for (int i = 0; i < frameOverride.size(); i++) {
if (frameOverride.get(i).shouldRenderInPass(1)) return true;
@@ -710,9 +755,11 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
final boolean attribute = Tracy.ENABLED && TesrAttribution.currentRenderable == null;
if (attribute) TesrAttribution.currentRenderable = tileEntity.getClass();
if (Tracy.ENABLED) Tracy.beginZone(Z_TESR_RENDER_TE);
if (DepthEcho.armed() && !GlowReplayExclusions.excludes(tileEntity)) DepthEcho.beginTracking();
try {
TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity, partialTicks);
} finally {
if (DepthEcho.endTracking()) glowReplay.add(tileEntity);
if (Tracy.ENABLED) Tracy.endZone();
if (attribute) TesrAttribution.currentRenderable = null;
if (Tracy.ENABLED) RenderClassTimings.TESR.add(teLabelClass(tileEntity), System.nanoTime() - start);
@@ -0,0 +1,42 @@
package com.gtnewhorizons.angelica.rendering.tesr;
import com.gtnewhorizons.angelica.config.AngelicaConfig;
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public final class GlowReplayExclusions {
private static final ReferenceOpenHashSet<Class<?>> registered = new ReferenceOpenHashSet<>();
private static final Reference2ObjectOpenHashMap<Class<?>, Boolean> excluded = new Reference2ObjectOpenHashMap<>();
private GlowReplayExclusions() {}
public static void exclude(Class<?> type) {
if (registered.add(type)) excluded.clear();
}
public static boolean excludes(TileEntity tileEntity) {
final Class<? extends TileEntity> type = tileEntity.getClass();
Boolean result = excluded.get(type);
if (result == null) {
final TileEntitySpecialRenderer renderer = TileEntityRendererDispatcher.instance.getSpecialRendererByClass(type);
result = matches(type) || renderer != null && matches(renderer.getClass());
excluded.put(type, result);
}
return result;
}
private static boolean matches(Class<?> type) {
final String[] names = AngelicaConfig.glowDepthReplayExcludedClasses;
for (Class<?> c = type; c != null && c != Object.class; c = c.getSuperclass()) {
if (registered.contains(c)) return true;
if (names != null) for (String name : names) {
if (c.getName().equals(name)) return true;
}
}
return false;
}
}
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.rendering.tesr;
import com.gtnewhorizons.angelica.glsm.DepthEcho;
import net.minecraft.tileentity.TileEntity;
/**
@@ -40,7 +41,12 @@ public final class PendingTesrDraws {
final Pending owner = pending;
if (owner == null) return;
pending = null;
owner.flush();
DepthEcho.beginImmediate();
try {
owner.flush();
} finally {
DepthEcho.endImmediate();
}
}
public interface Pending {
@@ -7,6 +7,7 @@ import com.gtnewhorizons.angelica.api.tesr.TesrMaterial;
import com.gtnewhorizons.angelica.api.tesr.TesrShader;
import com.gtnewhorizons.angelica.client.font.BatchingFontRenderer;
import com.gtnewhorizons.angelica.compat.mojang.RenderLayer;
import com.gtnewhorizons.angelica.glsm.DepthEcho;
import com.gtnewhorizons.angelica.glsm.GLSMAttribStack;
import com.gtnewhorizons.angelica.glsm.GLSMBlend;
import com.gtnewhorizons.angelica.glsm.GLSMCurrentAttribs;
@@ -194,6 +195,7 @@ public final class TesrBatchRenderer {
}
public void queue(TemplateBuffer template, ResourceLocation texture, TesrMaterial material) {
if (DepthEcho.replaying() && cannotBlend(material)) return;
modelView.set(GLSMMatrices.getModelViewMatrix());
final int packedLight = currentPackedLight(material);
final int colorABGR = resolveColor(material);
@@ -216,6 +218,13 @@ public final class TesrBatchRenderer {
}
}
private static boolean cannotBlend(TesrMaterial material) {
if (material == TesrMaterial.CURRENT_STATE) return false;
final TesrMaterial.Transparency transparency = material.transparency();
return transparency == TesrMaterial.Transparency.OPAQUE || transparency == TesrMaterial.Transparency.GLINT || material.special().isGlint()
|| material.isDepthEqual() || material.isDepthOnly();
}
private static Matrix4f captureTextureMatrix() {
final Matrix4f texMatrix = GLSMTextures.getTextures().getTextureUnitMatrix(0);
return MatrixHelper.isIdentity(texMatrix) ? null : texMatrix;
@@ -1,5 +1,6 @@
package com.gtnewhorizons.angelica.rendering.translucency;
import com.gtnewhorizons.angelica.glsm.DepthEcho;
import com.gtnewhorizons.angelica.glsm.GLSMAttribStack;
import com.gtnewhorizons.angelica.glsm.GLSMBlend;
import com.gtnewhorizons.angelica.glsm.GLSMDepthStencilAlpha;
@@ -39,6 +40,10 @@ import java.nio.ByteBuffer;
///
/// The terrain layer has a second sheet for fragments behind the block-entity layer, so a tile entity inside a
/// block's own translucent model is covered only by the faces in front of it.
///
/// Glows (blended block-entity draws that write no depth) would sort at the opaque depth behind them, so
/// [DepthEcho] records their depth separately, and it is merged into the block-entity layer before anything
/// reads that depth.
public final class TranslucencyLayers {
private static final int LAYERS = TranslucentLayer.values().length;
@@ -78,11 +83,18 @@ public final class TranslucencyLayers {
private boolean splitting;
private boolean behindDrawn;
private Target glowDepth;
private boolean replayingGlows;
private CompositeProgram program;
private CompositeProgram behindProgram;
private GlProgram<Object> glowMergeProgram;
private int vao;
private StateSet prepareState;
private StateSet compositeState;
private StateSet clearDepthState;
private final Runnable compositePass = this::drawComposite;
private final Runnable glowMergePass = this::drawGlowMerge;
TranslucencyLayers(MainTarget main) {
this.main = main;
@@ -91,15 +103,19 @@ public final class TranslucencyLayers {
/// Whether layering applies is decided on the first [#active] call, once Iris has prepared the frame's pipeline.
public void beginFrame() {
decided = false;
drawnMask = 0;
behindDrawn = false;
resetFrame();
}
void beginFrame(boolean active) {
this.active = active;
decided = true;
resetFrame();
}
private void resetFrame() {
drawnMask = 0;
behindDrawn = false;
DepthEcho.takeEchoed();
}
public boolean active() {
@@ -123,13 +139,16 @@ public final class TranslucencyLayers {
savedDraw = GLSMFramebuffer.getDrawFramebuffer();
savedRead = GLSMFramebuffer.getReadFramebuffer();
syncSize();
if (layer == TranslucentLayer.TERRAIN) mergeGlowDepth();
final Target target = layer(layer);
final int bit = 1 << layer.ordinal();
if ((drawnMask & bit) == 0) {
drawnMask |= bit;
prepare(target);
if (layer == TranslucentLayer.BLOCK_ENTITIES) clearDepth(glowDepth());
}
target.framebuffer.bind();
if (layer == TranslucentLayer.BLOCK_ENTITIES) DepthEcho.arm(glowDepth.framebuffer.getId(), target.framebuffer.getId());
open = layer;
GLSMBlend.setLayerBlending(true);
final ColorMaskStack mask = GLSMBlend.getColorMask();
@@ -139,6 +158,7 @@ public final class TranslucencyLayers {
public void end() {
BatchStateGuard.beforeChange();
DepthEcho.disarm();
if (alphaMasked) {
final ColorMaskStack mask = GLSMBlend.getColorMask();
GLSMBlend.glColorMask(mask.red, mask.green, mask.blue, false);
@@ -154,6 +174,22 @@ public final class TranslucencyLayers {
}
public void bindOpenLayer() {
(replayingGlows ? glowDepth : layers[open.ordinal()]).framebuffer.bind();
}
public boolean beginGlowReplay() {
if (!DepthEcho.armed()) return false;
BatchStateGuard.beforeChange();
glowDepth.framebuffer.bind();
replayingGlows = true;
DepthEcho.beginReplay();
return true;
}
public void endGlowReplay() {
BatchStateGuard.beforeChange();
DepthEcho.endReplay();
replayingGlows = false;
layers[open.ordinal()].framebuffer.bind();
}
@@ -187,36 +223,64 @@ public final class TranslucencyLayers {
public void composite() {
if (drawnMask == 0) return;
BatchStateGuard.beforeChange();
syncSize();
if (drawnMask == 0) return;
try {
mergeGlowDepth();
fullscreenPass(compositePass);
} finally {
drawnMask = 0;
behindDrawn = false;
}
}
private void drawComposite() {
final Target snapshot = depthSnapshot();
blit(main.framebuffer(), snapshot.framebuffer.getId(), GL11.GL_DEPTH_BUFFER_BIT);
GLSMFramebuffer.glBindFramebuffer(GL30.GL_FRAMEBUFFER, main.framebuffer());
GLSMBlend.enableBlend();
GLSMBlend.tryBlendFuncSeparate(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
GLSMDepthStencilAlpha.glDepthFunc(GL11.GL_ALWAYS);
bindTexture(0, snapshot.depth);
for (int i = 0; i < LAYERS; i++) {
if ((drawnMask & (1 << i)) == 0) continue;
bindTexture(FIRST_LAYER_UNIT + i, layers[i].color);
bindTexture(FIRST_LAYER_UNIT + LAYERS + i, layers[i].depth);
}
if (behindDrawn) bindTexture(TERRAIN_BEHIND_UNIT, layers[TranslucentLayer.TERRAIN.ordinal()].behind);
final CompositeProgram composite = behindDrawn ? behindProgram : program;
GLSMPrograms.glUseProgram(composite.program.handle());
GLSMPrograms.glUniform1i(composite.maskUniform, drawnMask);
}
private void mergeGlowDepth() {
if (!DepthEcho.takeEchoed() || (drawnMask & (1 << TranslucentLayer.BLOCK_ENTITIES.ordinal())) == 0) return;
fullscreenPass(glowMergePass);
}
private void drawGlowMerge() {
layers[TranslucentLayer.BLOCK_ENTITIES.ordinal()].framebuffer.bind();
GLSMBlend.disableBlend();
GLSMBlend.glColorMask(false, false, false, false);
GLSMDepthStencilAlpha.glDepthFunc(GL11.GL_LESS);
bindTexture(0, glowDepth.depth);
GLSMPrograms.glUseProgram(glowMergeProgram.handle());
}
private void fullscreenPass(Runnable setup) {
final int draw = GLSMFramebuffer.getDrawFramebuffer();
final int read = GLSMFramebuffer.getReadFramebuffer();
final int activeProgram = GLSMPrograms.getActiveProgram();
final int activeVao = GLSMQueries.glGetInteger(GL30.GL_VERTEX_ARRAY_BINDING);
if (program == null) initProgram();
syncSize();
if (drawnMask == 0) return;
final Target snapshot = depthSnapshot();
final int depth = GLSMAttribStack.pushState(compositeState);
try {
GLSMRasterizer.disableScissorTest();
blit(main.framebuffer(), snapshot.framebuffer.getId(), GL11.GL_DEPTH_BUFFER_BIT);
GLSMFramebuffer.glBindFramebuffer(GL30.GL_FRAMEBUFFER, main.framebuffer());
GLSMRasterizer.glViewport(0, 0, width, height);
GLSMBlend.enableBlend();
GLSMBlend.tryBlendFuncSeparate(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
GLSMRasterizer.disableCull();
GLSMDepthStencilAlpha.enableDepthTest();
GLSMDepthStencilAlpha.glDepthFunc(GL11.GL_ALWAYS);
GLSMDepthStencilAlpha.glDepthMask(true);
bindTexture(0, snapshot.depth);
for (int i = 0; i < LAYERS; i++) {
if ((drawnMask & (1 << i)) == 0) continue;
bindTexture(FIRST_LAYER_UNIT + i, layers[i].color);
bindTexture(FIRST_LAYER_UNIT + LAYERS + i, layers[i].depth);
}
if (behindDrawn) bindTexture(TERRAIN_BEHIND_UNIT, layers[TranslucentLayer.TERRAIN.ordinal()].behind);
final CompositeProgram composite = behindDrawn ? behindProgram : program;
GLSMPrograms.glUseProgram(composite.program.handle());
GLSMPrograms.glUniform1i(composite.maskUniform, drawnMask);
setup.run();
GLSMRasterizer.glViewport(0, 0, width, height);
GLSMVertexInput.glBindVertexArray(vao);
GLSMDraws.glDrawArrays(GL11.GL_TRIANGLES, 0, 3);
} finally {
@@ -225,8 +289,6 @@ public final class TranslucencyLayers {
GLSMFramebuffer.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, draw);
GLSMFramebuffer.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, read);
GLSMAttribStack.popStateTo(depth);
drawnMask = 0;
behindDrawn = false;
}
}
@@ -235,15 +297,22 @@ public final class TranslucencyLayers {
if (program != null) {
program.program.delete();
behindProgram.program.delete();
glowMergeProgram.delete();
GLSMVertexInput.glDeleteVertexArrays(vao);
program = null;
behindProgram = null;
glowMergeProgram = null;
}
}
private void initProgram() {
program = new CompositeProgram("angelica:translucency_composite", ShaderConstants.EMPTY);
behindProgram = new CompositeProgram("angelica:translucency_composite_behind", ShaderConstants.builder().add("TERRAIN_BEHIND").build());
glowMergeProgram = PanoramaRenderer.loadProgram("angelica:translucency_glow_depth", "angelica:panorama_blur", "angelica:translucency_glow_depth", ctx -> ctx);
final int merge = glowMergeProgram.handle();
GLSMPrograms.glUseProgram(merge);
GLSMPrograms.glUniform1i(GLSMPrograms.glGetUniformLocation(merge, "u_GlowDepth"), 0);
GLSMPrograms.glUseProgram(0);
vao = GLSMVertexInput.glGenVertexArrays();
compositeState = StateSet.forMask(GL11.GL_ALL_ATTRIB_BITS);
}
@@ -267,6 +336,20 @@ public final class TranslucencyLayers {
}
}
private void clearDepth(Target target) {
if (clearDepthState == null) clearDepthState = StateSet.forMask(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_SCISSOR_BIT);
final int depth = GLSMAttribStack.pushState(clearDepthState);
try {
GLSMRasterizer.disableScissorTest();
GLSMDepthStencilAlpha.glDepthMask(true);
GLSMDepthStencilAlpha.glClearDepth(1.0);
target.framebuffer.bind();
GLSMFramebuffer.glClear(GL11.GL_DEPTH_BUFFER_BIT);
} finally {
GLSMAttribStack.popStateTo(depth);
}
}
private void blit(int from, int to, int mask) {
GLSMFramebuffer.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, from);
GLSMFramebuffer.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, to);
@@ -293,6 +376,11 @@ public final class TranslucencyLayers {
return layers[i];
}
private Target glowDepth() {
if (glowDepth == null) glowDepth = new Target(width, height, depthFormat, false);
return glowDepth;
}
private Target depthSnapshot() {
if (depthSnapshot == null) depthSnapshot = new Target(width, height, depthFormat, false);
return depthSnapshot;
@@ -305,8 +393,10 @@ public final class TranslucencyLayers {
}
if (depthSnapshot != null) depthSnapshot.destroy();
depthSnapshot = null;
drawnMask = 0;
behindDrawn = false;
if (glowDepth != null) glowDepth.destroy();
glowDepth = null;
DepthEcho.disarm();
resetFrame();
}
private static final class CompositeProgram {