A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(render): with no post-process chain, a blended pane in front of water is drawn over it instead of under it
yhhb5b770358fc8
diff --git a/desktop b/desktopindex 23218c037..bd6a301cc 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit 23218c03773b7d590505bdc6384f4345d5484f17+Subproject commit bd6a301cc8c3cba2b308264d2725043b0c7591b0diff --git a/src/esengine/renderer/frame/RenderFrame.cpp b/src/esengine/renderer/frame/RenderFrame.cppindex f2555d997..ff8962e7f 100644--- a/src/esengine/renderer/frame/RenderFrame.cpp+++ b/src/esengine/renderer/frame/RenderFrame.cpp@@ -785,8 +785,20 @@ void RenderFrame::end() {};#endif}- scene.execute = [this, glass, layered](const rg::PassContext&) {- drawScene(layered ? DrawList::Phase::OpaqueOnly : glass ? DrawList::Phase::WithoutSceneColor : DrawList::Phase::All);+ // With no chain to take the scene from, water and glass draw in the one pass, and the order the list sorts blended draws in (by+ // where each object stands) put a water surface after every pane in front of it: the surface follows the camera, so it stands+ // nearest of all. Ordered by the pixel instead, as the layers above do without the copies: the opaque scene, then the water, which+ // writes depth, then the blended draws, depth-tested against it. Those in front of the surface land on it, those under it are hidden.+ const bool ordered = !glass && draw_list_.anyUsesSceneColor(context_.materials())+ && draw_list_.anyBlendedWithoutSceneColor(context_.materials());+ scene.execute = [this, glass, layered, ordered](const rg::PassContext&) {+ if (ordered) {+ drawScene(DrawList::Phase::OpaqueOnly);+ drawScene(DrawList::Phase::SceneColorOnly);+ drawScene(DrawList::Phase::BlendedOnly);+ } else {+ drawScene(layered ? DrawList::Phase::OpaqueOnly : glass ? DrawList::Phase::WithoutSceneColor : DrawList::Phase::All);+ }if (!glass && presented_overlay_draw_) presented_overlay_draw_->flushDeferred();};graph_.addPass(std::move(scene));