Skip to content

Commit

Permalink
debug hud: fix weird resetting entity counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Bixilon committed Dec 14, 2023
1 parent 949699c commit 154ae1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class VisibilityManager(val renderer: EntitiesRenderer) {
private var _size = 0
var size: Int = 0
private set
var opaqueSize = 0
private set
var translucentSize = 0
private set

val opaque: ArrayList<EntityRenderFeature> = ArrayList(1000)
val translucent: ArrayList<EntityRenderFeature> = ArrayList(1000)
Expand All @@ -53,7 +57,6 @@ class VisibilityManager(val renderer: EntitiesRenderer) {
fun reset() {
opaque.clear()
translucent.clear()
size = 0
_size = 0
}

Expand Down Expand Up @@ -96,6 +99,8 @@ class VisibilityManager(val renderer: EntitiesRenderer) {
this.translucent.sort()
this.update = false
size = _size
opaqueSize = opaque.size
translucentSize = translucent.size
}

operator fun get(layer: EntityLayer) = when (layer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class DebugHUDElement(guiRenderer: GUIRenderer) : Element(guiRenderer), Layouted
}

layout += context.renderer[EntitiesRenderer]?.let {
AutoTextElement(guiRenderer, 1) { BaseComponent("E v=", it.visibility.size, ",ov=", it.visibility.opaque.size, ",tv=", it.visibility.translucent.size, ", t=", it.renderers.size, ", w=", connection.world.entities.size) }
AutoTextElement(guiRenderer, 1) { BaseComponent("E v=", it.visibility.size, ",ov=", it.visibility.opaqueSize, ",tv=", it.visibility.translucentSize, ", t=", it.renderers.size, ", w=", connection.world.entities.size) }
} ?: AutoTextElement(guiRenderer, 1) { "E w=${connection.world.entities.size.format()}" }

context.renderer[ParticleRenderer]?.apply {
Expand Down

0 comments on commit 154ae1b

Please sign in to comment.