commonMain.dsl.functions.UIntFunctions.kt Maven / Gradle / Ivy
package org.openrndr.orsl.shadergenerator.dsl.functions
import org.openrndr.orsl.shadergenerator.dsl.Symbol
import org.openrndr.orsl.shadergenerator.dsl.functionSymbol
import org.openrndr.orsl.shadergenerator.dsl.glsl
import org.openrndr.orsl.shadergenerator.dsl.symbol
import kotlin.jvm.JvmName
@Suppress("INAPPLICABLE_JVM_NAME")
interface UIntFunctions {
@JvmName("minSuiSui")
fun min(a: Symbol, b: Symbol): Symbol = functionSymbol(a, b, "min($0, $1)")
@JvmName("maxSuiSui")
fun max(a: Symbol, b: Symbol): Symbol = functionSymbol(a, b, "max($0, $1)")
@JvmName("plusSuiSui")
operator fun Symbol.plus(right: Symbol): Symbol = functionSymbol(this, right, "($0 + $1)")
@JvmName("xorSuiVui")
infix fun Symbol.xor(right: UInt): Symbol = functionSymbol(this, right, "($0 ^ $1)")
@JvmName("xorSuiSui")
infix fun Symbol.xor(right: Symbol): Symbol = functionSymbol(this, right, "($0 ^ $1)")
@JvmName("orSuiVui")
infix fun Symbol.or(right: UInt): Symbol = functionSymbol(this, right, "($0 | $1)")
@JvmName("orSuiSui")
infix fun Symbol.or(right: Symbol): Symbol = functionSymbol(this, right, "($0 | $1)")
@JvmName("andSuiVui")
infix fun Symbol.and(right: UInt): Symbol = functionSymbol(this, right, "($0 & $1)")
infix fun Symbol.shr(right: Int): Symbol = functionSymbol(this, right, "($0 >> $1)")
@JvmName("shrSuiVui")
infix fun Symbol.shr(right: UInt): Symbol = functionSymbol(this, right, "($0 << $1)")
@JvmName("shlSuiVi")
infix fun Symbol.shl(right: Int): Symbol = functionSymbol(this, right, "($0 << $1)")
@JvmName("shlSuiVui")
infix fun Symbol.shl(right: UInt): Symbol = functionSymbol(this, right, "($0 << $1)")
@JvmName("shlSuiSui")
infix fun Symbol.shl(right: Symbol): Symbol = functionSymbol(this, right, "($0 << $1)")
@JvmName("plusSuiSd")
operator fun Symbol.plus(right: Symbol): Symbol = functionSymbol(this, right, "($0 + $1)")
@JvmName("plusSuiVui")
operator fun Symbol.plus(right: UInt): Symbol = functionSymbol(this, right, "($0 + $1)")
@JvmName("plusSuiVd")
operator fun Symbol.plus(right: Double): Symbol = functionSymbol(this, right, "($0 + $1)")
@JvmName("minusSuiSui")
operator fun Symbol.minus(right: Symbol): Symbol = functionSymbol(this, right, "($0 - $1)")
@JvmName("timesSuiSui")
operator fun Symbol.times(right: Symbol): Symbol = functionSymbol(this, right, "($0 * $1)")
@JvmName("timesSuiVui")
operator fun Symbol.times(right: UInt): Symbol = functionSymbol(this, right, "($0 * $1)")
@JvmName("timesSuiVd")
operator fun Symbol.times(right: Double): Symbol = functionSymbol(this, right, "($0 * $1)")
@JvmName("divSuiSui")
operator fun Symbol.div(right: Symbol): Symbol = functionSymbol(this, right, "($0 / $1)")
@JvmName("divSuiSd")
operator fun Symbol.div(right: Symbol): Symbol = functionSymbol(this, right, "($0 / $1)")
@JvmName("divSuiVd")
operator fun Symbol.div(right: Double): Symbol = functionSymbol(this, right, "($0 / $1)")
@JvmName("eqSuiSui")
infix fun Symbol.eq(right: Symbol): Symbol = functionSymbol(this, right, "($0 == $1)")
@JvmName("eqSuiVui")
infix fun Symbol.eq(right: UInt): Symbol = functionSymbol(this, right, "($0 == $1)")
@JvmName("neqSuiSui")
infix fun Symbol.neq(right: Symbol): Symbol = functionSymbol(this, right, "($0 != $1)")
@JvmName("neqSuiVui")
infix fun Symbol.neq(right: UInt): Symbol = functionSymbol(this, right, "($0 != $1)")
@JvmName("gteSuiSui")
infix fun Symbol.gte(right: Symbol): Symbol = functionSymbol(this, right, "($0 >= $1)")
@JvmName("gteSuiVui")
infix fun Symbol.gte(right: UInt): Symbol = functionSymbol(this, right, "($0 >= $1)")
@JvmName("gtSuiSui")
infix fun Symbol.gt(right: Symbol): Symbol = functionSymbol(this, right, "($0 > $1)")
@JvmName("gtSuiVui")
infix fun Symbol.gt(right: UInt): Symbol = functionSymbol(this, right, "($0 > $1)")
@JvmName("ltSuiSui")
infix fun Symbol.lt(right: Symbol): Symbol = functionSymbol(this, right, "($0 < $1)")
@JvmName("ltSuiVui")
infix fun Symbol.lt(right: UInt): Symbol = functionSymbol(this, right, "($0 < $1)")
@JvmName("lteSuiSui")
infix fun Symbol.lte(right: Symbol): Symbol = functionSymbol(this, right, "($0 <= $1)")
@JvmName("lteSuiVui")
infix fun Symbol.lte(right: UInt): Symbol = functionSymbol(this, right, "($0 <= $1)")
/**
* find the index of the most significant bit set to 1 in an integer
* @since GLSL 4.00
*/
@JvmName("findMSBSui")
fun Symbol.findMSB(): Symbol = functionSymbol(this, "findMSB($0)")
/**
* find the index of the least significant bit set to 1 in an integer
* @since GLSL 4.00
*/
@JvmName("findLSBSui")
fun Symbol.findLSB(): Symbol = functionSymbol(this, "findLSB($0)")
/**
* produce a floating point using an encoding supplied as an integer
* @since GLSL 3.30
*/
@JvmName("bitsToFloatSui")
fun Symbol.bitsToFloat(): Symbol = functionSymbol(this, "uintBitsToFloat($0)")
/**
* counts the number of 1-bits in an integer
* @since GLSL 4.00
*/
@JvmName("bitCountSui")
fun Symbol.bitCount(): Symbol = functionSymbol(this, "bitCount($0)")
/**
* extract a range of bits from an integer
* @param offset Specifies the index of the first bit to extract.
* @param bits Specifies the number of bits to extract.
* @since GLSL 4.00
*/
@JvmName("bitfieldExtractSuiSiSi")
fun Symbol.bitfieldExtract(offset: Symbol, bits: Symbol): Symbol =
functionSymbol(this, offset, bits, "bitfieldExtract($0, $1, $2)")
/**
* insert a range of bits into an integer
* @param insert Specifies the value of the bits to insert.
* @param offset Specifies the index of the first bit to insert.
* @param bits Specifies the number of bits to insert.
* @since GLSL 4.00
*/
@JvmName("bitfieldInsertSuiSuiSiSi")
fun Symbol.bitfieldInsert(insert: Symbol, offset: Symbol, bits: Symbol): Symbol =
functionSymbol(this, insert, offset, bits, "bitfieldInsert($0)")
/**
* reverse the order of bits in an integer
* @since GLSL 4.00
*/
@JvmName("bitfieldReverseSui")
fun Symbol.bitfieldReverse(): Symbol =
functionSymbol(this, "bitfieldReverse($0)")
val Symbol.int: Symbol
@JvmName("intSui")
get() = functionSymbol(this, "int($0)")
val Symbol.double: Symbol
@JvmName("doubleSui")
get() = functionSymbol(this, "float($0)")
}
val UInt.symbol: Symbol
get() = symbol(glsl(this)!!)
© 2015 - 2024 Weber Informatics LLC | Privacy Policy