All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.dsl.functions.Matrix44Functions.kt Maven / Gradle / Ivy

package org.openrndr.orsl.shadergenerator.dsl.functions

import org.openrndr.orsl.shadergenerator.dsl.*
import org.openrndr.math.Matrix44
import org.openrndr.math.Vector4
import kotlin.jvm.JvmName

@Suppress("INAPPLICABLE_JVM_NAME")
interface Matrix44Functions : Generator {

    @JvmName("timesSm4Sv4")
    operator fun Symbol.times(right: Symbol): Symbol =
        functionSymbol(this, right, "($0 * $1)")

    @JvmName("timesSm4Sm4")
    operator fun Symbol.times(right: Symbol): Symbol =
        functionSymbol(this, right, "($0 * $1)")

    @JvmName("timesSm4Sd")
    operator fun Symbol.times(right: Symbol): Symbol =
        functionSymbol(this, right, "($0 * $1)")

    @JvmName("timesSm4Vd")
    operator fun Symbol.times(right: Double): Symbol =
        functionSymbol(this, right, "($0 * $1)")

    val Symbol.inversed: Symbol
        @JvmName("inverseSm4")
        get() = functionSymbol(this, "inverse($0)")

    val Symbol.determinant: Symbol
        @JvmName("determinantSm4")
        get() = functionSymbol(this, "determinant($0)")

    @JvmName("getSm4Vi")
    operator fun Symbol.get(column: Int): Symbol =
        functionSymbol(this, column, function = "$0[$1]")

    @JvmName("setSm4ViSv4")
    operator fun Symbol.set(column: Int, value: Symbol): Symbol =
        functionSymbol(this, column, value, function = "$0[$1] = $2")

    fun Matrix44.Companion.fromColumnVectors(x: Symbol, y: Symbol, z: Symbol, w: Symbol): Symbol =
        functionSymbol(x, y, z, w,"mat4($0, $1, $2, $3)")
}

val Matrix44.symbol: Symbol
    get() {
        return symbol(glsl(this)!!)
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy