iosMacosMain.korlibs.metal.AGMetalConverter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of korgw Show documentation
Show all versions of korgw Show documentation
Portable UI with accelerated graphics support for Kotlin
package korlibs.metal
import korlibs.graphics.*
import korlibs.io.lang.*
import kotlinx.cinterop.*
import platform.Metal.*
internal fun AGFrameBufferInfo.toViewPort() = cValue {
originX = 0.0
originY = 0.0
width = [email protected]()
height = [email protected]()
znear = 0.0
zfar = 1.0
}
internal fun AGDrawType.toMetal(): MTLPrimitiveType = when (this) {
AGDrawType.POINTS -> MTLPrimitiveTypePoint
AGDrawType.LINE_STRIP -> MTLPrimitiveTypeLineStrip
AGDrawType.LINE_LOOP -> invalidOp
AGDrawType.LINES -> MTLPrimitiveTypeLine
AGDrawType.TRIANGLE_STRIP -> MTLPrimitiveTypeTriangleStrip
AGDrawType.TRIANGLE_FAN -> invalidOp
AGDrawType.TRIANGLES -> MTLPrimitiveTypeTriangle
else -> unreachable
}
internal fun AGIndexType.toMetal(): MTLIndexType = when (this) {
AGIndexType.NONE -> invalidOp
AGIndexType.UBYTE -> invalidOp
AGIndexType.USHORT -> MTLIndexTypeUInt16
AGIndexType.UINT -> MTLIndexTypeUInt32
else -> unreachable
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy