Skip to content

Commit

Permalink
0.8.3.0-19
Browse files Browse the repository at this point in the history
  • Loading branch information
elect86 committed Apr 4, 2023
1 parent e659e9a commit c8a6d81
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 82 deletions.
54 changes: 36 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,66 @@ name: build
on: [ push ]

jobs:

linux:
name: 'Linux'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 1.11
uses: actions/setup-java@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
java-version: 8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# - name: Build with Gradle
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
- uses: burrunan/gradle-cache-action@v1
name: Build scenery
name: Build
with:
arguments: build #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
arguments: assemble #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
# - name: Cleanup Gradle Cache
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
# run: |
# rm -f ~/.gradle/caches/modules-2/modules-2.lock
# rm -f ~/.gradle/caches/modules-2/gc.properties
# - name: Show Working directory content
# run: ls
# - uses: actions/checkout@master
# with:
# repository: kotlin-graphics/mary
# path: ./mary
- name: Show ../.. directory content
run: ls ../..
# - name: move mary up
# run: mv ./mary ../..
# - name: Show Working directory content
# run: ls
# - name: Show ../.. directory content
# run: ls ../..

windows:
name: 'Windows'
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 1.11
uses: actions/setup-java@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
java-version: 8
# - name: Build with Gradle
# run: .\gradlew.bat build -x dokkaHtml -x dokkaHtmlJar
- uses: burrunan/gradle-cache-action@v1
name: Build scenery
name: Build
with:
arguments: build #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
arguments: assemble #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
# - name: Cleanup Gradle Cache
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
Expand All @@ -58,20 +75,21 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 1.11
uses: actions/setup-java@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
java-version: 8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# - name: Build with Gradle
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
- uses: burrunan/gradle-cache-action@v1
name: Build scenery
name: Build
with:
arguments: build #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
arguments: assemble #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
# - name: Cleanup Gradle Cache
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
Expand Down
29 changes: 10 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import magik.createGithubPublication
import magik.github
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import org.lwjgl.lwjgl
import org.lwjgl.lwjgl.Module.*
import org.lwjgl.Lwjgl.Module.*

plugins {
kotlin("jvm") version embeddedKotlinVersion
id("org.lwjgl.plugin") version "0.0.29"
id("elect86.magik") version "0.3.1"
id("org.lwjgl.plugin") version "0.0.34"
id("elect86.magik") version "0.3.2"
`maven-publish`
}

