mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 19:05:02 -04:00
remove deprecated detection of shader uniforms
This commit is contained in:
parent
9ff7a4a641
commit
fb873ab418
@ -28,7 +28,6 @@ import kotlin.math.max
|
||||
interface Shader {
|
||||
val loaded: Boolean
|
||||
val renderWindow: RenderWindow
|
||||
val uniforms: Set<String>
|
||||
val defines: MutableMap<String, Any>
|
||||
|
||||
val log: String
|
||||
|
@ -24,23 +24,8 @@ class GLSLShaderCode(
|
||||
private val rawCode: String,
|
||||
) {
|
||||
val defines: MutableMap<String, Any> = mutableMapOf()
|
||||
val uniforms: MutableSet<String> = mutableSetOf()
|
||||
|
||||
init {
|
||||
// ToDo: This is complete trash and should be replaced
|
||||
|
||||
for (line in rawCode.lines()) {
|
||||
if (!line.startsWith("uniform ")) {
|
||||
continue
|
||||
}
|
||||
val reader = GLSLStringReader(line.removePrefix("uniform "))
|
||||
reader.skipWhitespaces()
|
||||
reader.readUnquotedString() // data type
|
||||
reader.skipWhitespaces()
|
||||
|
||||
uniforms += reader.readWord() ?: continue
|
||||
}
|
||||
|
||||
for ((name, value) in Shader.DEFAULT_DEFINES) {
|
||||
value(renderWindow)?.let { defines[name] = it }
|
||||
}
|
||||
@ -70,7 +55,6 @@ class GLSLShaderCode(
|
||||
val include = ResourceLocation(reader.readString()!!)
|
||||
|
||||
val includeCode = GLSLShaderCode(renderWindow, renderWindow.connection.assetsManager[ResourceLocation(include.namespace, "rendering/shader/includes/${include.path}.glsl")].readAsString())
|
||||
this.uniforms += includeCode.uniforms
|
||||
|
||||
code.append('\n')
|
||||
code.append(includeCode.code)
|
||||
|
@ -41,8 +41,6 @@ class OpenGLShader(
|
||||
private set
|
||||
override val defines: MutableMap<String, Any> = mutableMapOf()
|
||||
private var shader = -1
|
||||
override var uniforms: MutableSet<String> = mutableSetOf()
|
||||
private set
|
||||
private val uniformLocations: Object2IntOpenHashMap<String> = Object2IntOpenHashMap()
|
||||
|
||||
private fun load(resourceLocation: ResourceLocation, shaderType: Int): Int {
|
||||
@ -58,8 +56,6 @@ class OpenGLShader(
|
||||
|
||||
glShaderSource(program, code.code)
|
||||
|
||||
this.uniforms += code.uniforms
|
||||
|
||||
glCompileShader(program)
|
||||
|
||||
if (glGetShaderi(program, GL_COMPILE_STATUS) == GL_FALSE) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user