debug hud: show opaque and translucent size

This commit is contained in:
Moritz Zwerger 2023-11-17 10:11:22 +01:00
parent b5637518ab
commit 963f82f988
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
4 changed files with 7 additions and 4 deletions

View File

@ -132,7 +132,7 @@ open class ItemFeature(
EXTREME(48.0),
;
val distance = distance * distance * distance
val distance = distance * distance
companion object {

View File

@ -26,6 +26,7 @@ import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
class VisibilityManager(val renderer: EntitiesRenderer) {
private var update = false
private var _size = 0
var size: Int = 0
private set
@ -53,6 +54,7 @@ class VisibilityManager(val renderer: EntitiesRenderer) {
opaque.clear()
translucent.clear()
size = 0
_size = 0
}
private fun EntityRenderer<*>.isInRenderDistance(): Boolean {
@ -80,7 +82,7 @@ class VisibilityManager(val renderer: EntitiesRenderer) {
fun collect(renderer: EntityRenderer<*>) {
if (!renderer.visible) return
lock.lock()
size++
_size++
for (feature in renderer.features) {
if (!feature.enabled || !feature.visible || feature.isInvisible()) continue
feature.collect(this)
@ -93,6 +95,7 @@ class VisibilityManager(val renderer: EntitiesRenderer) {
this.opaque.sort()
this.translucent.sort()
this.update = false
size = _size
}
operator fun get(layer: EntityLayer) = when (layer) {

View File

@ -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, ", t=", it.renderers.size, ", w=", connection.world.entities.size) }
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) { "E w=${connection.world.entities.size.format()}" }
context.renderer[ParticleRenderer]?.apply {

View File

@ -15,6 +15,7 @@ package de.bixilon.minosoft.terminal.commands.connection
import de.bixilon.kotlinglm.GLM.PIf
import de.bixilon.kotlinglm.vec3.Vec3d
import de.bixilon.kutil.math.Trigonometry.sin
import de.bixilon.kutil.random.RandomUtil.nextDouble
import de.bixilon.kutil.random.RandomUtil.nextFloat
import de.bixilon.kutil.random.RandomUtil.nextInt
@ -33,7 +34,6 @@ import de.bixilon.minosoft.util.KUtil.startInit
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
import java.util.*
import kotlin.math.cbrt
import kotlin.math.sin
object BenchmarkCommand : ConnectionCommand {
override var node = LiteralNode("benchmark").addChild(