Fixes and move to jvmDemo (#286)

This commit is contained in:
Vechro
2023-01-15 16:27:19 +02:00
committed by GitHub
parent e27f7eb4cb
commit 47d4293a57
117 changed files with 75 additions and 310 deletions

View File

@@ -21,7 +21,7 @@ jobs:
path: ./orx path: ./orx
- name: Validate Gradle wrapper - name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1.0.4 uses: gradle/wrapper-validation-action@v1.0.5
- name: Checkout OPENRNDR repository - name: Checkout OPENRNDR repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -33,10 +33,11 @@ jobs:
- name: Test glxinfo - name: Test glxinfo
run: | run: |
sudo apt-get update
sudo apt-get install -y mesa-utils xvfb sudo apt-get install -y mesa-utils xvfb
xvfb-run glxinfo xvfb-run glxinfo
- uses: actions/setup-java@v2 - uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: 17 java-version: 17

View File

@@ -17,7 +17,7 @@ jobs:
path: ./orx path: ./orx
- name: Validate Gradle wrapper - name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1.0.4 uses: gradle/wrapper-validation-action@v1.0.5
- name: Checkout OPENRNDR repository - name: Checkout OPENRNDR repository
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -29,10 +29,11 @@ jobs:
- name: Test glxinfo - name: Test glxinfo
run: | run: |
sudo apt-get update
sudo apt-get install -y mesa-utils xvfb sudo apt-get install -y mesa-utils xvfb
xvfb-run glxinfo xvfb-run glxinfo
- uses: actions/setup-java@v2 - uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: 17 java-version: 17

View File

@@ -13,7 +13,7 @@ jobs:
- name: Get the version - name: Get the version
id: get_version id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- uses: actions/setup-java@v2 - uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: 17 java-version: 17

View File

@@ -14,7 +14,7 @@ jobs:
- name: Get the version - name: Get the version
id: get_version id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- uses: actions/setup-java@v2 - uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: 17 java-version: 17

View File

@@ -7,17 +7,17 @@ import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property import org.gradle.api.provider.Property
import org.gradle.api.tasks.* import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.register import org.gradle.kotlin.dsl.register
import org.gradle.process.ExecOperations
import org.gradle.work.Incremental import org.gradle.work.Incremental
import org.gradle.work.InputChanges import org.gradle.work.InputChanges
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmCompilation
import java.io.File import java.io.File
import java.net.URLClassLoader import java.net.URLClassLoader
import javax.inject.Inject import javax.inject.Inject
abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() { abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
@get:Incremental
@get:PathSensitive(PathSensitivity.NAME_ONLY)
@get:InputDirectory @get:InputDirectory
@get:PathSensitive(PathSensitivity.NAME_ONLY)
@get:SkipWhenEmpty
abstract val inputDir: DirectoryProperty abstract val inputDir: DirectoryProperty
@get:Input @get:Input
@@ -27,54 +27,55 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
abstract val outputDir: DirectoryProperty abstract val outputDir: DirectoryProperty
@get:Input @get:Input
@get:Optional
abstract val ignore: ListProperty<String> abstract val ignore: ListProperty<String>
@get:Inject
abstract val execOperations: ExecOperations
init {
ignore.set(emptyList())
}
@TaskAction @TaskAction
fun execute(inputChanges: InputChanges) { fun execute(inputChanges: InputChanges) {
val preloadClass = File(project.rootProject.projectDir, "buildSrc/build/classes/kotlin/preload") val preloadClass = File(project.rootProject.projectDir, "buildSrc/build/classes/kotlin/preload")
require(preloadClass.exists()) { require(preloadClass.exists()) {
"preload class not found: '${preloadClass.absolutePath}'" "preload class not found: '${preloadClass.absolutePath}'"
} }
inputChanges.getFileChanges(inputDir).forEach { change -> inputChanges.getFileChanges(inputDir).forEach { change ->
println(change)
if (change.fileType == FileType.DIRECTORY) return@forEach if (change.fileType == FileType.DIRECTORY) return@forEach
if (change.file.extension == "class") { if (change.file.extension == "class") {
val klassName = change.file.nameWithoutExtension val klassName = change.file.nameWithoutExtension
if (klassName.dropLast(2) in ignore.get()) if (klassName.dropLast(2) in ignore.get()) {
return@forEach return@forEach
}
val cp = (runtimeDependencies.get().map { it.toURI().toURL() } +
inputDir.get().asFile.toURI().toURL()
)
.toTypedArray()
val ucl = URLClassLoader(cp)
val klass = ucl.loadClass(klassName)
println("Collecting screenshot for ${klassName} ${klass}")
try { try {
val mainMethod = klass.getMethod("main") val cp = (runtimeDependencies.get().map { it.toURI().toURL() } + inputDir.get().asFile.toURI()
project.javaexec { .toURL()).toTypedArray()
this.classpath += project.files(inputDir.get().asFile, preloadClass) val ucl = URLClassLoader(cp)
this.classpath += runtimeDependencies.get() val klass = ucl.loadClass(klassName)
this.mainClass.set(klassName) klass.getMethod("main")
this.workingDir(project.rootProject.projectDir)
jvmArgs("-DtakeScreenshot=true", "-DscreenshotPath=${outputDir.get().asFile}/$klassName.png", "-Dorg.openrndr.exceptions=JVM")
}
} catch (e: NoSuchMethodException) { } catch (e: NoSuchMethodException) {
// silently ignore return@forEach
}
println("Collecting screenshot for ${klassName}")
execOperations.javaexec {
this.classpath += project.files(inputDir.get().asFile, preloadClass)
this.classpath += runtimeDependencies.get()
this.mainClass.set(klassName)
this.workingDir(project.rootProject.projectDir)
this.jvmArgs(
"-DtakeScreenshot=true",
"-DscreenshotPath=${outputDir.get().asFile}/$klassName.png",
"-Dorg.openrndr.exceptions=JVM"
)
} }
} }
} }
// this is only executed if there are changes in the inputDir // this is only executed if there are changes in the inputDir
val runDemos = outputDir.get().asFile.listFiles { file: File -> val runDemos = outputDir.get().asFile.listFiles { file: File ->
file.extension == "png" file.extension == "png"
}.map { it.nameWithoutExtension }.sorted() }!!.map { it.nameWithoutExtension }.sorted()
val readme = File(project.projectDir, "README.md") val readme = File(project.projectDir, "README.md")
if (readme.exists()) { if (readme.exists()) {
var lines = readme.readLines().toMutableList() var lines = readme.readLines().toMutableList()
@@ -84,10 +85,18 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
} }
lines.add("<!-- __demos__ -->") lines.add("<!-- __demos__ -->")
lines.add("## Demos") lines.add("## Demos")
// Find out if current project is MPP
val demoModuleName = if (project.plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) {
"jvmDemo"
} else {
"demo"
}
for (demo in runDemos) { for (demo in runDemos) {
val projectPath = project.projectDir.relativeTo(project.rootDir) val projectPath = project.projectDir.relativeTo(project.rootDir)
lines.add("### ${demo.dropLast(2)}") lines.add("### ${demo.dropLast(2)}")
lines.add("[source code](src/demo/kotlin/${demo.dropLast(2)}.kt)") lines.add("[source code](src/${demoModuleName}/kotlin/${demo.dropLast(2)}.kt)")
lines.add("") lines.add("")
lines.add("![${demo}](https://raw.githubusercontent.com/openrndr/orx/media/$projectPath/images/${demo}.png)") lines.add("![${demo}](https://raw.githubusercontent.com/openrndr/orx/media/$projectPath/images/${demo}.png)")
lines.add("") lines.add("")
@@ -99,18 +108,11 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
} }
object ScreenshotsHelper { object ScreenshotsHelper {
fun KotlinJvmCompilation.collectScreenshots(config: CollectScreenshotsTask.() -> Unit): CollectScreenshotsTask { fun collectScreenshots(
val task = this.project.tasks.register<CollectScreenshotsTask>("collectScreenshots").get() project: Project,
task.outputDir.set(project.file(project.projectDir.toString() + "/images")) sourceSet: SourceSet,
task.inputDir.set(output.classesDirs.first()) config: CollectScreenshotsTask.() -> Unit
task.runtimeDependencies.set(runtimeDependencyFiles) ): CollectScreenshotsTask {
task.config()
task.dependsOn(this.compileKotlinTask)
return task
}
fun collectScreenshots(project: Project, sourceSet: SourceSet, config: CollectScreenshotsTask.() -> Unit): CollectScreenshotsTask {
val task = project.tasks.register<CollectScreenshotsTask>("collectScreenshots").get() val task = project.tasks.register<CollectScreenshotsTask>("collectScreenshots").get()
task.outputDir.set(project.file(project.projectDir.toString() + "/images")) task.outputDir.set(project.file(project.projectDir.toString() + "/images"))
task.inputDir.set(File(project.buildDir, "classes/kotlin/${sourceSet.name}")) task.inputDir.set(File(project.buildDir, "classes/kotlin/${sourceSet.name}"))

View File

@@ -17,10 +17,6 @@ plugins {
repositories { repositories {
mavenCentral() mavenCentral()
maven {
// This is needed to resolve `com.github.ricardomatias:delaunator`
url = URI("https://maven.openrndr.org")
}
mavenLocal() mavenLocal()
} }
@@ -39,6 +35,7 @@ dependencies {
"demoImplementation"(libs.openrndr.application) "demoImplementation"(libs.openrndr.application)
"demoImplementation"(libs.openrndr.extensions) "demoImplementation"(libs.openrndr.extensions)
"demoRuntimeOnly"(libs.openrndr.gl3.core) "demoRuntimeOnly"(libs.openrndr.gl3.core)
"demoRuntimeOnly"(libs.slf4j.simple)
} }
kotlin { kotlin {

View File

@@ -1,5 +1,6 @@
package org.openrndr.extra.convention package org.openrndr.extra.convention
import CollectScreenshotsTask
import org.gradle.accessors.dm.LibrariesForLibs import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -16,10 +17,6 @@ plugins {
repositories { repositories {
mavenCentral() mavenCentral()
maven {
// This is needed to resolve `com.github.ricardomatias:delaunator`
url = URI("https://maven.openrndr.org")
}
mavenLocal() mavenLocal()
} }
@@ -34,13 +31,15 @@ kotlin {
jvm { jvm {
jvmToolchain(libs.versions.jvmTarget.get().toInt()) jvmToolchain(libs.versions.jvmTarget.get().toInt())
compilations { compilations {
val main by getting val main by getting
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val demo by creating { val demo by creating {
defaultSourceSet { associateWith(main)
dependencies { tasks.register<CollectScreenshotsTask>("collectScreenshots") {
implementation(main.output.allOutputs) inputDir.set(output.classesDirs.singleFile)
} runtimeDependencies.set(runtimeDependencyFiles)
outputDir.set(project.file(project.projectDir.toString() + "/images"))
dependsOn(compileKotlinTask)
} }
} }
} }
@@ -84,6 +83,7 @@ kotlin {
implementation(libs.openrndr.application) implementation(libs.openrndr.application)
implementation(libs.openrndr.extensions) implementation(libs.openrndr.extensions)
runtimeOnly(libs.openrndr.gl3.core) runtimeOnly(libs.openrndr.gl3.core)
runtimeOnly(libs.slf4j.simple)
} }
} }
} }

View File

@@ -30,7 +30,6 @@ ktor = "2.0.3"
jgit = "5.12.0.202106070339-r" jgit = "5.12.0.202106070339-r"
javaosc = "0.8" javaosc = "0.8"
javaparser = "3.15.21" javaparser = "3.15.21"
delaunator = "1.0.2"
[libraries] [libraries]
kotlin-logging = { group = "io.github.microutils", name = "kotlin-logging", version.ref = "kotlinLogging" } kotlin-logging = { group = "io.github.microutils", name = "kotlin-logging", version.ref = "kotlinLogging" }
@@ -77,7 +76,6 @@ javaparser-core = { group = "com.github.javaparser", name = "javaparser-core", v
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
antlr-core = { group = "org.antlr", name = "antlr4", version.ref = "antlr" } antlr-core = { group = "org.antlr", name = "antlr4", version.ref = "antlr" }
antlr-runtime = { group = "org.antlr", name = "antlr4-runtime", version.ref = "antlr" } antlr-runtime = { group = "org.antlr", name = "antlr4-runtime", version.ref = "antlr" }
delaunator = { group = "com.github.ricardomatias", name = "delaunator", version.ref = "delaunator" }
jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junitJupiter" } jupiter-api = { group = "org.junit.jupiter", name = "junit-jupiter-api", version.ref = "junitJupiter" }
jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junitJupiter" } jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junitJupiter" }

View File

@@ -1,19 +1,9 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
kotlin { kotlin {
jvm { jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
testRuns["test"].executionTask { testRuns["test"].executionTask {
useJUnitPlatform { useJUnitPlatform {
includeEngines("spek2") includeEngines("spek2")

View File

@@ -1,5 +1,3 @@
import ScreenshotsHelper.collectScreenshots
@Suppress("DSL_SCOPE_VIOLATION") @Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
@@ -11,14 +9,6 @@ plugins {
kotlin { kotlin {
jvm { jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
testRuns["test"].executionTask { testRuns["test"].executionTask {
useJUnitPlatform { useJUnitPlatform {
includeEngines("spek2") includeEngines("spek2")

View File

@@ -1,21 +1,8 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
kotlin { kotlin {
jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
}
sourceSets { sourceSets {
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val commonMain by getting { val commonMain by getting {
@@ -30,15 +17,6 @@ kotlin {
} }
} }
@Suppress("UNUSED_VARIABLE")
val jvmTest by getting {
dependencies {
implementation(libs.spek.dsl)
implementation(libs.kluent)
}
}
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val jvmDemo by getting { val jvmDemo by getting {
dependencies { dependencies {

View File

@@ -1,21 +1,8 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
kotlin { kotlin {
jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
}
sourceSets { sourceSets {
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val commonMain by getting { val commonMain by getting {

View File

@@ -1,5 +1,3 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
@@ -14,17 +12,6 @@ val embedShaders = tasks.register<EmbedShadersTask>("embedShaders") {
kotlin { kotlin {
jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
}
sourceSets { sourceSets {
val shaderKotlin by creating { val shaderKotlin by creating {
this.kotlin.srcDir(embedShaders.outputDir) this.kotlin.srcDir(embedShaders.outputDir)
@@ -45,15 +32,6 @@ kotlin {
dependsOn(shaderKotlin) dependsOn(shaderKotlin)
} }
@Suppress("UNUSED_VARIABLE")
val jvmTest by getting {
dependencies {
implementation(libs.spek.dsl)
implementation(libs.kluent)
}
}
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val jvmDemo by getting { val jvmDemo by getting {
dependencies { dependencies {

View File

@@ -1,21 +1,8 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
kotlin { kotlin {
jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
}
sourceSets { sourceSets {
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val commonMain by getting { val commonMain by getting {

View File

@@ -1,5 +1,3 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
@@ -12,19 +10,7 @@ val embedShaders = tasks.register<EmbedShadersTask>("embedShaders") {
namePrefix.set("jf_") namePrefix.set("jf_")
}.get() }.get()
kotlin { kotlin {
jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
}
sourceSets { sourceSets {
val shaderKotlin by creating { val shaderKotlin by creating {
this.kotlin.srcDir(embedShaders.outputDir) this.kotlin.srcDir(embedShaders.outputDir)
@@ -44,15 +30,6 @@ kotlin {
dependsOn(shaderKotlin) dependsOn(shaderKotlin)
} }
@Suppress("UNUSED_VARIABLE")
val jvmTest by getting {
dependencies {
implementation(libs.spek.dsl)
implementation(libs.kluent)
}
}
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val jvmDemo by getting { val jvmDemo by getting {
dependencies { dependencies {

View File

@@ -2,7 +2,6 @@ import org.openrndr.application
import org.openrndr.draw.ColorFormat import org.openrndr.draw.ColorFormat
import org.openrndr.draw.ColorType import org.openrndr.draw.ColorType
import org.openrndr.draw.colorBuffer import org.openrndr.draw.colorBuffer
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.jumpfill.ShapeSDF import org.openrndr.extra.jumpfill.ShapeSDF
import org.openrndr.svg.loadSVG import org.openrndr.svg.loadSVG
@@ -16,7 +15,7 @@ fun main() {
val sdf = ShapeSDF() val sdf = ShapeSDF()
val df = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32) val df = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape } val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
sdf.setShapes(shapes) sdf.setShapes(shapes)
sdf.apply(emptyArray(), df) sdf.apply(emptyArray(), df)

View File

@@ -3,10 +3,10 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.draw.ColorFormat import org.openrndr.draw.ColorFormat
import org.openrndr.draw.ColorType import org.openrndr.draw.ColorType
import org.openrndr.draw.colorBuffer import org.openrndr.draw.colorBuffer
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.jumpfill.ShapeSDF import org.openrndr.extra.jumpfill.ShapeSDF
import org.openrndr.extra.jumpfill.draw.SDFStrokeFill import org.openrndr.extra.jumpfill.draw.SDFStrokeFill
import org.openrndr.extra.jumpfill.ops.* import org.openrndr.extra.jumpfill.ops.SDFOnion
import org.openrndr.extra.jumpfill.ops.SDFSmoothIntersection
import org.openrndr.math.Vector3 import org.openrndr.math.Vector3
import org.openrndr.math.transforms.transform import org.openrndr.math.transforms.transform
import org.openrndr.svg.loadSVG import org.openrndr.svg.loadSVG
@@ -25,7 +25,7 @@ fun main() {
val sdf1 = ShapeSDF() val sdf1 = ShapeSDF()
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32) val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape } val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
val union = SDFSmoothIntersection() val union = SDFSmoothIntersection()
val onion = SDFOnion() val onion = SDFOnion()
@@ -53,7 +53,7 @@ fun main() {
onion.radius = 20.0 onion.radius = 20.0
onion.apply(df0, df0) onion.apply(df0, df0)
strokeFill.strokeWeight = 2.0 strokeFill.strokeWeight = 2.0
strokeFill.apply(df0, df0); strokeFill.apply(df0, df0)
drawer.image(df0) drawer.image(df0)
} }
} }

View File

@@ -3,11 +3,10 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.draw.ColorFormat import org.openrndr.draw.ColorFormat
import org.openrndr.draw.ColorType import org.openrndr.draw.ColorType
import org.openrndr.draw.colorBuffer import org.openrndr.draw.colorBuffer
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.fx.distort.FluidDistort import org.openrndr.extra.fx.distort.FluidDistort
import org.openrndr.extra.jumpfill.ShapeSDF import org.openrndr.extra.jumpfill.ShapeSDF
import org.openrndr.extra.jumpfill.draw.SDFStrokeFill import org.openrndr.extra.jumpfill.draw.SDFStrokeFill
import org.openrndr.extra.jumpfill.ops.* import org.openrndr.extra.jumpfill.ops.SDFSmoothDifference
import org.openrndr.svg.loadSVG import org.openrndr.svg.loadSVG
fun main() { fun main() {
@@ -27,7 +26,7 @@ fun main() {
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16) val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape } val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
val union = SDFSmoothDifference() val union = SDFSmoothDifference()
sdf0.setShapes(shapes) sdf0.setShapes(shapes)
@@ -47,7 +46,7 @@ fun main() {
union.apply(arrayOf(df0, df1), df0) union.apply(arrayOf(df0, df1), df0)
strokeFill.strokeWeight = 10.0 strokeFill.strokeWeight = 10.0
strokeFill.apply(df0, df0); strokeFill.apply(df0, df0)
drawer.image(df0) drawer.image(df0)
} }
} }

View File

@@ -3,12 +3,11 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.draw.ColorFormat import org.openrndr.draw.ColorFormat
import org.openrndr.draw.ColorType import org.openrndr.draw.ColorType
import org.openrndr.draw.colorBuffer import org.openrndr.draw.colorBuffer
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.fx.distort.Perturb import org.openrndr.extra.fx.distort.Perturb
import org.openrndr.extra.gui.GUI import org.openrndr.extra.gui.GUI
import org.openrndr.extra.jumpfill.ShapeSDF import org.openrndr.extra.jumpfill.ShapeSDF
import org.openrndr.extra.jumpfill.draw.SDFStrokeFill import org.openrndr.extra.jumpfill.draw.SDFStrokeFill
import org.openrndr.extra.jumpfill.ops.* import org.openrndr.extra.jumpfill.ops.SDFSmoothDifference
import org.openrndr.shape.Circle import org.openrndr.shape.Circle
import org.openrndr.svg.loadSVG import org.openrndr.svg.loadSVG
@@ -31,7 +30,7 @@ fun main() {
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16) val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
val circleShapes = List(1) { Circle(width/2.0, height/2.0, 200.0).shape} val circleShapes = List(1) { Circle(width/2.0, height/2.0, 200.0).shape}
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape } val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
sdf0.setShapes(circleShapes) sdf0.setShapes(circleShapes)
sdf1.setShapes(shapes) sdf1.setShapes(shapes)
@@ -54,7 +53,7 @@ fun main() {
difference.apply(arrayOf(df0, df1), df0) difference.apply(arrayOf(df0, df1), df0)
strokeFill.strokeWeight = 10.0 strokeFill.strokeWeight = 10.0
strokeFill.apply(df0, df0); strokeFill.apply(df0, df0)
drawer.image(df0) drawer.image(df0)
} }
} }

View File

@@ -7,7 +7,7 @@ import org.openrndr.extra.fx.distort.Perturb
import org.openrndr.extra.gui.GUI import org.openrndr.extra.gui.GUI
import org.openrndr.extra.jumpfill.ShapeSDF import org.openrndr.extra.jumpfill.ShapeSDF
import org.openrndr.extra.jumpfill.draw.SDFStrokeFill import org.openrndr.extra.jumpfill.draw.SDFStrokeFill
import org.openrndr.extra.jumpfill.ops.* import org.openrndr.extra.jumpfill.ops.SDFSmoothDifference
import org.openrndr.math.Vector2 import org.openrndr.math.Vector2
import org.openrndr.shape.Circle import org.openrndr.shape.Circle
import org.openrndr.svg.loadSVG import org.openrndr.svg.loadSVG
@@ -35,7 +35,7 @@ fun main() {
val uvmap2 = colorBuffer(width, height, type = ColorType.FLOAT16) val uvmap2 = colorBuffer(width, height, type = ColorType.FLOAT16)
val circleShapes = List(1) { Circle(width/2.0, height/2.0, 200.0).shape} val circleShapes = List(1) { Circle(width/2.0, height/2.0, 200.0).shape}
val shapes = loadSVG("orx-jumpflood/src/demo/resources/name.svg").findShapes().map { it.shape } val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
sdf0.setShapes(circleShapes) sdf0.setShapes(circleShapes)
sdf1.setShapes(shapes) sdf1.setShapes(shapes)
@@ -67,7 +67,7 @@ fun main() {
difference.apply(arrayOf(df0, df1), df0) difference.apply(arrayOf(df0, df1), df0)
strokeFill.apply(df0, df0); strokeFill.apply(df0, df0)
drawer.image(df0) drawer.image(df0)
} }
} }

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -3,16 +3,6 @@ plugins {
} }
kotlin { kotlin {
jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
}
}
sourceSets { sourceSets {
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val commonMain by getting { val commonMain by getting {

View File

@@ -2,7 +2,6 @@ import org.openrndr.application
import org.openrndr.color.ColorHSLa import org.openrndr.color.ColorHSLa
import org.openrndr.color.rgb import org.openrndr.color.rgb
import org.openrndr.draw.isolated import org.openrndr.draw.isolated
import org.openrndr.extensions.SingleScreenshot
import org.openrndr.extra.noclear.NoClear import org.openrndr.extra.noclear.NoClear
import org.openrndr.math.Polar import org.openrndr.math.Polar
import org.openrndr.shape.contour import org.openrndr.shape.contour

View File

@@ -1,5 +1,3 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
@@ -14,14 +12,6 @@ val embedShaders = tasks.register<EmbedShadersTask>("embedShaders") {
kotlin { kotlin {
jvm { jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
testRuns["test"].executionTask { testRuns["test"].executionTask {
useJUnitPlatform { useJUnitPlatform {
includeEngines("spek2") includeEngines("spek2")

View File

@@ -1,21 +1,8 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
kotlin { kotlin {
jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
}
sourceSets { sourceSets {
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val commonMain by getting { val commonMain by getting {

View File

@@ -1,21 +1,8 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
kotlin { kotlin {
jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
}
sourceSets { sourceSets {
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val commonMain by getting { val commonMain by getting {
@@ -30,7 +17,6 @@ kotlin {
} }
} }
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val jvmDemo by getting { val jvmDemo by getting {
dependencies { dependencies {

View File

@@ -1,19 +1,9 @@
import ScreenshotsHelper.collectScreenshots
plugins { plugins {
org.openrndr.extra.convention.`kotlin-multiplatform` org.openrndr.extra.convention.`kotlin-multiplatform`
} }
kotlin { kotlin {
jvm { jvm {
@Suppress("UNUSED_VARIABLE")
val demo by compilations.getting {
// TODO: Move demos to /jvmDemo
defaultSourceSet {
kotlin.srcDir("src/demo/kotlin")
}
collectScreenshots { }
}
testRuns["test"].executionTask { testRuns["test"].executionTask {
useJUnitPlatform { useJUnitPlatform {
includeEngines("spek2") includeEngines("spek2")
@@ -42,7 +32,6 @@ kotlin {
} }
} }
@Suppress("UNUSED_VARIABLE") @Suppress("UNUSED_VARIABLE")
val jvmTest by getting { val jvmTest by getting {
dependencies { dependencies {

Some files were not shown because too many files have changed in this diff Show More