Skip to content

Commit

Permalink
Move vSize to iOS, Android, and JOGL modules so they can be private.
Browse files Browse the repository at this point in the history
  • Loading branch information
xian committed Aug 15, 2023
1 parent dca11a7 commit 5d71d03
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
12 changes: 12 additions & 0 deletions kgl-android/src/main/kotlin/com/danielgergely/kgl/KglAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,15 @@ object KglAndroid : Kgl {
}
}
}

private fun FloatArray.vSize(vecSize: Int): Int {
if (size % vecSize != 0)
throw IllegalArgumentException("Array size must be a multiple of $vecSize.")
return size / vecSize
}

private fun IntArray.vSize(vecSize: Int): Int {
if (size % vecSize != 0)
throw IllegalArgumentException("Array size must be a multiple of $vecSize.")
return size / vecSize
}
12 changes: 12 additions & 0 deletions kgl-ios/src/nativeMain/kotlin/com.danielgergely.kgl/KglIos.kt
Original file line number Diff line number Diff line change
Expand Up @@ -466,3 +466,15 @@ object KglIos : Kgl {
private fun Boolean.toGl(): GLboolean = if (this) 1u else 0u

private fun UByte.toBoolean() = this != platform.gles3.GL_FALSE.toUByte()

private fun FloatArray.vSize(vecSize: Int): Int {
if (size % vecSize != 0)
throw IllegalArgumentException("Array size must be a multiple of $vecSize.")
return size / vecSize
}

private fun IntArray.vSize(vecSize: Int): Int {
if (size % vecSize != 0)
throw IllegalArgumentException("Array size must be a multiple of $vecSize.")
return size / vecSize
}
12 changes: 12 additions & 0 deletions kgl-jogl/src/main/kotlin/com/danielgergely/kgl/KglJogl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,15 @@ fun imageToByteBuffer(image: BufferedImage): ByteBuffer {

return buffer
}

private fun FloatArray.vSize(vecSize: Int): Int {
if (size % vecSize != 0)
throw IllegalArgumentException("Array size must be a multiple of $vecSize.")
return size / vecSize
}

private fun IntArray.vSize(vecSize: Int): Int {
if (size % vecSize != 0)
throw IllegalArgumentException("Array size must be a multiple of $vecSize.")
return size / vecSize
}
13 changes: 0 additions & 13 deletions kgl/src/commonMain/kotlin/com/danielgergely/kgl/Util.kt

This file was deleted.

0 comments on commit 5d71d03

Please sign in to comment.