Demos: ensure all use fun main() = application {

- Adjust some demo window sizes.
- Replace Random.double by Double.uniform
- Tweak some demos so screenshots look more interesting
This commit is contained in:
Abe Pazos
2025-01-26 20:57:04 +01:00
parent 1975a820fc
commit c8f7dd52c6
116 changed files with 2889 additions and 2942 deletions

View File

@@ -6,29 +6,27 @@ import org.openrndr.draw.colorBuffer
import org.openrndr.draw.tint
import org.openrndr.extra.realsense2.RS2Sensor
fun main() {
application {
program {
val sensors = RS2Sensor.listSensors()
val depthFrame = colorBuffer(640, 480, format = ColorFormat.R, type = ColorType.UINT16)
for (sensor in sensors) {
println(sensor)
}
val sensor = RS2Sensor.openFirstOrDummy()
fun main() = application {
program {
val sensors = RS2Sensor.listSensors()
val depthFrame = colorBuffer(640, 480, format = ColorFormat.R, type = ColorType.UINT16)
for (sensor in sensors) {
println(sensor)
for (stream in sensor.streams) {
println(stream.intrinsics)
}
}
val sensor = RS2Sensor.openFirstOrDummy()
println(sensor)
for (stream in sensor.streams) {
println(stream.intrinsics)
}
sensor.depthFrameReceived.listen {
it.copyTo(depthFrame)
}
extend {
sensor.waitForFrames()
drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(20.0))
drawer.image(depthFrame)
}
sensor.depthFrameReceived.listen {
it.copyTo(depthFrame)
}
extend {
sensor.waitForFrames()
drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(20.0))
drawer.image(depthFrame)
}
}
}
}

View File

@@ -11,35 +11,33 @@ import org.openrndr.extra.realsense2.RS2Sensor
*
* Tested with two sensors, only uses depth stream now
*/
fun main() {
application {
configure {
width = 1280
height = 720
fun main() = application {
configure {
width = 1280
height = 720
}
program {
val sensorDescriptions = RS2Sensor.listSensors()
val sensors = sensorDescriptions.map {
it.open()
}
program {
val sensorDescriptions = RS2Sensor.listSensors()
val sensors = sensorDescriptions.map {
it.open()
val depthFrames = sensors.map {
colorBuffer(640, 480, format = ColorFormat.R, type = ColorType.UINT16)
}
sensors.forEachIndexed { index, it ->
it.depthFrameReceived.listen {
it.copyTo(depthFrames[index])
}
val depthFrames = sensors.map {
colorBuffer(640, 480, format = ColorFormat.R, type = ColorType.UINT16)
}
sensors.forEachIndexed { index, it ->
it.depthFrameReceived.listen {
it.copyTo(depthFrames[index])
}
}
extend {
drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(20.0))
for ((index, sensor) in sensors.withIndex()) {
sensor.waitForFrames()
drawer.image(depthFrames[index])
drawer.translate(640.0, 0.0)
}
}
extend {
drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(20.0))
for ((index, sensor) in sensors.withIndex()) {
sensor.waitForFrames()
drawer.image(depthFrames[index])
drawer.translate(640.0, 0.0)
}
}
}
}
}

View File

@@ -1,9 +1,7 @@
import org.openrndr.application
fun main() {
application {
program {
fun main() = application {
program {
}
}
}
}