Demos: ensure 720px wide, reduce indentation
openrndr-demos, orx-color, orx-jumpflood, orx-no-clear
This commit is contained in:
@@ -18,8 +18,8 @@ import org.openrndr.shape.Rectangle
|
||||
*/
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1024
|
||||
height = 1024
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
|
||||
program {
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
import org.openrndr.MouseTracker
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.constant
|
||||
import org.openrndr.draw.createEquivalent
|
||||
import org.openrndr.draw.tint
|
||||
import org.openrndr.drawImage
|
||||
import org.openrndr.extra.jumpfill.DirectionalField
|
||||
import org.openrndr.extra.noise.scatter
|
||||
import org.openrndr.extra.noise.simplex
|
||||
import org.openrndr.math.IntVector2
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.math.clamp
|
||||
import org.openrndr.shape.Rectangle
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* Create directional distance field and demonstrate signed distance
|
||||
*/
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1024
|
||||
height = 1024
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
|
||||
program {
|
||||
@@ -37,7 +35,10 @@ fun main() = application {
|
||||
|
||||
ddf.shadow.download()
|
||||
extend {
|
||||
val p = (mouse.position * ddf.contentScale).toInt().clamp(IntVector2.ZERO, IntVector2(width-1, height-1))
|
||||
val p = (mouse.position * ddf.contentScale).toInt().clamp(
|
||||
IntVector2.ZERO,
|
||||
IntVector2(width - 1, height - 1)
|
||||
)
|
||||
val c = ddf.shadow[p.x, p.y]
|
||||
val sdf3 = Vector3(c.r, c.g, c.b)
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.openrndr.shape.Rectangle
|
||||
*/
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1024
|
||||
height = 1024
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
|
||||
program {
|
||||
|
||||
@@ -8,6 +8,10 @@ import org.openrndr.extra.fx.patterns.Checkers
|
||||
import org.openrndr.extra.jumpfill.fx.InnerGlow
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val c = compose {
|
||||
layer {
|
||||
|
||||
@@ -8,6 +8,10 @@ import org.openrndr.extra.fx.patterns.Checkers
|
||||
import org.openrndr.extra.jumpfill.fx.InnerGlow
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val c = compose {
|
||||
layer {
|
||||
|
||||
@@ -6,28 +6,26 @@ import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.extra.jumpfill.ShapeSDF
|
||||
import org.openrndr.extra.svg.loadSVG
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val sdf = ShapeSDF()
|
||||
val df = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 405
|
||||
}
|
||||
program {
|
||||
val sdf = ShapeSDF()
|
||||
val df = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
|
||||
sdf.setShapes(shapes)
|
||||
sdf.apply(emptyArray(), df)
|
||||
|
||||
val mouseTracker = MouseTracker(mouse)
|
||||
val mouseTracker = MouseTracker(mouse)
|
||||
|
||||
extend {
|
||||
if(mouseTracker.pressedButtons.isEmpty())
|
||||
drawer.image(df)
|
||||
else
|
||||
drawer.shapes(shapes)
|
||||
}
|
||||
extend {
|
||||
if(mouseTracker.pressedButtons.isEmpty())
|
||||
drawer.image(df)
|
||||
else
|
||||
drawer.shapes(shapes)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,50 +13,48 @@ import org.openrndr.math.transforms.transform
|
||||
|
||||
import kotlin.math.min
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val sdf0 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 405
|
||||
}
|
||||
program {
|
||||
val sdf0 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val sdf1 = ShapeSDF()
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val sdf1 = ShapeSDF()
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val shapes = loadSVG("orx-jumpflood/src/jvmDemo/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 onion = SDFOnion()
|
||||
val union = SDFSmoothIntersection()
|
||||
val onion = SDFOnion()
|
||||
|
||||
|
||||
val strokeFill = SDFStrokeFill()
|
||||
val strokeFill = SDFStrokeFill()
|
||||
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
|
||||
sdf0.setShapes(shapes)
|
||||
sdf0.setShapes(shapes)
|
||||
|
||||
sdf1.setShapes(shapes.map {
|
||||
it.transform(transform {
|
||||
translate(1280 / 2.0, 720.0 / 2)
|
||||
rotate(Vector3.Companion.UNIT_Z, seconds * 45.0 - 30.0)
|
||||
translate(-1280 / 2.0, -720.0 / 2.0)
|
||||
})
|
||||
sdf1.setShapes(shapes.map {
|
||||
it.transform(transform {
|
||||
translate(drawer.bounds.center)
|
||||
rotate(Vector3.Companion.UNIT_Z, seconds * 45.0 - 30.0)
|
||||
translate(-drawer.bounds.center)
|
||||
})
|
||||
})
|
||||
|
||||
sdf0.apply(emptyArray(), df0)
|
||||
sdf1.apply(emptyArray(), df1)
|
||||
union.radius = 10.0 + min(mouse.position.y, 100.0)
|
||||
union.apply(arrayOf(df0, df1), df0)
|
||||
onion.radius = 20.0
|
||||
onion.apply(df0, df0)
|
||||
strokeFill.strokeWeight = 2.0
|
||||
strokeFill.apply(df0, df0)
|
||||
drawer.image(df0)
|
||||
}
|
||||
sdf0.apply(emptyArray(), df0)
|
||||
sdf1.apply(emptyArray(), df1)
|
||||
union.radius = 10.0 + min(mouse.position.y, 100.0)
|
||||
union.apply(arrayOf(df0, df1), df0)
|
||||
onion.radius = 20.0
|
||||
onion.apply(df0, df0)
|
||||
strokeFill.strokeWeight = 2.0
|
||||
strokeFill.apply(df0, df0)
|
||||
drawer.image(df0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,47 +9,44 @@ import org.openrndr.extra.jumpfill.draw.SDFStrokeFill
|
||||
import org.openrndr.extra.jumpfill.ops.SDFSmoothDifference
|
||||
import org.openrndr.extra.svg.loadSVG
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 405
|
||||
}
|
||||
program {
|
||||
val sdf0 = ShapeSDF()
|
||||
val sdf1 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val sdf0 = ShapeSDF()
|
||||
val sdf1 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val fd = FluidDistort()
|
||||
fd.outputUV = true
|
||||
|
||||
val fd = FluidDistort()
|
||||
fd.outputUV = true
|
||||
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
|
||||
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
|
||||
val union = SDFSmoothDifference()
|
||||
|
||||
val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
|
||||
val union = SDFSmoothDifference()
|
||||
sdf0.setShapes(shapes)
|
||||
sdf1.setShapes(shapes)
|
||||
|
||||
sdf0.setShapes(shapes)
|
||||
sdf1.setShapes(shapes)
|
||||
val strokeFill = SDFStrokeFill()
|
||||
|
||||
val strokeFill = SDFStrokeFill()
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
fd.apply(emptyArray(), uvmap)
|
||||
|
||||
fd.apply(emptyArray(), uvmap)
|
||||
sdf0.useUV = true
|
||||
sdf0.apply(uvmap, df0)
|
||||
sdf1.apply(uvmap, df1)
|
||||
union.radius = 10.0
|
||||
union.apply(arrayOf(df0, df1), df0)
|
||||
|
||||
sdf0.useUV = true
|
||||
sdf0.apply(uvmap, df0)
|
||||
sdf1.apply(uvmap, df1)
|
||||
union.radius = 10.0
|
||||
union.apply(arrayOf(df0, df1), df0)
|
||||
|
||||
strokeFill.strokeWeight = 10.0
|
||||
strokeFill.apply(df0, df0)
|
||||
drawer.image(df0)
|
||||
}
|
||||
strokeFill.strokeWeight = 10.0
|
||||
strokeFill.apply(df0, df0)
|
||||
drawer.image(df0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,52 +11,49 @@ import org.openrndr.extra.jumpfill.ops.SDFSmoothDifference
|
||||
import org.openrndr.extra.svg.loadSVG
|
||||
import org.openrndr.shape.Circle
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 405
|
||||
}
|
||||
program {
|
||||
val gui = GUI()
|
||||
val sdf0 = ShapeSDF()
|
||||
val sdf1 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val gui = GUI()
|
||||
val sdf0 = ShapeSDF()
|
||||
val sdf1 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val perturb = Perturb()
|
||||
perturb.outputUV = true
|
||||
|
||||
val perturb = Perturb()
|
||||
perturb.outputUV = true
|
||||
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
|
||||
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
val circleShapes = List(1) { Circle(drawer.bounds.center, 200.0).shape }
|
||||
val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
|
||||
|
||||
val circleShapes = List(1) { Circle(width/2.0, height/2.0, 200.0).shape}
|
||||
val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
|
||||
sdf0.setShapes(circleShapes)
|
||||
sdf1.setShapes(shapes)
|
||||
|
||||
sdf0.setShapes(circleShapes)
|
||||
sdf1.setShapes(shapes)
|
||||
val difference = SDFSmoothDifference()
|
||||
val strokeFill = SDFStrokeFill()
|
||||
|
||||
val difference = SDFSmoothDifference()
|
||||
val strokeFill = SDFStrokeFill()
|
||||
gui.add(perturb)
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
|
||||
gui.add(perturb)
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
perturb.phase = seconds * 0.1
|
||||
perturb.apply(uvmap, uvmap)
|
||||
|
||||
perturb.phase = seconds * 0.1
|
||||
perturb.apply(uvmap, uvmap)
|
||||
sdf0.useUV = true
|
||||
sdf0.apply(uvmap, df0)
|
||||
sdf1.apply(uvmap, df1)
|
||||
difference.radius = 10.0
|
||||
difference.apply(arrayOf(df0, df1), df0)
|
||||
|
||||
sdf0.useUV = true
|
||||
sdf0.apply(uvmap, df0)
|
||||
sdf1.apply(uvmap, df1)
|
||||
difference.radius = 10.0
|
||||
difference.apply(arrayOf(df0, df1), df0)
|
||||
|
||||
strokeFill.strokeWeight = 10.0
|
||||
strokeFill.apply(df0, df0)
|
||||
drawer.image(df0)
|
||||
}
|
||||
strokeFill.strokeWeight = 10.0
|
||||
strokeFill.apply(df0, df0)
|
||||
drawer.image(df0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,66 +11,63 @@ import org.openrndr.extra.jumpfill.ops.SDFSmoothDifference
|
||||
import org.openrndr.extra.svg.loadSVG
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Circle
|
||||
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val gui = GUI()
|
||||
val sdf0 = ShapeSDF()
|
||||
val sdf1 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 405
|
||||
}
|
||||
program {
|
||||
val gui = GUI()
|
||||
val sdf0 = ShapeSDF()
|
||||
val sdf1 = ShapeSDF()
|
||||
val df0 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
val df1 = colorBuffer(width, height, format = ColorFormat.RGBa, type = ColorType.FLOAT32)
|
||||
|
||||
val perturb = Perturb()
|
||||
val perturb = Perturb()
|
||||
|
||||
perturb.outputUV = true
|
||||
|
||||
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
val uvmap2 = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
|
||||
val circleShapes = List(1) { Circle(drawer.bounds.center, 200.0).shape }
|
||||
val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
|
||||
|
||||
sdf0.setShapes(circleShapes)
|
||||
sdf1.setShapes(shapes)
|
||||
|
||||
val difference = SDFSmoothDifference()
|
||||
val strokeFill = SDFStrokeFill()
|
||||
sdf0.useUV = true
|
||||
gui.add(sdf0)
|
||||
gui.add(perturb)
|
||||
gui.add(strokeFill)
|
||||
gui.add(difference)
|
||||
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
|
||||
perturb.offset = Vector2(cos(seconds * 0.2), sin(seconds * 0.2))
|
||||
perturb.outputUV = true
|
||||
perturb.phase = seconds * 0.1
|
||||
perturb.apply(uvmap, uvmap)
|
||||
|
||||
val uvmap = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
val uvmap2 = colorBuffer(width, height, type = ColorType.FLOAT16)
|
||||
perturb.offset = Vector2.ZERO
|
||||
perturb.outputUV = false
|
||||
perturb.phase = seconds * 0.05
|
||||
perturb.apply(uvmap, uvmap2)
|
||||
|
||||
val circleShapes = List(1) { Circle(width/2.0, height/2.0, 200.0).shape}
|
||||
val shapes = loadSVG("orx-jumpflood/src/jvmDemo/resources/name.svg").findShapes().map { it.shape }
|
||||
sdf0.apply(uvmap2, df0)
|
||||
sdf1.apply(uvmap2, df1)
|
||||
|
||||
sdf0.setShapes(circleShapes)
|
||||
sdf1.setShapes(shapes)
|
||||
difference.apply(arrayOf(df0, df1), df0)
|
||||
|
||||
val difference = SDFSmoothDifference()
|
||||
val strokeFill = SDFStrokeFill()
|
||||
sdf0.useUV = true
|
||||
gui.add(sdf0)
|
||||
gui.add(perturb)
|
||||
gui.add(strokeFill)
|
||||
gui.add(difference)
|
||||
|
||||
extend(gui)
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
|
||||
perturb.offset = Vector2(cos(seconds*0.2), sin(seconds*0.2))
|
||||
perturb.outputUV = true
|
||||
perturb.phase = seconds * 0.1
|
||||
perturb.apply(uvmap, uvmap)
|
||||
|
||||
perturb.offset = Vector2.ZERO
|
||||
perturb.outputUV = false
|
||||
perturb.phase = seconds * 0.05
|
||||
perturb.apply(uvmap, uvmap2)
|
||||
|
||||
sdf0.apply(uvmap2, df0)
|
||||
sdf1.apply(uvmap2, df1)
|
||||
|
||||
difference.apply(arrayOf(df0, df1), df0)
|
||||
|
||||
strokeFill.apply(df0, df0)
|
||||
drawer.image(df0)
|
||||
}
|
||||
strokeFill.apply(df0, df0)
|
||||
drawer.image(df0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,40 +7,38 @@ import org.openrndr.draw.renderTarget
|
||||
import org.openrndr.extra.jumpfill.fx.Skeleton
|
||||
import org.openrndr.extra.noise.simplex
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val skeleton = Skeleton()
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 540
|
||||
}
|
||||
program {
|
||||
val skeleton = Skeleton()
|
||||
|
||||
val input = renderTarget(width, height) {
|
||||
colorBuffer()
|
||||
}
|
||||
val field = input.colorBuffer(0).createEquivalent(type = ColorType.FLOAT32)
|
||||
extend {
|
||||
drawer.isolatedWithTarget(input) {
|
||||
// -- draw something interesting
|
||||
drawer.stroke = null
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.circle(mouse.position, 300.0)
|
||||
drawer.fill = ColorRGBa.BLACK
|
||||
drawer.circle(mouse.position, 150.0)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
for (i in 0 until 30) {
|
||||
val time = seconds * 0.25
|
||||
val x = simplex(i * 20, time) * width / 2 + width / 2
|
||||
val y = simplex(i * 20 + 5, time) * height / 2 + height / 2
|
||||
val r = simplex(i*30, time) * 50.0 + 50.0
|
||||
drawer.circle(x, y, r)
|
||||
}
|
||||
val input = renderTarget(width, height) {
|
||||
colorBuffer()
|
||||
}
|
||||
val field = input.colorBuffer(0).createEquivalent(type = ColorType.FLOAT32)
|
||||
extend {
|
||||
drawer.isolatedWithTarget(input) {
|
||||
// -- draw something interesting
|
||||
drawer.stroke = null
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.circle(mouse.position, 300.0)
|
||||
drawer.fill = ColorRGBa.BLACK
|
||||
drawer.circle(mouse.position, 150.0)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
for (i in 0 until 30) {
|
||||
val time = seconds * 0.25
|
||||
val x = simplex(i * 20, time) * width / 2 + width / 2
|
||||
val y = simplex(i * 20 + 5, time) * height / 2 + height / 2
|
||||
val r = simplex(i * 30, time) * 50.0 + 50.0
|
||||
drawer.circle(x, y, r)
|
||||
}
|
||||
skeleton.apply(input.colorBuffer(0), field)
|
||||
drawer.image(field)
|
||||
}
|
||||
skeleton.apply(input.colorBuffer(0), field)
|
||||
drawer.image(field)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,46 +2,43 @@ import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.ColorType
|
||||
import org.openrndr.draw.createEquivalent
|
||||
|
||||
import org.openrndr.draw.isolatedWithTarget
|
||||
import org.openrndr.draw.renderTarget
|
||||
import org.openrndr.extra.jumpfill.fx.StraightSkeleton
|
||||
import org.openrndr.extra.noise.simplex
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 1280
|
||||
height = 720
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val straightSkeleton = StraightSkeleton()
|
||||
val input = renderTarget(width, height) {
|
||||
colorBuffer()
|
||||
}
|
||||
program {
|
||||
val straightSkeleton = StraightSkeleton()
|
||||
val input = renderTarget(width, height) {
|
||||
colorBuffer()
|
||||
}
|
||||
val field = input.colorBuffer(0).createEquivalent(type = ColorType.FLOAT32)
|
||||
val field = input.colorBuffer(0).createEquivalent(type = ColorType.FLOAT32)
|
||||
|
||||
extend {
|
||||
drawer.isolatedWithTarget(input) {
|
||||
// -- draw something interesting
|
||||
drawer.stroke = null
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.circle(mouse.position, 300.0)
|
||||
drawer.fill = ColorRGBa.BLACK
|
||||
drawer.circle(mouse.position, 150.0)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
for (i in 0 until 30) {
|
||||
val time = seconds * 0.25
|
||||
val x = simplex(i * 20, time) * width / 2 + width / 2
|
||||
val y = simplex(i * 20 + 5, time) * height / 2 + height / 2
|
||||
val r = simplex(i*30, time) * 50.0 + 50.0
|
||||
drawer.circle(x, y, r)
|
||||
}
|
||||
extend {
|
||||
drawer.isolatedWithTarget(input) {
|
||||
// -- draw something interesting
|
||||
drawer.stroke = null
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
drawer.circle(mouse.position, 300.0)
|
||||
drawer.fill = ColorRGBa.BLACK
|
||||
drawer.circle(mouse.position, 150.0)
|
||||
drawer.fill = ColorRGBa.WHITE
|
||||
for (i in 0 until 30) {
|
||||
val time = seconds * 0.25
|
||||
val x = simplex(i * 20, time) * width / 2 + width / 2
|
||||
val y = simplex(i * 20 + 5, time) * height / 2 + height / 2
|
||||
val r = simplex(i * 30, time) * 50.0 + 50.0
|
||||
drawer.circle(x, y, r)
|
||||
}
|
||||
straightSkeleton.apply(input.colorBuffer(0), field)
|
||||
drawer.image(field)
|
||||
}
|
||||
straightSkeleton.apply(input.colorBuffer(0), field)
|
||||
drawer.image(field)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@ fun main() = application {
|
||||
height = 512
|
||||
}
|
||||
program {
|
||||
val rt = renderTarget(512, 512, 1.0) {
|
||||
val rt = renderTarget(width, height, 1.0) {
|
||||
colorBuffer(type = ColorType.FLOAT32)
|
||||
}
|
||||
val encoder = EncodePoints()
|
||||
val jf = JumpFlooder(512, 512, encodePoints = Passthrough())
|
||||
val jf2 = JumpFlooder(512, 512, encodePoints = Passthrough())
|
||||
val jf = JumpFlooder(width, height, encodePoints = Passthrough())
|
||||
val jf2 = JumpFlooder(width, height, encodePoints = Passthrough())
|
||||
val idcontours = IdContourPoints()
|
||||
val contoured = colorBuffer(512, 512, type = ColorType.FLOAT32)
|
||||
val contoured = colorBuffer(width, height, type = ColorType.FLOAT32)
|
||||
extend {
|
||||
fun plot(x: Double, y: Double, id: Double) {
|
||||
drawer.fill = ColorRGBa(id, 0.0, 0.0, 1.0)
|
||||
@@ -53,7 +53,7 @@ fun main() = application {
|
||||
drawer.image(contoured)
|
||||
val flooded2 = jf2.jumpFlood(contoured)
|
||||
|
||||
drawer.image(flooded2, 512.0, 0.0)
|
||||
drawer.image(flooded2, width * 1.0, 0.0)
|
||||
|
||||
drawer.shadeStyle = shadeStyle {
|
||||
fragmentTransform = """
|
||||
|
||||
@@ -10,11 +10,11 @@ fun main() = application {
|
||||
height = 512
|
||||
}
|
||||
program {
|
||||
val rt = renderTarget(512, 512, 1.0) {
|
||||
val rt = renderTarget(width, height, 1.0) {
|
||||
colorBuffer(type = ColorType.FLOAT32)
|
||||
}
|
||||
|
||||
val flowfield = colorBuffer(512, 512, type = ColorType.FLOAT32)
|
||||
val flowfield = colorBuffer(width, height, type = ColorType.FLOAT32)
|
||||
val cluster = ClusteredField(decodeMode = DecodeMode.DISTANCE, outputDistanceToContours = true)
|
||||
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ import org.openrndr.math.Vector2
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
width = 512
|
||||
height = 512
|
||||
}
|
||||
program {
|
||||
val rt = renderTarget(720, 720, 1.0) {
|
||||
val rt = renderTarget(width, height, 1.0) {
|
||||
colorBuffer(type = ColorType.FLOAT32)
|
||||
}
|
||||
val flowfield = colorBuffer(width, height, type = ColorType.FLOAT32)
|
||||
@@ -28,9 +28,9 @@ fun main() = application {
|
||||
val points = drawer.bounds.scatter(20.0)
|
||||
drawer.points {
|
||||
for ((index, point) in points.withIndex()) {
|
||||
fill = ColorRGBa((index+1.0)/points.size, 0.0, 0.0, 1.0)
|
||||
fill = ColorRGBa((index + 1.0) / points.size, 0.0, 0.0, 1.0)
|
||||
for (i in 0 until 30) {
|
||||
point(point + Vector2.uniformRing(15.0, 25.0)* Vector2(1.0, 1.0))
|
||||
point(point + Vector2.uniformRing(15.0, 25.0) * Vector2(1.0, 1.0))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user