|
1 | 1 | package com.lambda.graphics.texture |
2 | 2 |
|
3 | | -import com.lambda.module.modules.client.RenderSettings |
4 | 3 | import com.mojang.blaze3d.systems.RenderSystem |
5 | 4 | import com.pngencoder.PngEncoder |
6 | 5 | import net.minecraft.client.texture.NativeImage |
7 | 6 | import org.lwjgl.BufferUtils |
8 | 7 | import org.lwjgl.opengl.GL45C.* |
9 | 8 | import java.awt.* |
10 | 9 | import java.awt.image.BufferedImage |
11 | | -import java.io.ByteArrayOutputStream |
12 | 10 | import kotlin.math.roundToInt |
13 | 11 | import kotlin.math.sqrt |
14 | 12 |
|
15 | 13 | object TextureUtils { |
| 14 | + private const val COMPRESSION_LEVEL = 1 |
| 15 | + private const val THREADED_COMPRESSION = false |
| 16 | + |
16 | 17 | private val metricCache = mutableMapOf<Font, FontMetrics>() |
17 | 18 | private val encoderPreset = PngEncoder() |
18 | | - .withCompressionLevel(RenderSettings.textureCompression) |
19 | | - .withMultiThreadedCompressionEnabled(RenderSettings.threadedCompression) |
| 19 | + .withCompressionLevel(COMPRESSION_LEVEL) |
| 20 | + .withMultiThreadedCompressionEnabled(THREADED_COMPRESSION) |
20 | 21 |
|
21 | 22 | fun bindTexture(id: Int, slot: Int = 0) { |
22 | 23 | RenderSystem.activeTexture(GL_TEXTURE0 + slot) |
@@ -77,7 +78,7 @@ object TextureUtils { |
77 | 78 | if (!font.canDisplay(codePoint)) return null |
78 | 79 |
|
79 | 80 | 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) |
81 | 82 | val graphics2D = image.createGraphics() |
82 | 83 |
|
83 | 84 | graphics2D.font = font |
|
0 commit comments