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 distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

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

View File

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

View File

@@ -1,10 +1,12 @@
@file:JvmName("HistogramJvm")
package org.openrndr.extras.color.statistics package org.openrndr.extras.color.statistics
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.ColorBuffer import org.openrndr.draw.ColorBuffer
import kotlin.jvm.JvmName
import kotlin.random.Random 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 rb = (r * binCount).toInt().coerceIn(0, binCount - 1)
val gb = (g * binCount).toInt().coerceIn(0, binCount - 1) val gb = (g * binCount).toInt().coerceIn(0, binCount - 1)
val bb = (b * 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, fun calculateHistogramRGB(buffer: ColorBuffer,
binCount: Int = 16, binCount: Int = 16,
weighting: ColorRGBa.() -> Double = { 1.0 }, weighting: ColorRGBa.() -> Double = { 1.0 },

View File

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

View File

@@ -29,15 +29,9 @@ fun ((Int, Double, Double, Double) -> Double).crossFade(
return { seed, x, y, z -> return { seed, x, y, z ->
val a = z.map(start, end, 0.0, 1.0).mod_(1.0) val a = z.map(start, end, 0.0, 1.0).mod_(1.0)
val f = (a / width).coerceAtMost(1.0) val f = (a / width).coerceAtMost(1.0)
val o = this(seed, x, y, a.map(0.0, 1.0, start, end)) * f
val o = this(seed, x, y, a.map(0.0, 1.0, start, end)) * f + (1.0 - f) * this( val s = this(seed, x, y, (a + 1.0).map(0.0, 1.0, start, end) * (1.0 - f))
seed, o + s
x,
y,
(a + 1.0).map(0.0, 1.0, start, end)
)
o
} }
} }
@@ -132,3 +126,6 @@ inline fun ((Int, Vector4) -> Double).perturb(crossinline distort: (Vector4) ->
{ seed, v -> { seed, v ->
this(seed, distort(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.color.ColorRGBa
import org.openrndr.draw.LineJoin import org.openrndr.draw.LineJoin
import org.openrndr.extensions.SingleScreenshot import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.noise.perturb
import org.openrndr.extra.noise.simplex import org.openrndr.extra.noise.simplex
import org.openrndr.extra.noise.simplex1D import org.openrndr.extra.noise.simplex1D
import org.openrndr.extra.noise.simplex2D 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.extra.noise.gradient
import org.openrndr.shape.contour import org.openrndr.shape.contour
typealias IDDD_D = ((Int, Double, Double, Double) -> Double)
suspend fun main() = application { suspend fun main() = application {
configure { configure {
width = 720 width = 720
@@ -21,6 +23,10 @@ suspend fun main() = application {
this.outputFile = System.getProperty("screenshotPath") this.outputFile = System.getProperty("screenshotPath")
} }
} }
val c = simplex3D.perturb({v->v})::class
println(c)
println(IDDD_D::perturb)
val n = simplex3D.withVector2Output().gradient() val n = simplex3D.withVector2Output().gradient()
extend { extend {
drawer.stroke = null drawer.stroke = null

View File

@@ -26,6 +26,7 @@ kotlin {
kotlin.srcDir("src/demo") kotlin.srcDir("src/demo")
dependencies { dependencies {
implementation(project(":orx-camera")) implementation(project(":orx-camera"))
implementation(project(":orx-noise"))
implementation("org.openrndr:openrndr-application:$openrndrVersion") implementation("org.openrndr:openrndr-application:$openrndrVersion")
implementation("org.openrndr:openrndr-extensions:$openrndrVersion") implementation("org.openrndr:openrndr-extensions:$openrndrVersion")
runtimeOnly("org.openrndr:openrndr-gl3:$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.extra.noise.gaussian
import org.openrndr.math.Vector2 import org.openrndr.math.Vector2
import org.openrndr.shape.Rectangle import org.openrndr.shape.Rectangle
import quadtree.Quadtree import org.openrndr.extra.quadtree.Quadtree
suspend fun main() { suspend fun main() {
application { application {

View File

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