Fix demos, upgrade to Gradle 7.2

This commit is contained in:
Edwin Jakobs
2021-08-22 15:44:40 +02:00
parent 48987fc551
commit 701f14400a
11 changed files with 45 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -2,7 +2,7 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.math.CatmullRomChain2
import org.openrndr.math.CatmulRomChain2
import org.openrndr.math.Polar
import org.openrndr.shape.ShapeContour
import org.openrndr.shape.toContour
@@ -10,7 +10,7 @@ import org.openrndr.shape.toContour
suspend fun main() = application {
program {
val points = List(6) { Polar(it * 70.0, 100.0).cartesian + drawer.bounds.center }
val cmr = CatmullRomChain2(points, 1.0, loop = true)
val cmr = CatmulRomChain2(points, 1.0, loop = true)
val contour = ShapeContour.fromPoints(cmr.positions(200), true)
extend {

View File

@@ -24,14 +24,17 @@ kotlin {
val demo by creating {
defaultSourceSet {
kotlin.srcDir("src/demo")
dependencies {
implementation(project(":orx-camera"))
implementation("org.openrndr:openrndr-application:$openrndrVersion")
implementation("org.openrndr:openrndr-extensions:$openrndrVersion")
runtimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion")
runtimeOnly("org.openrndr:openrndr-gl3-natives-$openrndrOS:$openrndrVersion")
implementation(compilations["main"]!!.output.allOutputs)
}
}
dependencies {
implementation(project(":orx-camera"))
implementation(project(":orx-mesh-generators"))
implementation(project(":orx-color"))
implementation("org.openrndr:openrndr-application:$openrndrVersion")
implementation("org.openrndr:openrndr-extensions:$openrndrVersion")
runtimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion")
runtimeOnly("org.openrndr:openrndr-gl3-natives-$openrndrOS:$openrndrVersion")
implementation(compilations["main"]!!.output.allOutputs)
}
}
}
@@ -62,6 +65,7 @@ kotlin {
implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion")
}
}
@Suppress("UNUSED_VARIABLE")
val commonTest by getting {
dependencies {
@@ -72,6 +76,9 @@ kotlin {
}
}
val jvmMain by getting {}
@Suppress("UNUSED_VARIABLE")
val jvmTest by getting {
dependencies {

View File

@@ -1,10 +1,12 @@
@file:JvmName("HistogramJvm")
package org.openrndr.extras.color.statistics
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.ColorBuffer
import kotlin.jvm.JvmName
import kotlin.random.Random
private fun ColorRGBa.binIndex(binCount: Int): Triple<Int, Int, Int> {
internal fun ColorRGBa.binIndex(binCount: Int): Triple<Int, Int, Int> {
val rb = (r * binCount).toInt().coerceIn(0, binCount - 1)
val gb = (g * binCount).toInt().coerceIn(0, binCount - 1)
val bb = (b * binCount).toInt().coerceIn(0, binCount - 1)

View File

@@ -1,3 +1,9 @@
package org.openrndr.extras.color.statistics
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.ColorBuffer
import kotlin.random.Random
fun calculateHistogramRGB(buffer: ColorBuffer,
binCount: Int = 16,
weighting: ColorRGBa.() -> Double = { 1.0 },

View File

@@ -1,10 +1,11 @@
import org.openrndr.Extension
import org.openrndr.Program
import org.openrndr.application
import org.openrndr.applicationSynchronous
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.olive.Olive
fun main() = application {
fun main() = applicationSynchronous {
configure {
width = 768
height = 576

View File

@@ -29,15 +29,9 @@ fun ((Int, Double, Double, Double) -> Double).crossFade(
return { seed, x, y, z ->
val a = z.map(start, end, 0.0, 1.0).mod_(1.0)
val f = (a / width).coerceAtMost(1.0)
val o = this(seed, x, y, a.map(0.0, 1.0, start, end)) * f + (1.0 - f) * this(
seed,
x,
y,
(a + 1.0).map(0.0, 1.0, start, end)
)
o
val o = this(seed, x, y, a.map(0.0, 1.0, start, end)) * f
val s = this(seed, x, y, (a + 1.0).map(0.0, 1.0, start, end) * (1.0 - f))
o + s
}
}
@@ -131,4 +125,7 @@ inline fun ((Int, Double, Double, Double) -> Double).perturb(crossinline distort
inline fun ((Int, Vector4) -> Double).perturb(crossinline distort: (Vector4) -> Vector4): (Int, Vector4) -> Double =
{ seed, v ->
this(seed, distort(v))
}
}
typealias IDDD_D = ((Int, Double, Double, Double) -> Double)

View File

@@ -2,6 +2,7 @@ import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.LineJoin
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.noise.perturb
import org.openrndr.extra.noise.simplex
import org.openrndr.extra.noise.simplex1D
import org.openrndr.extra.noise.simplex2D
@@ -10,6 +11,7 @@ import org.openrndr.extra.noise.withVector2Output
import org.openrndr.extra.noise.gradient
import org.openrndr.shape.contour
typealias IDDD_D = ((Int, Double, Double, Double) -> Double)
suspend fun main() = application {
configure {
width = 720
@@ -21,6 +23,10 @@ suspend fun main() = application {
this.outputFile = System.getProperty("screenshotPath")
}
}
val c = simplex3D.perturb({v->v})::class
println(c)
println(IDDD_D::perturb)
val n = simplex3D.withVector2Output().gradient()
extend {
drawer.stroke = null

View File

@@ -26,6 +26,7 @@ kotlin {
kotlin.srcDir("src/demo")
dependencies {
implementation(project(":orx-camera"))
implementation(project(":orx-noise"))
implementation("org.openrndr:openrndr-application:$openrndrVersion")
implementation("org.openrndr:openrndr-extensions:$openrndrVersion")
runtimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion")

View File

@@ -6,7 +6,7 @@ import org.openrndr.extra.noise.Random
import org.openrndr.extra.noise.gaussian
import org.openrndr.math.Vector2
import org.openrndr.shape.Rectangle
import quadtree.Quadtree
import org.openrndr.extra.quadtree.Quadtree
suspend fun main() {
application {

View File

@@ -25,7 +25,7 @@ kotlin {
defaultSourceSet {
kotlin.srcDir("src/demo")
dependencies {
implementation(project(":orx-camera"))
implementation(project(":orx-color"))
implementation("org.openrndr:openrndr-application:$openrndrVersion")
implementation("org.openrndr:openrndr-extensions:$openrndrVersion")
runtimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion")