mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
dynamic textures: fix cleaning up
This commit is contained in:
parent
424ef281cb
commit
a29155cb96
@ -142,7 +142,7 @@ abstract class DynamicTextureArray(
|
||||
for ((index, reference) in textures.withIndex()) {
|
||||
if (reference == null) continue
|
||||
val texture = reference.get()
|
||||
texture?.state = DynamicTextureState.UNLOADED
|
||||
if (texture != null) continue // not gced yet, keep it for now
|
||||
textures[index] = null
|
||||
}
|
||||
lock.unlock()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
* Copyright (C) 2020-2023 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
@ -17,6 +17,8 @@ enum class DynamicTextureState {
|
||||
WAITING,
|
||||
LOADING,
|
||||
LOADED,
|
||||
|
||||
@Deprecated("unrechable", level = DeprecationLevel.ERROR)
|
||||
UNLOADED,
|
||||
;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class SkinManager(private val textureManager: TextureManager) {
|
||||
|
||||
private fun getSkin(uuid: UUID, properties: PlayerProperties?, async: Boolean = true): PlayerSkin? {
|
||||
val texture = properties?.textures?.skin ?: return default[uuid]
|
||||
return PlayerSkin(textureManager.dynamicTextures.pushRaw(uuid, async) { texture.read() }, texture.metadata.model)
|
||||
return PlayerSkin(textureManager.dynamicTextures.pushRaw(texture.getHash(), async) { texture.read() }, texture.metadata.model)
|
||||
}
|
||||
|
||||
fun getSkin(player: PlayerEntity, properties: PlayerProperties? = null, fetch: Boolean = true, async: Boolean = true): PlayerSkin? {
|
||||
|
@ -20,7 +20,6 @@ class OpenGLDynamicTexture(identifier: Any, shaderId: Int) : DynamicTexture(iden
|
||||
|
||||
override var shaderId: Int = shaderId
|
||||
get() {
|
||||
if (state == DynamicTextureState.UNLOADED) throw IllegalStateException("Texture was unloaded!")
|
||||
if (state == DynamicTextureState.LOADING) throw IllegalStateException("Texture was not loaded yet!")
|
||||
return field
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user