From 4666692d0e37bba36d76df8ef12ddfce1c7f9a70 Mon Sep 17 00:00:00 2001 From: Dominik Date: Thu, 3 Dec 2026 23:15:07 -0800 Subject: [PATCH] Draw objects flagged alwaysOnTop last, over the composite, without depth test An object with obj.alwaysOnTop set is skipped by the depth, opaque and transparent passes and drawn after the composite with premultiplied blending, in object order. Pick pass unchanged. --- scene.js | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/scene.js b/scene.js index df304f6..9c634dd 100644 --- a/scene.js +++ b/scene.js @@ -730,7 +730,7 @@ function createScene(options) { } for(var i = 0; i < numObjsNow(); ++i) { var o = objects[i] - if(o.isOpaque && o.isOpaque()) o.draw(cameraParams) + if(o.isOpaque && o.isOpaque() && !o.alwaysOnTop) o.draw(cameraParams) } gl.colorMask(true, true, true, true) @@ -1002,10 +1002,10 @@ function createScene(options) { var obj = objects[i] obj.axes = axes obj.pixelRatio = scene.pixelRatio - if(obj.isOpaque && obj.isOpaque()) { + if(obj.isOpaque && obj.isOpaque() && !obj.alwaysOnTop) { obj.draw(cameraParams) } - if(obj.isTransparent && obj.isTransparent()) { + if(obj.isTransparent && obj.isTransparent() && !obj.alwaysOnTop) { hasTransparent = true } } @@ -1016,7 +1016,7 @@ function createScene(options) { var legacyObjs = false for(var i=0; i