jvmMain.ShaderPhraseBook.kt Maven / Gradle / Ivy
The newest version!
package org.openrndr.extra.shaderphrases
import kotlin.reflect.KProperty1
import kotlin.reflect.full.declaredMemberProperties
/**
* A book of shader phrases.
*/
actual open class ShaderPhraseBook actual constructor(actual val bookId: String) {
private var registered = false
/**
* Registers all known shader phrases
*/
actual fun register() {
if (!registered) {
this::class.declaredMemberProperties.filter {
it.returnType.toString() == "org.openrndr.extra.shaderphrases.ShaderPhrase"
}.map {
@Suppress("UNCHECKED_CAST")
val m = it as? KProperty1
m?.get(this)?.register(bookId)
}
registered = true
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy