Skip to content

Commit 5cdfa37

Browse files
committed
up
1 parent bc25789 commit 5cdfa37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1211
-1036
lines changed

.github/workflows/build.yml

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,66 @@ name: build
33
on: [ push ]
44

55
jobs:
6+
67
linux:
78
name: 'Linux'
89
runs-on: ubuntu-latest
910

1011
steps:
11-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1213
- uses: gradle/wrapper-validation-action@v1
13-
- name: Set up JDK 1.11
14-
uses: actions/setup-java@v1
14+
- name: Set up JDK 1.8
15+
uses: actions/setup-java@v3
1516
with:
16-
java-version: 11
17+
distribution: temurin
18+
java-version: 8
1719
- name: Grant execute permission for gradlew
1820
run: chmod +x gradlew
1921
# - name: Build with Gradle
2022
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
2123
- uses: burrunan/gradle-cache-action@v1
22-
name: Build scenery
24+
name: Build
2325
with:
24-
arguments: build #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
26+
arguments: assemble #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
2527
# - name: Cleanup Gradle Cache
2628
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
2729
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
2830
# run: |
2931
# rm -f ~/.gradle/caches/modules-2/modules-2.lock
3032
# rm -f ~/.gradle/caches/modules-2/gc.properties
33+
# - name: Show Working directory content
34+
# run: ls
35+
# - uses: actions/checkout@master
36+
# with:
37+
# repository: kotlin-graphics/mary
38+
# path: ./mary
39+
- name: Show ../.. directory content
40+
run: ls ../..
41+
# - name: move mary up
42+
# run: mv ./mary ../..
43+
# - name: Show Working directory content
44+
# run: ls
45+
# - name: Show ../.. directory content
46+
# run: ls ../..
3147

3248
windows:
3349
name: 'Windows'
3450
runs-on: windows-latest
3551

3652
steps:
37-
- uses: actions/checkout@v2
53+
- uses: actions/checkout@v3
3854
- uses: gradle/wrapper-validation-action@v1
39-
- name: Set up JDK 1.11
40-
uses: actions/setup-java@v1
55+
- name: Set up JDK 1.8
56+
uses: actions/setup-java@v3
4157
with:
42-
java-version: 11
58+
distribution: temurin
59+
java-version: 8
4360
# - name: Build with Gradle
4461
# run: .\gradlew.bat build -x dokkaHtml -x dokkaHtmlJar
4562
- uses: burrunan/gradle-cache-action@v1
46-
name: Build scenery
63+
name: Build
4764
with:
48-
arguments: build #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
65+
arguments: assemble #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
4966
# - name: Cleanup Gradle Cache
5067
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
5168
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
@@ -58,20 +75,21 @@ jobs:
5875
runs-on: macos-latest
5976

6077
steps:
61-
- uses: actions/checkout@v2
78+
- uses: actions/checkout@v3
6279
- uses: gradle/wrapper-validation-action@v1
63-
- name: Set up JDK 1.11
64-
uses: actions/setup-java@v1
80+
- name: Set up JDK 1.8
81+
uses: actions/setup-java@v3
6582
with:
66-
java-version: 11
83+
distribution: temurin
84+
java-version: 8
6785
- name: Grant execute permission for gradlew
6886
run: chmod +x gradlew
6987
# - name: Build with Gradle
7088
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
7189
- uses: burrunan/gradle-cache-action@v1
72-
name: Build scenery
90+
name: Build
7391
with:
74-
arguments: build #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
92+
arguments: assemble #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
7593
# - name: Cleanup Gradle Cache
7694
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
7795
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle.kts

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import magik.createGithubPublication
22
import magik.github
33
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
44
import org.lwjgl.lwjgl
5-
import org.lwjgl.lwjgl.Module.*
5+
import org.lwjgl.Lwjgl.Module.*
66

77
plugins {
88
kotlin("jvm") version embeddedKotlinVersion
9-
id("org.lwjgl.plugin") version "0.0.29"
10-
id("elect86.magik") version "0.3.1"
9+
id("org.lwjgl.plugin") version "0.0.34"
10+
id("elect86.magik") version "0.3.2"
1111
`maven-publish`
1212
}
1313

