Skip to content

Commit c97a29c

Browse files
committed
Introduce constants for texture options
1 parent dcf244d commit c97a29c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

common/src/main/kotlin/com/lambda/graphics/texture/TextureUtils.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
package com.lambda.graphics.texture
22

3-
import com.lambda.module.modules.client.RenderSettings
43
import com.mojang.blaze3d.systems.RenderSystem
54
import com.pngencoder.PngEncoder
65
import net.minecraft.client.texture.NativeImage
76
import org.lwjgl.BufferUtils
87
import org.lwjgl.opengl.GL45C.*
98
import java.awt.*
109
import java.awt.image.BufferedImage
11-
import java.io.ByteArrayOutputStream
1210
import kotlin.math.roundToInt
1311
import kotlin.math.sqrt
1412

1513
object TextureUtils {
14+
private const val COMPRESSION_LEVEL = 1
15+
private const val THREADED_COMPRESSION = false
16+
1617
private val metricCache = mutableMapOf<Font, FontMetrics>()
1718
private val encoderPreset = PngEncoder()
18-
.withCompressionLevel(RenderSettings.textureCompression)
19-
.withMultiThreadedCompressionEnabled(RenderSettings.threadedCompression)
19+
.withCompressionLevel(COMPRESSION_LEVEL)
20+
.withMultiThreadedCompressionEnabled(THREADED_COMPRESSION)
2021

2122
fun bindTexture(id: Int, slot: Int = 0) {
2223
RenderSystem.activeTexture(GL_TEXTURE0 + slot)
@@ -77,7 +78,7 @@ object TextureUtils {
7778
if (!font.canDisplay(codePoint)) return null
7879

7980
val fontMetrics = metricCache.getOrPut(font) {
80-
val image = BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB)
81+
val image = BufferedImage(COMPRESSION_LEVEL, COMPRESSION_LEVEL, BufferedImage.TYPE_INT_ARGB)
8182
val graphics2D = image.createGraphics()
8283

8384
graphics2D.font = font

0 commit comments

Comments
 (0)