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

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

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

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

@Suppress("INAPPLICABLE_JVM_NAME")
interface DoubleFunctions {

    @JvmName("saturateSd")
    fun saturate(x: Symbol): Symbol = functionSymbol(x, "clamp($0, 0.0, 1.0)")

    @JvmName("absSd")
    fun abs(x: Symbol): Symbol = functionSymbol(x, "abs($0)")

    @JvmName("acosSd")
    fun acos(x: Symbol): Symbol = functionSymbol(x, "acos($0)")

    @JvmName("acoshSd")
    fun acosh(x: Symbol): Symbol = functionSymbol(x, "acosh($0)")

    @JvmName("asinSd")
    fun asin(x: Symbol): Symbol = functionSymbol(x, "asin($0)")

    @JvmName("asinhSd")
    fun asinh(x: Symbol): Symbol = functionSymbol(x, "asinh($0)")

    @JvmName("atanSd")
    fun atan(x: Symbol): Symbol = functionSymbol(x, "atan($0)")

    @JvmName("atanSdSd")
    fun atan(x: Symbol, y: Symbol): Symbol = functionSymbol(x, y, "atan($0, $1)")

    @JvmName("atanhSd")
    fun atanh(x: Symbol): Symbol = functionSymbol(x, "atanh($0)")

    @JvmName("ceilSd")
    fun ceil(x: Symbol): Symbol = functionSymbol(x, "ceil($0)")

    @JvmName("ceilSdSdSd")
    fun clamp(x: Symbol, min: Symbol, max: Symbol): Symbol =
        functionSymbol(x, min, max, "clamp($0, $1, $2)")

    @JvmName("cosSd")
    fun cos(x: Symbol): Symbol = functionSymbol(x, "cos($0)")

    @JvmName("coshSd")
    fun cosh(x: Symbol): Symbol = functionSymbol(x, "cosh($0)")

    @JvmName("degreesSd")
    fun degrees(x: Symbol): Symbol = functionSymbol(x, "degrees($0)")

    @JvmName("expSd")
    fun exp(x: Symbol): Symbol = functionSymbol(x, "exp($0)")

    @JvmName("exp2Sd")
    fun exp2(x: Symbol): Symbol = functionSymbol(x, "exp2($0)")

    @JvmName("fmaSdSdSd")
    fun fma(a: Symbol, b: Symbol, c: Symbol): Symbol =
        functionSymbol(a, b, c, "fma($0, $1, $2)")

    @JvmName("fractSd")
    fun fract(x: Symbol): Symbol = functionSymbol(x, "fract($0)")


    @JvmName("floorSd")
    fun floor(x: Symbol): Symbol = functionSymbol(x, "floor($0)")

    @JvmName("fwidthSd")
    fun fwidth(x: Symbol): Symbol = functionSymbol(x, "fwidth($0)")

    @JvmName("fwidthCoarseSd")
    fun fwidthCoarse(x: Symbol): Symbol = functionSymbol(x, "fwidthCoarse($0)")

    @JvmName("fwidthFineSd")
    fun fwidthFine(x: Symbol): Symbol = functionSymbol(x, "fwidthFine($0)")


    @JvmName("inversesqrtSd")
    fun inversesqrt(x: Symbol): Symbol = functionSymbol(x, "inversesqrt($0)")

    @JvmName("isinfSd")
    fun isinf(x: Symbol): Symbol = functionSymbol(x, "isinf($0)")

    @JvmName("isnanSd")
    fun isnan(x: Symbol): Symbol = functionSymbol(x, "isnan($0)")

    @JvmName("logSd")
    fun log(x: Symbol): Symbol = functionSymbol(x, "log($0)")

    @JvmName("log2Sd")
    fun log2(x: Symbol): Symbol = functionSymbol(x, "log2($0)")


    @JvmName("maxSdSd")
    fun max(a: Symbol, b: Symbol): Symbol = functionSymbol(a, b, "max($0, $1)")

    @JvmName("maxSdVd")
    fun max(a: Symbol, b: Double): Symbol = functionSymbol(a, b, "max($0, $1)")

    @JvmName("maxVdSd")
    fun max(a: Double, b: Symbol): Symbol = functionSymbol(a, b, "max($0, $1)")

    @JvmName("modSdVd")
    fun Symbol.mod(n: Double): Symbol = functionSymbol(this, n, "mod($0, $1)")

    @JvmName("modSdVd")
    fun Symbol.mod(n: Symbol): Symbol = functionSymbol(this, n, "mod($0, $1)")

    @JvmName("minSdSd")
    fun min(a: Symbol, b: Symbol): Symbol = functionSymbol(a, b, "min($0, $1)")

    @JvmName("powSdSd")
    fun pow(x: Symbol, y: Symbol): Symbol = functionSymbol(x, y, "pow($0, $1)")

    @JvmName("radiansSd")
    fun radians(x: Symbol): Symbol = functionSymbol(x, "radians($0)")

    @JvmName("roundSd")
    fun round(x: Symbol): Symbol = functionSymbol(x, "round($0)")

    @JvmName("roundEvenSd")
    fun roundEven(x: Symbol): Symbol = functionSymbol(x, "roundEven($0)")

