Upgrade to OPENRNDR 0.4 snapshot

This commit is contained in:
Edwin Jakobs
2021-06-22 11:08:07 +02:00
parent 579ddf9bb5
commit 9435907ef9
339 changed files with 460 additions and 497 deletions

View File

@@ -17,7 +17,7 @@ dependencies {
demoImplementation(project(":orx-shader-phrases"))
demoImplementation("org.slf4j:slf4j-simple:1.7.30")
demoImplementation("org.openrndr:openrndr-core:$openrndrVersion")
demoImplementation("org.openrndr:openrndr-application:$openrndrVersion")
demoImplementation("org.openrndr:openrndr-extensions:$openrndrVersion")
demoImplementation("org.openrndr:openrndr-ffmpeg:$openrndrVersion")
demoImplementation("org.openrndr:openrndr-svg:$openrndrVersion")

View File

@@ -2,7 +2,7 @@
import org.openrndr.application
import org.openrndr.draw.loadImage
fun main() {
suspend fun main() {
application {
program {
val image16 = loadImage("demo-data/images/16-bit.png")

View File

@@ -4,7 +4,7 @@ import org.openrndr.application
import org.openrndr.math.Vector2
import org.openrndr.shape.contour
fun main() = application {
suspend fun main() = application {
program {
class A: Animatable() {
var x = 0.0

View File

@@ -4,7 +4,7 @@ import org.openrndr.application
import org.openrndr.math.Vector2
import org.openrndr.shape.contour
fun main() = application {
suspend fun main() = application {
program {
val a = object {
var x = 0.0

View File

@@ -1,7 +1,7 @@
import org.openrndr.application
import org.openrndr.internal.colorBufferLoader
fun main() {
suspend fun main() {
application {
program {
extend {

View File

@@ -10,7 +10,7 @@ import org.openrndr.math.Vector2
import org.openrndr.math.Vector3
fun main() = application {
suspend fun main() = application {
configure {
multisample = WindowMultisample.SampleCount(8)

View File

@@ -7,7 +7,7 @@ import org.openrndr.math.Polar
import org.openrndr.shape.ShapeContour
import org.openrndr.shape.toContour
fun main() = application {
suspend fun main() = application {
program {
val points = List(6) { Polar(it * 70.0, 100.0).cartesian + drawer.bounds.center }
val cmr = CatmullRomChain2(points, 1.0, loop = true)

View File

@@ -4,7 +4,7 @@ import org.openrndr.color.ColorRGBa
/*
This demo just verifies that drawing a single circle still works with revamped circle drawing code
*/
fun main() = application {
suspend fun main() = application {
program {
extend {
drawer.clear(ColorRGBa.GRAY)

View File

@@ -11,7 +11,7 @@ Batches are (currently) static but stored in GPU memory but can be
animated using a vertex shader. Batches are fast to draw.
*/
fun main() = application {
suspend fun main() = application {
program {
val batch = drawer.circleBatch {
for (i in 0 until 2000) {

View File

@@ -8,7 +8,7 @@ import kotlin.math.abs
This program demonstrates dynamic circle batches
*/
fun main() = application {
suspend fun main() = application {
program {
extend {

View File

@@ -3,7 +3,7 @@ import org.openrndr.draw.*
import org.openrndr.extras.camera.Orbital
import org.openrndr.extras.meshgenerators.boxMesh
fun main() = application {
suspend fun main() = application {
program {
val cb0 = loadImage("demo-data/images/image-001.png")
val cb1 = cb0.createEquivalent()

View File

@@ -6,7 +6,7 @@ import org.openrndr.shape.drawComposition
import org.openrndr.svg.toSVG
import org.openrndr.svg.writeSVG
fun main() {
suspend fun main() {
application {
program {
extend {

View File

@@ -3,7 +3,7 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.shape.ClipMode
import org.openrndr.shape.drawComposition
fun main() {
suspend fun main() {
application {
program {
val cd = drawComposition {

View File

@@ -3,7 +3,7 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.shape.ClipMode
import org.openrndr.shape.drawComposition
fun main() {
suspend fun main() {
application {
program {
val cd = drawComposition {

View File

@@ -7,7 +7,7 @@ import org.openrndr.shape.Circle
*
* This was made to assist in resolving https://github.com/openrndr/openrndr/issues/164
*/
fun main() = application {
suspend fun main() = application {
program {
val c = Circle(200.0, 200.0, 10.0).contour
extend {

View File

@@ -18,7 +18,7 @@ fun arc(start: Vector2, end: Vector2, radius: Double): ShapeContour {
}
}
fun main() = application {
suspend fun main() = application {
configure {
width = 800
height = 800

View File

@@ -4,7 +4,7 @@ import org.openrndr.draw.isolated
import org.openrndr.shape.Circle
import org.openrndr.shape.Rectangle
fun main() {
suspend fun main() {
application {
configure {
width = 720

View File

@@ -1,37 +1,37 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.shape.Ellipse
import org.openrndr.shape.OrientedEllipse
import org.openrndr.shape.intersections
fun main() {
application {
program {
val c1 = Ellipse(width / 2.0, height / 2.0, 200.0, 100.0).contour
extend {
drawer.clear(ColorRGBa.PINK)
drawer.fill = null
val c2 = OrientedEllipse(mouse.position, 100.0, 200.0, seconds*45.0).contour
drawer.contour(c1)
//drawer.contour(c2)
val ints = intersections(c1, c2)
if (ints.isEmpty()) {
drawer.contour(c2)
} else {
(ints + ints.take(1)).map { it.b.contourT }.zipWithNext().forEach {
val end = if (it.second <= it.first) it.second + 1.0 else it.second
val sub = c2.sub(it.first, end)
val l = sub.length
val ta = sub.tForLength(15.0)
val tb = sub.tForLength(l - 15.0)
drawer.contour(sub.sub(ta, tb))
}
}
for (i in ints) {
drawer.circle(i.position, 10.0)
}
}
}
}
}
//import org.openrndr.application
//import org.openrndr.color.ColorRGBa
//import org.openrndr.shape.Ellipse
//import org.openrndr.shape.OrientedEllipse
//import org.openrndr.shape.intersections
//
//fun main() {
// application {
// program {
// val c1 = Ellipse(width / 2.0, height / 2.0, 200.0, 100.0).contour
// extend {
// drawer.clear(ColorRGBa.PINK)
// drawer.fill = null
// val c2 = OrientedEllipse(mouse.position, 100.0, 200.0, seconds*45.0).contour
// drawer.contour(c1)
// //drawer.contour(c2)
// val ints = intersections(c1, c2)
//
// if (ints.isEmpty()) {
// drawer.contour(c2)
// } else {
// (ints + ints.take(1)).map { it.b.contourT }.zipWithNext().forEach {
// val end = if (it.second <= it.first) it.second + 1.0 else it.second
// val sub = c2.sub(it.first, end)
// val l = sub.length
// val ta = sub.tForLength(15.0)
// val tb = sub.tForLength(l - 15.0)
// drawer.contour(sub.sub(ta, tb))
// }
// }
// for (i in ints) {
// drawer.circle(i.position, 10.0)
// }
// }
// }
// }
//}

View File

@@ -5,7 +5,7 @@ import org.openrndr.shape.Circle
import org.openrndr.shape.Rectangle
import org.openrndr.shape.intersections
fun main() {
suspend fun main() {
application {
program {
extend {

View File

@@ -8,7 +8,7 @@ import kotlin.math.PI
import kotlin.math.cos
import kotlin.math.sin
fun main() = application {
suspend fun main() = application {
program {
val points = 200
extend {

View File

@@ -1,54 +1,54 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.noise.simplex
import org.openrndr.shape.OrientedEllipse
fun main() {
application {
program {
extend {
drawer.clear(ColorRGBa.BLACK)
drawer.fill = null
val offset = seconds * 0.1
val contours = listOf(
OrientedEllipse(
simplex(320, offset)*width/2.0 + width/2.0,
simplex(3120, offset)*height/2.0 + height/2.0,
simplex(3420, offset)*50.0 + 80.0,
simplex(7521, offset)*50.0+ 80.0,
simplex(3212, offset)*180.0+180.0
).contour,
OrientedEllipse(
simplex(5320, offset)*width/2.0 + width/2.0,
simplex(73120, offset)*height/2.0 + height/2.0,
simplex(23420, offset)*50.0 + 80.0,
simplex(47521, offset)*50.0+ 80.0,
simplex(33212, offset)*180.0+180.0
).contour
)
drawer.fill = null
drawer.stroke = ColorRGBa.PINK
for (contour in contours) {
drawer.contour(contour)
}
for (j in contours.indices) {
for (i in 0 until j) {
val eqj = contours[j].equidistantPositions(50)
val eqi = contours[i].equidistantPositions(50)
for (p in eqj) {
val q = contours[i].nearest(p).position
drawer.lineSegment(p, q)
}
for (p in eqi) {
val q = contours[j].nearest(p).position
drawer.lineSegment(p, q)
}
}
}
}
}
}
}
//import org.openrndr.application
//import org.openrndr.color.ColorRGBa
//import org.openrndr.extra.noise.simplex
//import org.openrndr.shape.OrientedEllipse
//
//fun main() {
// application {
// program {
// extend {
// drawer.clear(ColorRGBa.BLACK)
// drawer.fill = null
//
// val offset = seconds * 0.1
// val contours = listOf(
// OrientedEllipse(
// simplex(320, offset)*width/2.0 + width/2.0,
// simplex(3120, offset)*height/2.0 + height/2.0,
// simplex(3420, offset)*50.0 + 80.0,
// simplex(7521, offset)*50.0+ 80.0,
// simplex(3212, offset)*180.0+180.0
// ).contour,
// OrientedEllipse(
// simplex(5320, offset)*width/2.0 + width/2.0,
// simplex(73120, offset)*height/2.0 + height/2.0,
// simplex(23420, offset)*50.0 + 80.0,
// simplex(47521, offset)*50.0+ 80.0,
// simplex(33212, offset)*180.0+180.0
// ).contour
// )
// drawer.fill = null
// drawer.stroke = ColorRGBa.PINK
// for (contour in contours) {
// drawer.contour(contour)
// }
//
// for (j in contours.indices) {
// for (i in 0 until j) {
// val eqj = contours[j].equidistantPositions(50)
// val eqi = contours[i].equidistantPositions(50)
//
// for (p in eqj) {
// val q = contours[i].nearest(p).position
// drawer.lineSegment(p, q)
// }
// for (p in eqi) {
// val q = contours[j].nearest(p).position
// drawer.lineSegment(p, q)
// }
// }
// }
// }
// }
// }
//}

View File

@@ -6,7 +6,7 @@ import org.openrndr.draw.shadeStyle
import org.openrndr.extras.camera.Orbital
import org.openrndr.extras.meshgenerators.boxMesh
fun main() = application {
suspend fun main() = application {
program {
val cubemap = Cubemap.fromUrl("file:demo-data/cubemaps/garage_iem.dds", null, session = Session.active)

View File

@@ -3,7 +3,7 @@ import org.openrndr.draw.*
import org.openrndr.extras.camera.Orbital
import org.openrndr.extras.meshgenerators.boxMesh
fun main() = application {
suspend fun main() = application {
program {
val cubemap1 = Cubemap.fromUrl("file:demo-data/cubemaps/garage_iem.dds", null, session = Session.active)
val cube = boxMesh()

View File

@@ -3,7 +3,7 @@ import org.openrndr.draw.*
import org.openrndr.extras.camera.Orbital
import org.openrndr.extras.meshgenerators.boxMesh
fun main() = application {
suspend fun main() = application {
program {
val cubemap1 = Cubemap.fromUrl("file:demo-data/cubemaps/garage_iem.dds", null, session = Session.active)
val cube = boxMesh()

View File

@@ -1,7 +1,7 @@
import org.openrndr.application
import org.openrndr.draw.loadImage
fun main() {
suspend fun main() {
application {
program {
val image = loadImage("demo-data/images/image-001.dds")

View File

@@ -4,16 +4,18 @@ import org.openrndr.draw.DrawPrimitive
import org.openrndr.draw.Shader
import org.openrndr.extras.camera.Orbital
import org.openrndr.extras.meshgenerators.boxMesh
import org.openrndr.resourceText
import org.openrndr.resourceUrl
fun main() {
suspend fun main() {
application {
program {
val vb = boxMesh()
val shader = Shader.Companion.createFromUrls(
vsUrl = resourceUrl("/shaders/gs-01.vert"),
gsUrl = resourceUrl("/shaders/gs-01.geom"),
fsUrl = resourceUrl("/shaders/gs-01.frag")
val shader = Shader.createFromCode(
vsCode = resourceText("/shaders/gs-01.vert"),
gsCode = resourceText("/shaders/gs-01.geom"),
fsCode = resourceText("/shaders/gs-01.frag"),
name = "x"
)
extend(Orbital())
extend {

View File

@@ -6,7 +6,7 @@ import org.openrndr.internal.Driver
import org.openrndr.math.Vector3
fun main() = application {
suspend fun main() = application {
program {
val shader = Shader.createFromCode(vsCode =

View File

@@ -6,7 +6,7 @@ import org.openrndr.internal.Driver
import org.openrndr.math.Vector3
fun main() = application {
suspend fun main() = application {
program {
val cb = colorBuffer(128, 128)
extend {

View File

@@ -3,7 +3,7 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
fun main() = application {
suspend fun main() = application {
program {
val cb = colorBuffer(128, 128)
val at = arrayTexture(128, 128, 32)

View File

@@ -13,7 +13,7 @@ import org.openrndr.shape.Triangle
* a 3x3 grid of triangles and lines.
*/
fun main() {
suspend fun main() {
application {
configure {
width = 720

View File

@@ -4,7 +4,7 @@ import org.openrndr.draw.shadeStyle
import org.openrndr.extensions.Screenshots
import org.openrndr.math.Polar
import org.openrndr.shape.contour
fun main() = application {
suspend fun main() = application {
program {
val style = shadeStyle {
//fragmentTransform = "x_stroke.a *= step(0.5, fract(c_contourPosition / p_dashLen));"

View File

@@ -1,7 +1,7 @@
import org.openrndr.CursorType
import org.openrndr.application
fun main() {
suspend fun main() {
application {
program {
keyboard.character.listen {

View File

@@ -4,7 +4,7 @@ import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.pointBatch
fun main() = application {
suspend fun main() = application {
program {
val storedBatch = drawer.pointBatch {
for (y in 10 until height step 20) {

View File

@@ -8,7 +8,7 @@ import org.openrndr.extras.meshgenerators.boxMesh
import org.openrndr.ffmpeg.VideoPlayerFFMPEG
import org.openrndr.math.Vector3
fun main() {
suspend fun main() {
application {
program {
val cube = boxMesh()

View File

@@ -2,19 +2,21 @@ import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
import org.openrndr.math.Vector3
import org.openrndr.resourceText
import org.openrndr.resourceUrl
fun main() {
suspend fun main() {
application {
program {
val vb = vertexBuffer(vertexFormat {
position(3)
}, 12)
val shader = Shader.Companion.createFromUrls(
vsUrl = resourceUrl("/shaders/ts-01.vert"),
tcsUrl = resourceUrl("/shaders/ts-01.tesc"),
tesUrl = resourceUrl("/shaders/ts-01.tese"),
fsUrl = resourceUrl("/shaders/ts-01.frag")
val shader = Shader.Companion.createFromCode(
vsCode = resourceText("/shaders/ts-01.vert"),
tcsCode = resourceText("/shaders/ts-01.tesc"),
tesCode = resourceText("/shaders/ts-01.tese"),
fsCode = resourceText("/shaders/ts-01.frag"),
name = "x"
)
vb.put {

View File

@@ -4,25 +4,26 @@ import org.openrndr.draw.DrawPrimitive
import org.openrndr.draw.Shader
import org.openrndr.draw.vertexBuffer
import org.openrndr.draw.vertexFormat
import org.openrndr.resourceText
import org.openrndr.resourceUrl
import org.openrndr.shape.Ellipse
fun main() {
application {
suspend fun main() {
application {
program {
val ellipse = Ellipse(width/2.0, height/2.0, 100.0, 300.0).contour
val vb = vertexBuffer(vertexFormat {
position(3)
}, ellipse.segments.size * 4)
val shader = Shader.createFromUrls(
vsUrl = resourceUrl("/shaders/ts-02.vert"),
tcsUrl = resourceUrl("/shaders/ts-02.tesc"),
tesUrl = resourceUrl("/shaders/ts-02.tese"),
gsUrl = resourceUrl("/shaders/ts-02.geom"),
fsUrl = resourceUrl("/shaders/ts-02.frag")
val shader = Shader.createFromCode(
vsCode = resourceText("/shaders/ts-02.vert"),
tcsCode = resourceText("/shaders/ts-02.tesc"),
tesCode = resourceText("/shaders/ts-02.tese"),
gsCode = resourceText("/shaders/ts-02.geom"),
fsCode = resourceText("/shaders/ts-02.frag"),
name = "x"
)
vb.put {

View File

@@ -4,10 +4,11 @@ import org.openrndr.draw.DrawPrimitive
import org.openrndr.draw.Shader
import org.openrndr.draw.vertexBuffer
import org.openrndr.draw.vertexFormat
import org.openrndr.resourceText
import org.openrndr.resourceUrl
import org.openrndr.shape.Ellipse
fun main() {
suspend fun main() {
application {
program {
@@ -17,12 +18,13 @@ fun main() {
position(3)
}, ellipse.segments.size * 4)
val shader = Shader.createFromUrls(
vsUrl = resourceUrl("/shaders/ts-03.vert"),
tcsUrl = resourceUrl("/shaders/ts-03.tesc"),
tesUrl = resourceUrl("/shaders/ts-03.tese"),
gsUrl = resourceUrl("/shaders/ts-03.geom"),
fsUrl = resourceUrl("/shaders/ts-03.frag")
val shader = Shader.createFromCode(
vsCode = resourceText("/shaders/ts-03.vert"),
tcsCode = resourceText("/shaders/ts-03.tesc"),
tesCode = resourceText("/shaders/ts-03.tese"),
gsCode = resourceText("/shaders/ts-03.geom"),
fsCode = resourceText("/shaders/ts-03.frag"),
name = "x"
)
vb.put {
@@ -37,7 +39,6 @@ fun main() {
extend {
drawer.clear(ColorRGBa.PINK)
drawer.translate(width/2.0, height/2.0, 0.0)
drawer.rotate(seconds*45.0)
drawer.translate(-width/2.0, -height/2.0, 0.0)

View File

@@ -14,7 +14,7 @@ import org.openrndr.shape.path3D
import org.openrndr.extra.shaderphrases.preprocessedFromUrls
import kotlin.math.cos
fun main() {
suspend fun main() {
application {
program {
extend(Orbital())

View File

@@ -3,7 +3,7 @@ import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
import org.openrndr.extensions.Screenshots
fun main() = application {
suspend fun main() = application {
program {
val volumeTexture = VolumeTexture.create(128,128,32)
val rt = renderTarget(128, 128) {

View File

@@ -8,7 +8,7 @@ import org.openrndr.extra.noise.Random
import org.openrndr.math.Vector2
import org.openrndr.shape.Rectangle
fun main() = application {
suspend fun main() = application {
program {
val margin = 5.0
val squareSize = 100.0

View File

@@ -3,7 +3,7 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
fun main() = application {
suspend fun main() = application {
program {
extend {
drawer.clear(ColorRGBa.GRAY)

View File

@@ -3,7 +3,7 @@ import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.rectangleBatch
fun main() = application {
suspend fun main() = application {
program {
val batch = drawer.rectangleBatch {
fill = ColorRGBa.PINK

View File

@@ -3,7 +3,7 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
fun main() = application {
suspend fun main() = application {
program {
extend {
drawer.clear(ColorRGBa.GRAY)