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

@@ -0,0 +1,38 @@
import org.openrndr.Program
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.viewbox.viewBox
import org.openrndr.math.Vector2
import kotlin.math.cos
fun Program.program01() {
var color: ColorRGBa by this.userProperties
color = ColorRGBa.WHITE
var someFunction : ()->Unit by this.userProperties
someFunction = {
color = ColorRGBa(Math.random(), Math.random(), Math.random())
}
extend {
drawer.fill = color
drawer.circle(Vector2(width/2.0, height/2.0), cos(seconds) * 50.0 + 50.0)
}
}
fun main() {
application {
program {
val proxyBox = viewBox(drawer.bounds).apply { program01() }
var color: ColorRGBa by proxyBox.userProperties
var someFunction: () -> Unit by proxyBox.userProperties
color = ColorRGBa.PINK
extend {
if (Math.random() < 0.01) {
someFunction()
}
proxyBox.draw()
}
}
}
}

View File

@@ -0,0 +1,66 @@
import org.openrndr.application
import org.openrndr.draw.BufferMultisample
import org.openrndr.draw.DrawPrimitive
import org.openrndr.extensions.Screenshots
import org.openrndr.extra.camera.Camera2D
import org.openrndr.extra.camera.Orbital
import org.openrndr.extra.fx.Post
import org.openrndr.extra.fx.blur.ApproximateGaussianBlur
import org.openrndr.extra.meshgenerators.boxMesh
import org.openrndr.extra.viewbox.viewBox
import org.openrndr.shape.Rectangle
fun main() {
application {
configure {
width = 800
height = 800
}
program {
val vbx = viewBox(Rectangle(0.0, 0.0, 200.0, 800.0)) {
extend(Screenshots())
extend(Camera2D()).also {
shouldDraw = { it.hasChanged }
}
extend {
drawer.rectangle(20.0, 20.0, 100.0, 100.0)
}
}
val vbx2 = viewBox(Rectangle(200.0, 0.0, 200.0, 800.0)) {
extend(Post()) {
val blur = ApproximateGaussianBlur()
blur.sigma = 10.0
blur.window = 25
post { i, o ->
blur.apply(i, o)
}
}
extend(Camera2D())
extend {
drawer.rectangle(20.0, 20.0, 100.0, 100.0)
drawer.circle(mouse.position, 10.0)
}
}
val vbx3d = viewBox(Rectangle(400.0, 0.0, 400.0, 800.0), multisample = BufferMultisample.SampleCount(8)) {
extend(Orbital()).also {
this.shouldDraw = {
it.hasChanged
}
}
val cube = boxMesh()
extend {
drawer.vertexBuffer(cube, DrawPrimitive.TRIANGLES)
}
}
extend {
vbx.draw()
vbx2.draw()
vbx3d.draw()
}
}
}
}