Expand All @@ -18,9 +18,7 @@ repositories {

dependencies {

implementation("kotlin.graphics:glm:0.9.9.1-5")
implementation("kotlin.graphics:unsigned:3.3.31")
implementation("kotlin.graphics:kool:0.9.68")
api("kotlin.graphics:glm:0.9.9.1-6")

// https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-core
listOf(/*"-batik",*/ "-bmp", "-core", "-icns", "-iff", "-jpeg", "-metadata", "-pcx", "-pdf", "-pict", "-pnm",
Expand All @@ -32,22 +30,19 @@ dependencies {

lwjgl { implementation(jemalloc, opengl) }

testImplementation("io.kotest:kotest-runner-junit5:5.4.1")
testImplementation("io.kotest:kotest-assertions-core:5.4.1")
testImplementation("io.kotest:kotest-runner-junit5:5.5.5")
testImplementation("io.kotest:kotest-assertions-core:5.5.5")
}

kotlin.jvmToolchain {
this as JavaToolchainSpec
languageVersion.set(JavaLanguageVersion.of(8))
}
kotlin.jvmToolchain { languageVersion.set(JavaLanguageVersion.of(8)) }

tasks {
withType<KotlinCompile<*>>().all {
kotlinOptions {
freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn")
}
}
withType<Test>().configureEach { useJUnitPlatform() }
test { useJUnitPlatform() }
}

publishing {
Expand All @@ -57,11 +52,7 @@ publishing {
suppressAllPomMetadataWarnings()
}
}
repositories {
github {
domain = "kotlin-graphics/mary"
}
}
repositories { github { domain = "kotlin-graphics/mary" } }
}

java { withSourcesJar() }
java.withSourcesJar()
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionSha256Sum=f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionSha256Sum=ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ pluginManagement {

gradle.rootProject {
group = "kotlin.graphics"
version = "0.8.3.0-18"
version = "0.8.3.0-19"
}
2 changes: 1 addition & 1 deletion src/main/kotlin/gli_/Cache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Cache {

val index = indexCache(layer, face, level)
val offset = storage.baseOffset(baseLayer + layer, baseFace + face, baseLevel + level)
baseAddresses[index] = storage.data().adr + offset
baseAddresses[index] = storage.data().adr.toLong() + offset
}

for (level in 0 until levels) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/gli_/Image.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Image {
storage = Storage(format, extent, 1, 1, 1)
this.format = format
baseLevel = 0
data = MemoryUtil.memByteBuffer(storage!!.data().adr, storage!!.data().remaining())
data = memByteBuffer(storage!!.data().adr.toLong(), storage!!.data().remaining())
size = computeSize(0)
}

Expand All @@ -51,7 +51,7 @@ class Image {
storage = Storage(image.storage!!)
this.format = format
baseLevel = image.baseLevel
data = MemoryUtil.memByteBuffer(image.data!!.adr, image.data!!.remaining())
data = memByteBuffer(image.data!!.adr.toLong(), image.data!!.remaining())
size = image.size
assert(format.blockSize == image.format.blockSize)
}
Expand All @@ -71,7 +71,7 @@ class Image {

fun computeData(baseLayer: Int, baseFace: Int, baseLevel: Int): ByteBuffer {
val baseOffset = storage!!.baseOffset(baseLayer, baseFace, baseLevel)
return memByteBuffer(storage!!.data().adr + baseOffset, storage!!.data().remaining() - baseOffset)
return memByteBuffer(storage!!.data().adr.toLong() + baseOffset, storage!!.data().remaining() - baseOffset)
}

fun computeSize(level: Int): Int {
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/gli_/Storage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Storage {
blockCount = Vec3i(storage.blockCount)
blockExtent = Vec3i(storage.blockExtent)
extent = Vec3i(storage.extent)
data = MemoryUtil.memByteBuffer(storage.data!!.adr, storage.data!!.remaining())
data = MemoryUtil.memByteBuffer(storage.data!!.adr.toLong(), storage.data!!.remaining())
}

constructor(format: Format, extent: Vec3i, layers: Int, faces: Int, levels: Int) {
Expand Down Expand Up @@ -120,8 +120,8 @@ class Storage {

val baseOffsetSrc = storageSrc.baseOffset(layerSrc, faceSrc, levelSrc)
val baseOffsetDst = baseOffset(layerDst, faceDst, levelDst)
val imageSrc = storageSrc.data!!.adr + baseOffsetSrc
val imageDst = data!!.adr + baseOffsetDst
val imageSrc = storageSrc.data!!.adr.toLong() + baseOffsetSrc
val imageDst = data!!.adr.toLong() + baseOffsetDst

for (blockIndexZ in 0 until blockCount.z)
for (blockIndexY in 0 until blockCount.y) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/gli_/Texture.kt
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ open class Texture {
blockData: T
) {
val baseOffset = storage!!.baseOffset(layer, face, level)
val baseAddress = storage!!.data().adr + baseOffset
val baseAddress = storage!!.data().adr.toLong() + baseOffset

val blockOffset = texelOffset / storage!!.blockExtent
val blockExtent = texelExtent / storage!!.blockExtent + blockOffset
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/gli_/gl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import gli_.detail.FORMAT_PROPERTY_BGRA_TYPE_BIT
import gli_.gl.ExternalFormat.*
import gli_.gl.InternalFormat.*
import gli_.gl.TypeFormat.*
import glm_.has
import java.nio.ByteBuffer
import java.nio.IntBuffer
import gli_.gl.ExternalFormat.NONE as NONE_
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/gli_/gli.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package gli_

import glm_.L
import kool.Address
import org.lwjgl.system.MemoryUtil


Expand Down Expand Up @@ -59,11 +60,12 @@ class Java {
}

fun memCopy(src: Long, dst: Long, bytes: Int) = MemoryUtil.memCopy(src, dst, bytes.L)
fun memCopy(src: Address, dst: Address, bytes: Int) = memCopy(src.toLong(), dst.toLong(), bytes)


const val GLI_VERSION_MAJOR = 0
const val GLI_VERSION_MINOR = 8
const val GLI_VERSION_PATCH = 3
const val GLI_VERSION_REVISION = 0
const val GLI_VERSION_BUILD = 18
const val GLI_VERSION_BUILD = 19
const val GLI_VERSION = GLI_VERSION_MAJOR * 1_000 + GLI_VERSION_MINOR * 100 + GLI_VERSION_PATCH * 10 + GLI_VERSION_REVISION + GLI_VERSION_BUILD / 10f
1 change: 1 addition & 0 deletions src/main/kotlin/gli_/loadDds.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import gli_.dx.has
import gli_.dx.or
import glm_.b
import glm_.glm
import glm_.has
import glm_.i
import glm_.vec3.Vec3i
import kool.*
Expand Down
35 changes: 18 additions & 17 deletions src/main/kotlin/gli_/loadImage.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gli_

import glm_.b
import glm_.or
import glm_.vec3.Vec3i
import kool.*
Expand Down Expand Up @@ -37,20 +38,20 @@ interface loadImage {
val dst = data()
var i = 0
(image.raster.dataBuffer as DataBufferInt).data.forEach {
dst[i++] = it ushr 16
dst[i++] = it ushr 8
dst[i++] = it
dst[i++] = (it ushr 16).b
dst[i++] = (it ushr 8).b
dst[i++] = it.b
}
}
TYPE_INT_ARGB -> Texture(Target._2D, Format.RGBA8_UNORM_PACK8, extent, 1, 1, 1).apply {
// push alpha at the end
val dst = data()
var i = 0
(image.raster.dataBuffer as DataBufferInt).data.forEach {
dst[i++] = it ushr 16
dst[i++] = it ushr 8
dst[i++] = it
dst[i++] = it ushr 24
dst[i++] = (it ushr 16).b
dst[i++] = (it ushr 8).b
dst[i++] = it.b
dst[i++] = (it ushr 24).b
}
}
TYPE_INT_ARGB_PRE -> Texture(Target._2D, Format.RGBA8_UNORM_PACK8, extent, 1, 1, 1).apply {
Expand All @@ -59,20 +60,20 @@ interface loadImage {
var i = 0
(image.raster.dataBuffer as DataBufferInt).data.forEach {
val a = it ushr 24
dst[i++] = (it ushr 16) / a
dst[i++] = (it ushr 8) / a
dst[i++] = it / a
dst[i++] = a
dst[i++] = ((it ushr 16) / a).b
dst[i++] = ((it ushr 8) / a).b
dst[i++] = (it / a).b
dst[i++] = a.b
}
}
TYPE_INT_BGR -> Texture(Target._2D, Format.RGB8_UNORM_PACK8, extent, 1, 1, 1).apply {
// switch blue and red
val dst = data()
var i = 0
(image.raster.dataBuffer as DataBufferInt).data.forEach {
dst[i++] = it
dst[i++] = it ushr 8
dst[i++] = it ushr 16
dst[i++] = it.b
dst[i++] = (it ushr 8).b
dst[i++] = (it ushr 16).b
}
}
TYPE_3BYTE_BGR -> Texture(Target._2D, Format.RGB8_UNORM_PACK8, extent, 1, 1, 1).apply {
Expand Down Expand Up @@ -102,9 +103,9 @@ interface loadImage {
val src = (image.raster.dataBuffer as DataBufferByte).data
for (i in src.indices step 4) {
val a = src[i]
dst[i] = src[i + 3] / a
dst[i + 1] = src[i + 2] / a
dst[i + 2] = src[i + 1] / a
dst[i] = (src[i + 3] / a).b
dst[i + 1] = (src[i + 2] / a).b
dst[i + 2] = (src[i + 1] / a).b
dst[i + 3] = a
}
}
Expand Down
Loading

0 comments on commit c8a6d81

Please sign in to comment.