From 8632fe541015a0609d827d933bb07a1d65e80d61 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Fri, 15 Dec 2017 04:07:32 +0000 Subject: [PATCH] Inlined the depth sort --- v3/src/scene/local/Systems.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/v3/src/scene/local/Systems.js b/v3/src/scene/local/Systems.js index 2f0cd1292..5b245c79f 100644 --- a/v3/src/scene/local/Systems.js +++ b/v3/src/scene/local/Systems.js @@ -27,6 +27,8 @@ var Systems = new Class({ this.config = config; this.settings = Settings.create(config); + this.renderList = []; + this.sortChildrenFlag = false; // Set by the GlobalSceneManager @@ -151,7 +153,13 @@ var Systems = new Class({ return; } - this.depthSort(); + // inlined to avoid branching + if (this.sortChildrenFlag) + { + StableSort.inplace(this.displayList.list, this.sortZ); + + this.sortChildrenFlag = false; + } this.cameras.render(renderer, this.displayList, interpolation); },