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

@@ -15,53 +15,50 @@ import org.openrndr.math.Vector3
import org.openrndr.shape.path3D
import kotlin.random.Random
fun main() {
application {
configure {
width = 720
height = 720
multisample = WindowMultisample.SampleCount(4)
}
program {
val random = Random(0)
val cylinder = cylinderMesh(radius = 0.5, length = 0.1)
val p = path3D {
moveTo(0.0, 0.0, 0.0)
curveTo(
Vector3.uniformRing(0.1, 1.0, random = random)*10.0,
Vector3.uniformRing(0.1, 1.0, random = random)*10.0,
Vector3.uniformRing(0.1, 1.0, random = random)*10.0
fun main() = application {
configure {
width = 720
height = 720
multisample = WindowMultisample.SampleCount(4)
}
program {
val random = Random(0)
val cylinder = cylinderMesh(radius = 0.5, length = 0.1)
val p = path3D {
moveTo(0.0, 0.0, 0.0)
curveTo(
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0,
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0,
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0
)
for (i in 0 until 10) {
continueTo(
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0,
Vector3.uniformRing(0.1, 1.0, random = random) * 10.0
)
for (i in 0 until 10) {
continueTo(
Vector3.uniformRing(0.1, 1.0, random = random)*10.0,
Vector3.uniformRing(0.1, 1.0, random = random)*10.0
)
}
}
val pr = p.rectified(0.01, 100.0)
}
val pr = p.rectified(0.01, 100.0)
val frames = pr.frames((0 until 100).map { it / 100.0}, Vector3.UNIT_Y, analyticalDirections = false)
extend(Orbital())
extend {
drawer.shadeStyle = shadeStyle {
fragmentTransform = """
val frames = pr.frames((0 until 100).map { it / 100.0 }, Vector3.UNIT_Y, analyticalDirections = false)
extend(Orbital())
extend {
drawer.shadeStyle = shadeStyle {
fragmentTransform = """
x_fill.rgb = vec3(abs(v_viewNormal.z)*0.9+ 0.1);
""".trimIndent()
}
drawer.stroke = ColorRGBa.PINK
drawer.path(p)
for (frame in frames) {
drawer.isolated {
drawer.model = frame
drawer.vertexBuffer(cylinder, DrawPrimitive.TRIANGLES)
}
drawer.stroke = ColorRGBa.PINK
drawer.path(p)
for (frame in frames) {
drawer.isolated {
drawer.model = frame
drawer.vertexBuffer(cylinder, DrawPrimitive.TRIANGLES)
}
}
}
}
}
}
}