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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
<svg version="1.1" baseProfile="tiny" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 1280 720" xml:space="preserve">
|
||||
<polygon fill="#FF00FF" stroke="#000000" stroke-miterlimit="2.6131" points="1013.8,424.3 1013.8,238 957.1,238 957.1,238
|
||||
794.7,238 794.7,294.7 957.1,294.7 957.1,318.9 794.7,318.9 794.7,375.6 957.1,375.6 957.1,424.3 794.7,424.3 794.7,481 957.1,481
|
||||
1013.8,481 1037.8,481 1037.8,424.3 "/>
|
||||
<path fill="#FF00FF" stroke="#000000" stroke-miterlimit="2.6131" d="M705.7,263.3H576V239h-56.7v119.2l0,0V401h93.2v24.3h-93.2V482
|
||||
h243.1v-56.7h-93.2V401h93.2V239h-56.7V263.3L705.7,263.3z M705.7,344.3H576V320h129.7V344.3z"/>
|
||||
<path fill="#FF00FF" d="M356.6,279L356.6,279L356.6,279z"/>
|
||||
<path fill="#FF00FF" stroke="#000000" stroke-miterlimit="2.6131" d="M356.6,279c-9.2-3.3-19-5-28.8-5c-47.2,0-85.5,38.3-85.5,85.5
|
||||
s38.3,85.5,85.5,85.5s85.5-38.3,85.5-85.5c0-0.1,0-0.3,0-0.4C413.3,323.1,390.5,291,356.6,279z M327.8,387.4
|
||||
c-15.7,0-28.4-12.7-28.4-28.4c0-15.7,12.7-28.4,28.4-28.4c15.6,0,28.4,12.7,28.4,28.4C356.1,374.7,343.4,387.4,327.8,387.4z"/>
|
||||
<rect x="430.1" y="238" fill="#FF00FF" stroke="#000000" stroke-miterlimit="2.6131" width="56.7" height="243"/>
|
||||
</svg>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="720" height="405" version="1.1" viewBox="0 0 720 405" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g fill="#f0f">
|
||||
<path d="m538 166v13.6h-91.3v31.8h91.3v27.3h-91.3v31.8h137v-31.8h-13.5v-104h-123v31.8z" stroke="#000" stroke-miterlimit="2.61"/>
|
||||
<path d="m397 148h-72.9v-13.6h-31.9v90.8h52.4v13.6h-52.4v31.8h137v-31.8h-52.4v-13.6h52.4v-90.8h-31.9zm0 45.4h-72.9v-13.6h72.9z" stroke="#000" stroke-miterlimit="2.61"/>
|
||||
<path d="m201 157"/>
|
||||
<path d="m201 157c-5.17-1.85-10.7-2.8-16.2-2.8-26.5 0-48 21.5-48 47.9 0 26.5 21.5 47.9 48 47.9 26.5 0 48-21.5 48-47.9v-0.224c0-20.2-12.8-38.2-31.9-44.9zm-16.2 60.8c-8.82 0-16-7.12-16-15.9s7.14-15.9 16-15.9c8.77 0 16 7.12 16 15.9-0.0562 8.8-7.19 15.9-16 15.9z" stroke="#000" stroke-miterlimit="2.61"/>
|
||||
<rect x="242" y="134" width="31.9" height="136" stroke="#000" stroke-miterlimit="2.61"/>
|
||||
</g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 897 B |
Reference in New Issue
Block a user