Skip to content

Commit

Permalink
remove debug TextureArray::dump
Browse files Browse the repository at this point in the history
  • Loading branch information
Bixilon committed Nov 23, 2023
1 parent cae786d commit 46dfbe3
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.sprite.SpriteAnimator
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
import java.nio.ByteBuffer

class DummyStaticTextureArray(renderSystem: RenderSystem) : StaticTextureArray {
private val textures: MutableMap<ResourceLocation, Texture> = synchronizedMapOf()
Expand Down Expand Up @@ -54,5 +53,4 @@ class DummyStaticTextureArray(renderSystem: RenderSystem) : StaticTextureArray {
}

override fun use(shader: NativeShader, name: String) = Unit
override fun dump(texture: Texture): ByteBuffer = throw UnsupportedOperationException()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.texture.Texture
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.file.PNGTexture
import java.nio.ByteBuffer

interface StaticTextureArray : TextureArray {
val animator: SpriteAnimator
Expand All @@ -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 load(latch: AbstractLatch)

fun dump(texture: Texture): ByteBuffer
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ import de.bixilon.minosoft.util.json.Jackson
import de.bixilon.minosoft.util.logging.Log
import de.bixilon.minosoft.util.logging.LogLevels
import de.bixilon.minosoft.util.logging.LogMessageType
import org.lwjgl.BufferUtils
import org.lwjgl.opengl.GL12.*
import org.lwjgl.opengl.GL13.GL_TEXTURE0
import org.lwjgl.opengl.GL13.glActiveTexture
import org.lwjgl.opengl.GL30.GL_TEXTURE_2D_ARRAY
import org.lwjgl.opengl.GL45.glGetTextureSubImage
import java.nio.ByteBuffer
import java.util.concurrent.atomic.AtomicInteger

Expand Down Expand Up @@ -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 {
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
Expand Down

0 comments on commit 46dfbe3

Please sign in to comment.