Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
path: ./orx

- name: Checkout OPENRNDR repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
repository: openrndr/openrndr
path: ./openrndr
ref: master

- name: Test glxinfo
run: |
Expand All @@ -47,7 +46,7 @@ jobs:
run: ./gradlew publishToMavenLocal snapshot

- name: Build ORX
run: ./gradlew build
run: ./gradlew build -Popenrndr.application.backend=application-glfw

- name: Collect screenshots without errors
run: xvfb-run ./gradlew collectScreenshots
run: xvfb-run ./gradlew collectScreenshots -Popenrndr.application.backend=application-glfw
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ tasks.withType<KotlinJvmCompile>().configureEach {
}

kotlin {
applyDefaultHierarchyTemplate()
jvm {
compilations {
val main by getting
Expand Down Expand Up @@ -87,6 +88,11 @@ kotlin {
nodejs()
}

wasmJs() {
browser()
nodejs()
}

sourceSets {
val commonMain by getting {
dependencies {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ org.gradle.caching=true
# https://kotlinlang.org/docs/gradle.html#dependency-on-the-standard-library
kotlin.stdlib.default.dependency=true
kotlin.mpp.import.legacyTestSourceSetDetection=true
kotlin.daemon.jvmargs=-Xmx2G

# Enable Dokka 2.0.0
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
Expand Down
2 changes: 1 addition & 1 deletion orx-color/src/commonTest/kotlin/ColorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/**
* orx-color
*/
package org.openrndr.extra.color
//package org.openrndr.extra.color
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
package org.openrndr.extra.color.colormaps

import io.kotest.matchers.shouldBe
import org.openrndr.color.ColorRGBa
import org.openrndr.color.Linearity
import org.openrndr.math.Vector3
import kotlin.test.Test
import kotlin.test.assertEquals

class TestSpectralZucconi6Colormap {

@Test
fun testSpectralZucconi6Vector() {
spectralZucconi6Vector(0.0) shouldBe Vector3(0.0, 0.0, 0.026075309353279508)
spectralZucconi6Vector(0.5) shouldBe Vector3(0.49637374891706215, 0.8472371726323733, 0.18366091774095827)
spectralZucconi6Vector(1.0) shouldBe Vector3(0.0, 0.0, 0.0)
spectralZucconi6Vector(-0.1) shouldBe Vector3(0.0, 0.0, 0.0)
spectralZucconi6Vector(1.1) shouldBe Vector3(0.0, 0.0, 0.0)
assertEquals(spectralZucconi6Vector(0.0) , Vector3(0.0, 0.0, 0.026075309353279508))
assertEquals(spectralZucconi6Vector(0.5) , Vector3(0.49637374891706215, 0.8472371726323733, 0.18366091774095827))
assertEquals(spectralZucconi6Vector(1.0) , Vector3(0.0, 0.0, 0.0))
assertEquals(spectralZucconi6Vector(-0.1) , Vector3(0.0, 0.0, 0.0))
assertEquals(spectralZucconi6Vector(1.1) , Vector3(0.0, 0.0, 0.0))
}

@Test
fun testSpectralZucconi6() {
spectralZucconi6(0.0) shouldBe ColorRGBa(0.0, 0.0, 0.026075309353279508, linearity = Linearity.LINEAR)
spectralZucconi6(0.5) shouldBe ColorRGBa(0.49637374891706215, 0.8472371726323733, 0.18366091774095827, linearity = Linearity.LINEAR)
spectralZucconi6(1.0) shouldBe ColorRGBa(0.0, 0.0, 0.0, linearity = Linearity.LINEAR)
spectralZucconi6(-0.1) shouldBe ColorRGBa(0.0, 0.0, 0.0, linearity = Linearity.LINEAR)
spectralZucconi6(1.1) shouldBe ColorRGBa(0.0, 0.0, 0.0, linearity = Linearity.LINEAR)
assertEquals(spectralZucconi6(0.0), ColorRGBa(0.0, 0.0, 0.026075309353279508, linearity = Linearity.LINEAR))
assertEquals(spectralZucconi6(0.5), ColorRGBa(0.49637374891706215, 0.8472371726323733, 0.18366091774095827, linearity = Linearity.LINEAR))
assertEquals(spectralZucconi6(1.0), ColorRGBa(0.0, 0.0, 0.0, linearity = Linearity.LINEAR))
assertEquals(spectralZucconi6(-0.1), ColorRGBa(0.0, 0.0, 0.0, linearity = Linearity.LINEAR))
assertEquals(spectralZucconi6(1.1), ColorRGBa(0.0, 0.0, 0.0, linearity = Linearity.LINEAR))
}

}
22 changes: 11 additions & 11 deletions orx-color/src/commonTest/kotlin/colormaps/TestTurboColormap.kt
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
package org.openrndr.extra.color.colormaps

import io.kotest.matchers.shouldBe
import org.openrndr.color.ColorRGBa
import org.openrndr.color.Linearity
import org.openrndr.math.Vector3
import kotlin.test.Test
import kotlin.test.assertEquals

class TestTurboColormap {

@Test
fun testTurboColormapVector() {
turboColormapVector(0.0) shouldBe Vector3(0.13572138, 0.09140261, 0.1066733)
turboColormapVector(0.5) shouldBe Vector3(0.5885220621875007, 0.981864383125, 0.31316869781249856)
turboColormapVector(1.0) shouldBe Vector3(0.5658592099999993, 0.05038885999999998, -0.025520659999997974)
turboColormapVector(-0.1) shouldBe Vector3(0.13572138, 0.09140261, 0.1066733)
turboColormapVector(1.1) shouldBe Vector3(0.5658592099999993, 0.05038885999999998, -0.025520659999997974)
assertEquals(turboColormapVector(0.0), Vector3(0.13572138, 0.09140261, 0.1066733))
assertEquals(turboColormapVector(0.5), Vector3(0.5885220621875007, 0.981864383125, 0.31316869781249856))
assertEquals(turboColormapVector(1.0), Vector3(0.5658592099999993, 0.05038885999999998, -0.025520659999997974))
assertEquals(turboColormapVector(-0.1), Vector3(0.13572138, 0.09140261, 0.1066733))
assertEquals(turboColormapVector(1.1), Vector3(0.5658592099999993, 0.05038885999999998, -0.025520659999997974))
}

@Test
fun testTurboColormap() {
turboColormap(0.0) shouldBe ColorRGBa(0.13572138, 0.09140261, 0.1066733, linearity = Linearity.LINEAR)
turboColormap(0.5) shouldBe ColorRGBa(0.5885220621875007, 0.981864383125, 0.31316869781249856, linearity = Linearity.LINEAR)
turboColormap(1.0) shouldBe ColorRGBa(0.5658592099999993, 0.05038885999999998, -0.025520659999997974, linearity = Linearity.LINEAR)
turboColormap(-0.1) shouldBe ColorRGBa(0.13572138, 0.09140261, 0.1066733, linearity = Linearity.LINEAR)
turboColormap(1.1) shouldBe ColorRGBa(0.5658592099999993, 0.05038885999999998, -0.025520659999997974, linearity = Linearity.LINEAR)
assertEquals(turboColormap(0.0), ColorRGBa(0.13572138, 0.09140261, 0.1066733, linearity = Linearity.LINEAR))
assertEquals(turboColormap(0.5), ColorRGBa(0.5885220621875007, 0.981864383125, 0.31316869781249856, linearity = Linearity.LINEAR))
assertEquals(turboColormap(1.0), ColorRGBa(0.5658592099999993, 0.05038885999999998, -0.025520659999997974, linearity = Linearity.LINEAR))
assertEquals(turboColormap(-0.1), ColorRGBa(0.13572138, 0.09140261, 0.1066733, linearity = Linearity.LINEAR))
assertEquals(turboColormap(1.1), ColorRGBa(0.5658592099999993, 0.05038885999999998, -0.025520659999997974, linearity = Linearity.LINEAR))
}

}
87 changes: 43 additions & 44 deletions orx-color/src/jvmTest/kotlin/TestMix.kt
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
import io.kotest.core.spec.style.DescribeSpec
import org.openrndr.color.ColorRGBa
import org.openrndr.color.Linearity
import org.openrndr.extra.color.palettes.rangeTo

import kotlin.test.assertEquals
import kotlin.test.assertSame

class TestMix : DescribeSpec({

describe("two srgb colors") {
val a = ColorRGBa.BLUE
val b = ColorRGBa.RED

assertEquals(Linearity.SRGB, a.linearity)


it("should mix properly") {
assertSame(a, a.mix(b, 0.0))
assertSame(b, a.mix(b, 1.0))
}
}

describe("two linear rgb colors") {
val a = ColorRGBa.BLUE.toLinear()
val b = ColorRGBa.RED.toLinear()

it("should mix properly") {
assertSame(a, a.mix(b, 0.0))
assertSame(b, a.mix(b, 1.0))
}
}

describe("a 2-step range of colors") {
val a = ColorRGBa.BLUE
val b = ColorRGBa.RED

val blend = a..b blend 2
assertEquals(2, blend.size)
assertEquals(a, blend[0])
assertEquals(b, blend[1])
}

})
//import org.openrndr.color.ColorRGBa
//import org.openrndr.color.Linearity
//import org.openrndr.extra.color.palettes.rangeTo
//
//import kotlin.test.assertEquals
//import kotlin.test.assertSame
//
//class TestMix {
//
// describe("two srgb colors") {
// val a = ColorRGBa.BLUE
// val b = ColorRGBa.RED
//
// assertEquals(Linearity.SRGB, a.linearity)
//
//
// it("should mix properly") {
// assertSame(a, a.mix(b, 0.0))
// assertSame(b, a.mix(b, 1.0))
// }
// }
//
// describe("two linear rgb colors") {
// val a = ColorRGBa.BLUE.toLinear()
// val b = ColorRGBa.RED.toLinear()
//
// it("should mix properly") {
// assertSame(a, a.mix(b, 0.0))
// assertSame(b, a.mix(b, 1.0))
// }
// }
//
// describe("a 2-step range of colors") {
// val a = ColorRGBa.BLUE
// val b = ColorRGBa.RED
//
// val blend = a..b blend 2
// assertEquals(2, blend.size)
// assertEquals(a, blend[0])
// assertEquals(b, blend[1])
// }
//
//})
12 changes: 6 additions & 6 deletions orx-math/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ kotlin {

val commonTest by getting {
dependencies {
implementation(sharedLibs.kotlin.serialization.json)
implementation(sharedLibs.kotest.assertions)
implementation(sharedLibs.kotest.framework.engine)
// implementation(sharedLibs.kotlin.serialization.json)
// implementation(sharedLibs.kotest.assertions)
// implementation(sharedLibs.kotest.framework.engine)
}
}

val jvmTest by getting {
dependencies {
implementation(sharedLibs.kotlin.serialization.json)
implementation(sharedLibs.kotest.assertions)
implementation(sharedLibs.kotest.framework.engine)
// implementation(sharedLibs.kotlin.serialization.json)
// implementation(sharedLibs.kotest.assertions)
// implementation(sharedLibs.kotest.framework.engine)
}
}

Expand Down