mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
WorldMesh.kt: remove some duplicated code
This commit is contained in:
parent
a102302810
commit
612d02e253
@ -54,38 +54,25 @@ class WorldMesh(
|
|||||||
@Synchronized
|
@Synchronized
|
||||||
fun clearEmpty(): Int {
|
fun clearEmpty(): Int {
|
||||||
var meshes = 0
|
var meshes = 0
|
||||||
opaqueMesh?.let {
|
|
||||||
if (it.data.isEmpty) {
|
fun processMesh(mesh: SingleWorldMesh?): Boolean {
|
||||||
it.data.unload()
|
if (mesh == null) {
|
||||||
opaqueMesh = null
|
return false
|
||||||
} else {
|
|
||||||
meshes++
|
|
||||||
}
|
}
|
||||||
}
|
if (mesh.data.isEmpty) {
|
||||||
translucentMesh?.let {
|
mesh.data.unload()
|
||||||
if (it.data.isEmpty) {
|
return true
|
||||||
it.data.unload()
|
|
||||||
translucentMesh = null
|
|
||||||
} else {
|
|
||||||
meshes++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
transparentMesh?.let {
|
|
||||||
if (it.data.isEmpty) {
|
|
||||||
it.data.unload()
|
|
||||||
transparentMesh = null
|
|
||||||
} else {
|
|
||||||
meshes++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
textMesh?.let {
|
|
||||||
if (it.data.isEmpty) {
|
|
||||||
it.data.unload()
|
|
||||||
textMesh = null
|
|
||||||
} else {
|
|
||||||
meshes++
|
|
||||||
}
|
}
|
||||||
|
meshes++
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (processMesh(opaqueMesh)) opaqueMesh = null
|
||||||
|
if (processMesh(translucentMesh)) translucentMesh = null
|
||||||
|
if (processMesh(transparentMesh)) transparentMesh = null
|
||||||
|
|
||||||
|
if (processMesh(textMesh)) textMesh = null
|
||||||
|
|
||||||
blockEntities?.let {
|
blockEntities?.let {
|
||||||
if (it.isEmpty()) {
|
if (it.isEmpty()) {
|
||||||
blockEntities = null
|
blockEntities = null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user