mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
remove debug TextureArray::dump
This commit is contained in:
parent
cae786d741
commit
46dfbe3252
@ -23,7 +23,6 @@ import de.bixilon.minosoft.gui.rendering.system.base.texture.array.StaticTexture
|
|||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.array.TextureArrayStates
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.array.TextureArrayStates
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.sprite.SpriteAnimator
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.sprite.SpriteAnimator
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
|
||||||
import java.nio.ByteBuffer
|
|
||||||
|
|
||||||
class DummyStaticTextureArray(renderSystem: RenderSystem) : StaticTextureArray {
|
class DummyStaticTextureArray(renderSystem: RenderSystem) : StaticTextureArray {
|
||||||
private val textures: MutableMap<ResourceLocation, Texture> = synchronizedMapOf()
|
private val textures: MutableMap<ResourceLocation, Texture> = synchronizedMapOf()
|
||||||
@ -54,5 +53,4 @@ class DummyStaticTextureArray(renderSystem: RenderSystem) : StaticTextureArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun use(shader: NativeShader, name: String) = Unit
|
override fun use(shader: NativeShader, name: String) = Unit
|
||||||
override fun dump(texture: Texture): ByteBuffer = throw UnsupportedOperationException()
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
|||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.sprite.SpriteAnimator
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.sprite.SpriteAnimator
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.file.PNGTexture
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.file.PNGTexture
|
||||||
import java.nio.ByteBuffer
|
|
||||||
|
|
||||||
interface StaticTextureArray : TextureArray {
|
interface StaticTextureArray : TextureArray {
|
||||||
val animator: SpriteAnimator
|
val animator: SpriteAnimator
|
||||||
@ -31,6 +30,4 @@ interface StaticTextureArray : TextureArray {
|
|||||||
fun createTexture(resourceLocation: ResourceLocation, mipmaps: Boolean = true, properties: Boolean = true, default: (mipmaps: Boolean) -> Texture = { PNGTexture(resourceLocation, mipmaps = it) }): Texture
|
fun createTexture(resourceLocation: ResourceLocation, mipmaps: Boolean = true, properties: Boolean = true, default: (mipmaps: Boolean) -> Texture = { PNGTexture(resourceLocation, mipmaps = it) }): Texture
|
||||||
|
|
||||||
fun load(latch: AbstractLatch)
|
fun load(latch: AbstractLatch)
|
||||||
|
|
||||||
fun dump(texture: Texture): ByteBuffer
|
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,10 @@ import de.bixilon.minosoft.util.json.Jackson
|
|||||||
import de.bixilon.minosoft.util.logging.Log
|
import de.bixilon.minosoft.util.logging.Log
|
||||||
import de.bixilon.minosoft.util.logging.LogLevels
|
import de.bixilon.minosoft.util.logging.LogLevels
|
||||||
import de.bixilon.minosoft.util.logging.LogMessageType
|
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||||
import org.lwjgl.BufferUtils
|
|
||||||
import org.lwjgl.opengl.GL12.*
|
import org.lwjgl.opengl.GL12.*
|
||||||
import org.lwjgl.opengl.GL13.GL_TEXTURE0
|
import org.lwjgl.opengl.GL13.GL_TEXTURE0
|
||||||
import org.lwjgl.opengl.GL13.glActiveTexture
|
import org.lwjgl.opengl.GL13.glActiveTexture
|
||||||
import org.lwjgl.opengl.GL30.GL_TEXTURE_2D_ARRAY
|
import org.lwjgl.opengl.GL30.GL_TEXTURE_2D_ARRAY
|
||||||
import org.lwjgl.opengl.GL45.glGetTextureSubImage
|
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.util.concurrent.atomic.AtomicInteger
|
import java.util.concurrent.atomic.AtomicInteger
|
||||||
|
|
||||||
@ -247,20 +245,6 @@ class OpenGLTextureArray(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dump(texture: Texture): ByteBuffer {
|
|
||||||
val shaderId = texture.shaderId
|
|
||||||
val level = 0
|
|
||||||
|
|
||||||
val buffer = BufferUtils.createByteBuffer(texture.array.size * texture.array.size * 4)
|
|
||||||
|
|
||||||
// glBindTexture(GL_TEXTURE_2D_ARRAY, shaderId shr 28)
|
|
||||||
|
|
||||||
glGetTextureSubImage(textureIds[TEXTURE_RESOLUTION_ID_MAP.indexOf(texture.array.size)], 0, 0, 0, (shaderId shr 12) and 0xFFFFF, texture.array.size shr level, texture.array.size shr level, 1, GL_RGBA, GL_UNSIGNED_BYTE, buffer)
|
|
||||||
|
|
||||||
return buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val TEXTURE_MAX_RESOLUTION = 2048
|
const val TEXTURE_MAX_RESOLUTION = 2048
|
||||||
val TEXTURE_RESOLUTION_ID_MAP = intArrayOf(16, 32, 64, 128, 256, 512, 1024, TEXTURE_MAX_RESOLUTION) // A 12x12 texture will be saved in texture id 0 (in 0 are only 16x16 textures). Animated textures get split
|
val TEXTURE_RESOLUTION_ID_MAP = intArrayOf(16, 32, 64, 128, 256, 512, 1024, TEXTURE_MAX_RESOLUTION) // A 12x12 texture will be saved in texture id 0 (in 0 are only 16x16 textures). Animated textures get split
|
||||||
|
Loading…
x
Reference in New Issue
Block a user