@@ -19,32 +19,24 @@ repositories {
1919
dependencies {
2020

2121
implementation(kotlin("reflect"))
22-
implementation("kotlin.graphics:gli:0.8.3.0-18")
23-
implementation("kotlin.graphics:glm:0.9.9.1-5")
24-
implementation("kotlin.graphics:unsigned:3.3.31")
25-
implementation("kotlin.graphics:kool:0.9.68")
22+
api("kotlin.graphics:gli:0.8.3.0-22")
2623

2724
lwjgl {
2825
implementation(glfw, jemalloc, openal, opengl, opengles, stb)
2926
testImplementation(opengl)
3027
}
3128

32-
testImplementation("io.kotest:kotest-runner-junit5:5.4.1")
33-
testImplementation("io.kotest:kotest-assertions-core:5.4.1")
29+
testImplementation("io.kotest:kotest-runner-junit5:5.5.5")
30+
testImplementation("io.kotest:kotest-assertions-core:5.5.5")
3431
}
3532

36-
kotlin.jvmToolchain {
37-
this as JavaToolchainSpec
38-
languageVersion.set(JavaLanguageVersion.of(8))
39-
}
33+
kotlin.jvmToolchain { languageVersion.set(JavaLanguageVersion.of(8)) }
4034

4135
tasks {
4236
withType<KotlinCompile<*>>().all {
43-
kotlinOptions {
44-
freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn")
45-
}
37+
kotlinOptions { freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn") }
4638
}
47-
withType<Test>().configureEach { useJUnitPlatform() }
39+
test { useJUnitPlatform() }
4840
}
4941

5042
publishing {
@@ -54,11 +46,7 @@ publishing {
5446
suppressAllPomMetadataWarnings()
5547
}
5648
}
57-
repositories {
58-
github {
59-
domain = "kotlin-graphics/mary"
60-
}
61-
}
49+
repositories { github { domain = "kotlin-graphics/mary" } }
6250
}
6351

64-
java { withSourcesJar() }
52+
java.withSourcesJar()

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
7-
distributionSha256Sum=f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
7+
distributionSha256Sum=ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7

src/main/kotlin/gln/buffer/buffer.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import glm_.L
66
import glm_.mat4x4.Mat4
77
import gln.*
88
import gln.identifiers.GlBuffers
9-
import kool.Stack
10-
import kool.adr
119
import org.lwjgl.opengl.GL15C
1210
import org.lwjgl.opengl.GL20C
1311

@@ -22,13 +20,13 @@ fun glGenBuffers(size: Int) = GlBuffers(size).also { GL15C.glGenBuffers(it.names
2220
// ----- Mat4 ----- TODO others
2321

2422
inline fun glBufferData(target: BufferTarget, mat: Mat4, usage: Usage = Usage.STATIC_DRAW) =
25-
Stack.mat4Address(mat) { GL15C.nglBufferData(target.i, Mat4.size.L, it, usage.i) }
23+
GL15C.nglBufferData(target.i, Mat4.size.L, mat at offHeapPtr, usage.i)
2624

2725
inline fun glBufferSubData(target: BufferTarget, offset: Int, mat: Mat4) =
28-
Stack.mat4Address(mat) { GL15C.nglBufferSubData(target.i, offset.L, Mat4.size.L, it) }
26+
GL15C.nglBufferSubData(target.i, offset.L, Mat4.size.L, mat at offHeapPtr)
2927

3028
inline fun glBufferSubData(target: BufferTarget, mat: Mat4) =
31-
Stack.mat4Address(mat) { GL15C.nglBufferSubData(target.i, 0L, Mat4.size.L, it) }
29+
GL15C.nglBufferSubData(target.i, 0L, Mat4.size.L, mat at offHeapPtr)
3230

3331

3432
inline fun glDrawBuffers(vararg buffers: Int) = GL20C.glDrawBuffers(buffers)

src/main/kotlin/gln/buffer/dsl.kt

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package gln.buffer
22

3-
import glm_.BYTES
43
import glm_.L
54
import glm_.bool
65
import glm_.i
76
import glm_.mat4x4.Mat4
8-
import glm_.vec2.Vec2i
97
import glm_.vec3.Vec3
108
import glm_.vec4.Vec4
119
import gln.*
@@ -14,7 +12,6 @@ import gln.identifiers.GlBuffer
1412
import gln.identifiers.GlBuffers
1513
import kool.*
1614
import org.lwjgl.opengl.*
17-
import org.lwjgl.system.MemoryUtil
1815
import org.lwjgl.system.MemoryUtil.NULL
1916
import org.lwjgl.system.MemoryUtil.memByteBuffer
2017
import java.nio.*
@@ -42,7 +39,7 @@ object GlBufferDsl {
4239
fun data(data: FloatBuffer, usage: Usage = STATIC_DRAW) = GL15C.nglBufferData(target.i, data.remaining().L * Float.BYTES, data.adr + data.pos * Float.BYTES, usage.i)
4340
fun data(data: DoubleBuffer, usage: Usage = STATIC_DRAW) = GL15C.nglBufferData(target.i, data.remaining().L * Double.BYTES, data.adr + data.pos * Double.BYTES, usage.i)
4441

45-
fun data(size: Int, data: Vec4, usage: Usage = STATIC_DRAW) = Stack.vec4Address(data) { GL15C.nglBufferData(target.i, size.L, it, usage.i) }
42+
fun data(size: Int, data: Vec4, usage: Usage = STATIC_DRAW) = GL15C.nglBufferData(target.i, size.L, data at offHeapPtr, usage.i)
4643

4744
fun subData(offset: Int, data: ByteBuffer) = GL15C.nglBufferSubData(target.i, offset.L, data.remaining().L, data.adr + data.pos)
4845
fun subData(offset: Int, data: ShortBuffer) = GL15C.nglBufferSubData(target.i, offset.L, data.remaining().L * Short.BYTES, data.adr + data.pos * Short.BYTES)
@@ -58,12 +55,12 @@ object GlBufferDsl {
5855
fun subData(data: FloatBuffer) = GL15C.nglBufferSubData(target.i, 0L, data.remaining().L * Float.BYTES, data.adr + data.pos * Float.BYTES)
5956
fun subData(data: DoubleBuffer) = GL15C.nglBufferSubData(target.i, 0L, data.remaining().L * Double.BYTES, data.adr + data.pos * Double.BYTES)
6057

61-
fun data(data: Vec3, usage: Usage = STATIC_DRAW) = Stack.vec3Address(data) { GL15C.nglBufferData(target.i, Vec3.size.L, it, usage.i) }
58+
fun data(vec: Vec3, usage: Usage = STATIC_DRAW) = GL15C.nglBufferData(target.i, Vec3.size.L, vec at offHeapPtr, usage.i)
6259

6360
// ----- Mat4 -----
64-
fun data(mat: Mat4, usage: Usage) = Stack.mat4Address(mat) { GL15C.nglBufferData(target.i, Mat4.size.L, it, usage.i) }
61+
fun data(mat: Mat4, usage: Usage) = GL15C.nglBufferData(target.i, Mat4.size.L, mat at offHeapPtr, usage.i)
6562

66-
fun subData(offset: Int, mat: Mat4) = Stack.mat4Address(mat) { GL15C.nglBufferSubData(target.i, offset.L, Mat4.size.L, it) }
63+
fun subData(offset: Int, mat: Mat4) = GL15C.nglBufferSubData(target.i, offset.L, Mat4.size.L, mat at offHeapPtr)
6764

6865
fun subData(mat: Mat4) = subData(0, mat)
6966

@@ -98,8 +95,8 @@ object GlBufferDsl {
9895

9996
// --- [ glGetBufferPointerv ] ---
10097

101-
val pointer: Ptr
102-
get() = GL15C.glGetBufferPointer(target.i, GL15C.GL_BUFFER_MAP_POINTER)
98+
val pointer: Ptr<Byte>
99+
get() = GL15C.glGetBufferPointer(target.i, GL15C.GL_BUFFER_MAP_POINTER).toPtr()
103100

104101

105102
fun bindRange(index: Int, offset: Int, size: Int) = GL30C.glBindBufferRange(target.i, index, name, offset.L, size.L)
@@ -122,15 +119,15 @@ object GlBufferDsl {
122119

123120
fun data(size: Int, usage: Usage = STATIC_DRAW) = GL15C.nglBufferData(target.i, size.L, NULL, usage.i)
124121

125-
fun data(data: Buffer, usage: Usage = STATIC_DRAW) = GL15C.nglBufferData(target.i, data.remByte.L, data.adr, usage.i)
122+
fun data(data: Buffer, usage: Usage = STATIC_DRAW) = GL15C.nglBufferData(target.i, data.remByte.L, data.adr.L, usage.i)
126123

127124
// --- [ glBufferSubData ] ---
128125

129-
fun subData(offset: Int, data: Buffer) = GL15C.nglBufferSubData(target.i, offset.L, data.remByte.L, data.adr)
126+
fun subData(offset: Int, data: Buffer) = GL15C.nglBufferSubData(target.i, offset.L, data.remByte.L, data.adr.L)
130127

131128
// --- [ glGetBufferSubData ] ---
132129

133-
fun getSubData(offset: Int, data: Buffer) = GL15C.nglGetBufferSubData(target.i, offset.L, data.remByte.L, data.adr)
130+
fun getSubData(offset: Int, data: Buffer) = GL15C.nglGetBufferSubData(target.i, offset.L, data.remByte.L, data.adr.L)
134131

135132
// --- [ glMapBuffer ] ---
136133

@@ -142,18 +139,18 @@ object GlBufferDsl {
142139
}
143140
}
144141

145-
inline fun map(access: BufferAccess, block: (Ptr) -> Unit): ByteBuffer? {
142+
inline fun map(access: BufferAccess, block: (Ptr<Byte>) -> Unit): ByteBuffer? {
146143
val ptr = GL15C.nglMapBuffer(target.i, access.i)
147-
block(ptr)
144+
block(ptr.toPtr())
148145
return when (ptr) {
149146
NULL -> null
150147
else -> memByteBuffer(ptr, GL15C.glGetBufferParameteri(target.i, GL15C.GL_BUFFER_SIZE))
151148
}
152149
}
153150

154-
inline fun mapped(access: BufferAccess, block: (Ptr) -> Unit): ByteBuffer? {
151+
inline fun mapped(access: BufferAccess, block: (Ptr<Byte>) -> Unit): ByteBuffer? {
155152
val ptr = GL15C.nglMapBuffer(target.i, access.i)
156-
block(ptr)
153+
block(ptr.toPtr())
157154
return when (ptr) {
158155
NULL -> null
159156
else -> memByteBuffer(ptr, GL15C.glGetBufferParameteri(target.i, GL15C.GL_BUFFER_SIZE))

src/main/kotlin/gln/cap/caps.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import gln.GL_COMPRESSED_RGB_FXT1_3DFX
66
import gln.GL_ETC1_RGB8_OES
77
import gln.glGetVec2
88
import kool.IntBuffer
9-
import kool.lib.toList
9+
import kool.toIntArray
1010
import kool.use
1111
import org.lwjgl.opengl.ATITextureCompression3DC.GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI
1212
import org.lwjgl.opengl.EXTTextureCompressionLATC.*
@@ -1158,7 +1158,7 @@ class Caps(val profile: Profile = Profile.COMPATIBILITY, forwardCompatible: Bool
11581158
private val compressed by lazy {
11591159
IntBuffer(limits.NUM_COMPRESSED_TEXTURE_FORMATS).use { buffer ->
11601160
glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, buffer)
1161-
buffer.toList()
1161+
buffer.toIntArray()
11621162
}
11631163
}
11641164

@@ -1315,7 +1315,7 @@ class Caps(val profile: Profile = Profile.COMPATIBILITY, forwardCompatible: Bool
13151315
@JvmField
13161316
val ETC1_RGB8_OES = has(GL_ETC1_RGB8_OES)
13171317

1318-
private fun has(i: Int) = compressed.contains(i)
1318+
private fun has(i: Int) = i in compressed
13191319

13201320
fun write(w: PrintWriter) = this::class.memberProperties.filter { it.visibility == KVisibility.PUBLIC }.map {
13211321
w.println("${it.name} = ${it.getter.call(this)}")

0 commit comments

Comments
 (0)