@@ -1,8 +1,7 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
group = "org.openrndr.template"
|
||||
version = "1.0.0"
|
||||
@@ -15,18 +14,14 @@ val orxFeatures = setOf<String>(
|
||||
"orx-camera",
|
||||
// "orx-chataigne",
|
||||
"orx-color",
|
||||
// "orx-composition",
|
||||
"orx-compositor",
|
||||
// "orx-compute-graph",
|
||||
// "orx-compute-graph-nodes",
|
||||
"orx-delegate-magic",
|
||||
"orx-depth-camera-calibrator",
|
||||
// "orx-dnk3",
|
||||
// "orx-easing",
|
||||
"orx-envelopes",
|
||||
// "orx-expression-evaluator",
|
||||
// "orx-fcurve",
|
||||
// "orx-fft",
|
||||
// "orx-file-watcher",
|
||||
"orx-fx",
|
||||
// "orx-git-archiver",
|
||||
@@ -39,7 +34,7 @@ val orxFeatures = setOf<String>(
|
||||
// "orx-jumpflood",
|
||||
// "orx-kdtree",
|
||||
// "orx-keyframer",
|
||||
"orx-kinect-v1",
|
||||
// "orx-kinect-v1",
|
||||
// "orx-kotlin-parser",
|
||||
// "orx-marching-squares",
|
||||
// "orx-mesh-generators",
|
||||
@@ -62,11 +57,9 @@ val orxFeatures = setOf<String>(
|
||||
"orx-shade-styles",
|
||||
// "orx-shader-phrases",
|
||||
"orx-shapes",
|
||||
// "orx-svg",
|
||||
// "orx-syphon",
|
||||
// "orx-temporal-blur",
|
||||
// "orx-tensorflow",
|
||||
// "orx-text-writer",
|
||||
// "orx-time-operators",
|
||||
// "orx-timer",
|
||||
// "orx-triangulation",
|
||||
@@ -121,17 +114,6 @@ dependencies {
|
||||
// implementation(libs.gson)
|
||||
// implementation(libs.csv)
|
||||
|
||||
/* ORSL dependencies */
|
||||
|
||||
// implementation(libs.orsl.shader.generator)
|
||||
// implementation(libs.orsl.extension.color)
|
||||
// implementation(libs.orsl.extension.easing)
|
||||
// implementation(libs.orsl.extension.gradient)
|
||||
// implementation(libs.orsl.extension.noise)
|
||||
// implementation(libs.orsl.extension.pbr)
|
||||
// implementation(libs.orsl.extension.raymarching)
|
||||
// implementation(libs.orsl.extension.sdf)
|
||||
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.slf4j.api)
|
||||
implementation(libs.kotlin.logging)
|
||||
@@ -157,15 +139,11 @@ dependencies {
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
languageVersion = KotlinVersion.KOTLIN_2_0
|
||||
apiVersion = KotlinVersion.KOTLIN_2_0
|
||||
jvmTarget = JvmTarget.JVM_17
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "11"
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
@@ -174,7 +152,7 @@ project.setProperty("mainClassName", applicationMainClass)
|
||||
|
||||
application {
|
||||
if (hasProperty("openrndr.application")) {
|
||||
mainClass = "${property("openrndr.application")}"
|
||||
mainClass.set("${property("openrndr.application")}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +191,7 @@ tasks {
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
tasks.register<Zip>("jpackageZip") {
|
||||
archiveFileName = "openrndr-application.zip"
|
||||
archiveFileName.set("openrndr-application.zip")
|
||||
from("${layout.buildDirectory.get()}/jpackage") {
|
||||
include("**/*")
|
||||
}
|
||||
@@ -231,14 +209,14 @@ runtime {
|
||||
jvmArgs.add("-Duser.dir=${"$"}APPDIR/../Resources")
|
||||
}
|
||||
}
|
||||
options = listOf("--strip-debug", "--compress", "1", "--no-header-files", "--no-man-pages")
|
||||
modules = listOf("jdk.unsupported", "java.management", "java.desktop")
|
||||
options.set(listOf("--strip-debug", "--compress", "1", "--no-header-files", "--no-man-pages"))
|
||||
modules.set(listOf("jdk.unsupported", "java.management", "java.desktop"))
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
|
||||
tasks.register<org.openrndr.extra.gitarchiver.GitArchiveToMarkdown>("gitArchiveToMarkDown") {
|
||||
historySize = 20
|
||||
historySize.set(20)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------------ //
|
||||
@@ -308,6 +286,7 @@ class Openrndr {
|
||||
implementation(openrndr("openal"))
|
||||
runtimeOnly(openrndrNatives("openal"))
|
||||
implementation(openrndr("application"))
|
||||
implementation(openrndr("svg"))
|
||||
implementation(openrndr("animatable"))
|
||||
implementation(openrndr("extensions"))
|
||||
implementation(openrndr("filter"))
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,91 +1,31 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.ColorFormat
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.extra.fx.colormap.GrayscaleColormap
|
||||
import org.openrndr.extra.fx.colormap.SpectralZucconiColormap
|
||||
import org.openrndr.extra.fx.colormap.TurboColormap
|
||||
import org.openrndr.extra.gui.GUI
|
||||
import org.openrndr.extra.kinect.v1.Kinect1
|
||||
import org.openrndr.extra.parameters.BooleanParameter
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.loadFont
|
||||
import org.openrndr.draw.loadImage
|
||||
import org.openrndr.draw.tint
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
/**
|
||||
* Shows 4 different color representations of the depth map:
|
||||
*
|
||||
* * the original depth map stored as RED channel values
|
||||
* * the same values expressed as gray tones
|
||||
* * zucconi6 color map according to natural light dispersion as described
|
||||
* by Alan Zucconi in
|
||||
* [Improving the Rainbow](https://www.alanzucconi.com/2017/07/15/improving-the-rainbow/)
|
||||
* article
|
||||
* * turbo color map according to
|
||||
* [Turbo, An Improved Rainbow Colormap for Visualization](https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html)
|
||||
* by Google.
|
||||
*
|
||||
* Note: the values are normalized in range 0-1, not in meters.
|
||||
* @see GrayscaleColormap
|
||||
* @see SpectralZucconiColormap
|
||||
* @see TurboColormap
|
||||
*/
|
||||
fun main() = application {
|
||||
val guiOffset = 200
|
||||
configure {
|
||||
width = 2 * 640 + guiOffset
|
||||
height = 2 * 480
|
||||
width = 768
|
||||
height = 576
|
||||
}
|
||||
|
||||
program {
|
||||
val kinect = extend(Kinect1())
|
||||
val device = kinect.openDevice()
|
||||
val camera = device.depthCamera
|
||||
fun outputBuffer() = colorBuffer(
|
||||
camera.resolution.x,
|
||||
camera.resolution.y,
|
||||
format = ColorFormat.RGB
|
||||
)
|
||||
val grayscaleColormap = GrayscaleColormap()
|
||||
val spectralZucconiColormap = SpectralZucconiColormap()
|
||||
val turboColormap = TurboColormap()
|
||||
val grayscaleBuffer = outputBuffer()
|
||||
val zucconiBuffer = outputBuffer()
|
||||
val turboBuffer = outputBuffer()
|
||||
@Suppress("unused")
|
||||
val settings = object {
|
||||
val image = loadImage("data/images/pm5544.png")
|
||||
val font = loadFont("data/fonts/default.otf", 64.0)
|
||||
|
||||
@BooleanParameter(label = "enabled", order = 0)
|
||||
var enabled: Boolean
|
||||
get() = camera.enabled
|
||||
set(value) { camera.enabled = value }
|
||||
|
||||
@BooleanParameter(label = "flipH", order = 1)
|
||||
var flipH: Boolean
|
||||
get() = camera.flipH
|
||||
set(value) { camera.flipH = value }
|
||||
|
||||
@BooleanParameter(label = "flipV", order = 2)
|
||||
var flipV: Boolean
|
||||
get() = camera.flipV
|
||||
set(value) { camera.flipV = value }
|
||||
|
||||
}
|
||||
camera.onFrameReceived { frame ->
|
||||
grayscaleColormap.apply(frame, grayscaleBuffer)
|
||||
spectralZucconiColormap.apply(frame, zucconiBuffer)
|
||||
turboColormap.apply(frame, turboBuffer)
|
||||
}
|
||||
camera.enabled = true
|
||||
extend(GUI()) {
|
||||
persistState = false
|
||||
compartmentsCollapsedByDefault = false
|
||||
add(settings, label = "depth camera")
|
||||
add(grayscaleColormap)
|
||||
add(spectralZucconiColormap)
|
||||
add(turboColormap)
|
||||
}
|
||||
extend {
|
||||
drawer.image(camera.currentFrame, guiOffset.toDouble(), 0.0)
|
||||
drawer.image(grayscaleBuffer, guiOffset + camera.resolution.x.toDouble(), 0.0)
|
||||
drawer.image(turboBuffer, guiOffset.toDouble(), camera.resolution.y.toDouble())
|
||||
drawer.image(zucconiBuffer, Vector2(guiOffset.toDouble(), 0.0) + camera.resolution.vector2)
|
||||
drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(0.2))
|
||||
drawer.image(image)
|
||||
|
||||
drawer.fill = ColorRGBa.PINK
|
||||
drawer.circle(cos(seconds) * width / 2.0 + width / 2.0, sin(0.5 * seconds) * height / 2.0 + height / 2.0, 140.0)
|
||||
|
||||
drawer.fontMap = font
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.text("OPENRNDR", width / 2.0, height / 2.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user