blob: db6e06d25af23ddc194aea25ec6f630eef027da2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
package at.hannibal2.skyhanni.features.chroma
import at.hannibal2.skyhanni.utils.shader.ShaderManager
/**
* Object to handle enabling / disabling the chroma shader when rendering text
*
* Modified from SkyblockAddons
*
* Credit: [MulticolorShaderManager.java](https://github.com/BiscuitDevelopment/SkyblockAddons/blob/main/src/main/java/codes/biscuit/skyblockaddons/core/chroma/MulticolorShaderManager.java)
*/
object ChromaShaderManager {
private var chromaEnabled = false
/**
* Enables the type of chroma shader passed in
*
* @param chromaType A type of chroma shader from [ChromaType]
*/
fun begin(chromaType: ChromaType) {
disable()
enable(chromaType)
}
/**
* Disables the currently active chroma shader
*/
fun end() {
disable()
}
private fun enable(chromaType: ChromaType) {
if (!chromaEnabled) {
chromaEnabled = true
ShaderManager.enableShader(chromaType.shaderName)
}
}
private fun disable() {
if (chromaEnabled) {
chromaEnabled = false
ShaderManager.disableShader()
}
}
}
enum class ChromaType(val shaderName: String) {
/**
* See [StandardChromaShader]
*/
STANDARD("standard_chroma"),
/**
* See [TexturedChromaShader]
*/
TEXTURED("textured_chroma")
}
|