    @JvmName("signSd")
    fun sign(x: Symbol): Symbol = functionSymbol(x, "sign($0)")


    @JvmName("sinSd")
    fun sin(x: Symbol): Symbol = functionSymbol(x, "sin($0)")

    @JvmName("sinhSd")
    fun sinh(x: Symbol): Symbol = functionSymbol(x, "sinh($0)")


    @JvmName("smoothstepSdSdSd")
    fun smoothstep(edge0: Symbol, edge1: Symbol, x: Symbol): Symbol =
        functionSymbol(edge0, edge1, x, "smoothstep($0, $1, $2)")

    @JvmName("smoothstepVdVdSd")
    fun smoothstep(edge0: Double, edge1: Double, x: Symbol): Symbol =
        functionSymbol(edge0, edge1, x, "smoothstep($0, $1, $2)")

    @JvmName("sqrtSd")
    fun sqrt(x: Symbol): Symbol = functionSymbol(x, "sqrt($0)")

    @JvmName("stepSdSd")
    fun step(edge: Symbol, x: Symbol): Symbol = functionSymbol(edge, x, "step($0)")

    @JvmName("tanSd")
    fun tan(x: Symbol): Symbol = functionSymbol(x, "tan($0)")

    @JvmName("tanhSd")
    fun tanh(x: Symbol): Symbol = functionSymbol(x, "tanh($0)")

    @JvmName("trunSd")
    fun trunc(x: Symbol): Symbol = functionSymbol(x, "trunc($0)")

    operator fun Symbol.unaryMinus(): Symbol =
        functionSymbol(this, "(-$0)")

    @JvmName("plusSdSd")
    operator fun Symbol.plus(right: Symbol): Symbol = functionSymbol(this, right, "($0 + $1)")

    @JvmName("plusVdSd")
    operator fun Double.plus(right: Symbol): Symbol = functionSymbol(this, right, "($0 + $1)")

    @JvmName("plusSdSi")
    operator fun Symbol.plus(right: Symbol): Symbol = functionSymbol(this, right, "($0 + float($1))")

    @JvmName("plusSdVd")
    operator fun Symbol.plus(right: Double): Symbol = functionSymbol(this, right, "($0 + $1)")

    @JvmName("plusSdVi")
    operator fun Symbol.plus(right: Int): Symbol = functionSymbol(this, right, "($0 + float($1))")

    @JvmName("minusVdSd")
    operator fun Double.minus(right: Symbol): Symbol = functionSymbol(this, right, "($0 - $1)")

    @JvmName("minusSdSd")
    operator fun Symbol.minus(right: Symbol): Symbol = functionSymbol(this, right, "($0 - $1)")

    @JvmName("minusSdVd")
    operator fun Symbol.minus(right: Double): Symbol = functionSymbol(this, right, "($0 - $1)")

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

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

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

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

    @JvmName("divSdSd")
    operator fun Symbol.div(right: Symbol): Symbol = functionSymbol(this, right, "($0 / $1)")

    @JvmName("divSdVd")
    operator fun Symbol.div(right: Double): Symbol = functionSymbol(this, right, "($0 / $1)")

    @JvmName("divVdSd")
    operator fun Double.div(right: Symbol): Symbol = functionSymbol(this, right, "($0 / $1)")

    @JvmName("eqSdSd")
    infix fun Symbol.eq(right: Symbol): Symbol = functionSymbol(this, right, "($0 == $1)")

    @JvmName("eqSdVd")
    infix fun Symbol.eq(right: Double): Symbol = functionSymbol(this, right, "($0 == $1)")

    @JvmName("neqSdSd")
    infix fun Symbol.neq(right: Symbol): Symbol = functionSymbol(this, right, "($0 != $1)")

    @JvmName("neqSdVd")
    infix fun Symbol.neq(right: Double): Symbol = functionSymbol(this, right, "($0 != $1)")


    @JvmName("gteSdSd")
    infix fun Symbol.gte(right: Symbol): Symbol = functionSymbol(this, right, "($0 >= $1)")

    @JvmName("gteSdVd")
    infix fun Symbol.gte(right: Double): Symbol = functionSymbol(this, right, "($0 >= $1)")


    @JvmName("gtSdSd")
    infix fun Symbol.gt(right: Symbol): Symbol = functionSymbol(this, right, "($0 > $1)")

    @JvmName("gtSdVd")
    infix fun Symbol.gt(right: Double): Symbol = functionSymbol(this, right, "($0 > $1)")

    @JvmName("ltSdSd")
    infix fun Symbol.lt(right: Symbol): Symbol = functionSymbol(this, right, "($0 < $1)")

    @JvmName("ltSdVd")
    infix fun Symbol.lt(right: Double): Symbol = functionSymbol(this, right, "($0 < $1)")

    @JvmName("lteSdSd")
    infix fun Symbol.lte(right: Symbol): Symbol = functionSymbol(this, right, "($0 <= $1)")

    @JvmName("lteSdVd")
    infix fun Symbol.lte(right: Double): Symbol = functionSymbol(this, right, "($0 <= $1)")

    @JvmName("mixSdSdSd")
    fun Symbol.mix(right: Symbol, factor: Symbol): Symbol =
        functionSymbol(this, right, factor, "mix($0, $1, $2)")

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


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

}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy