[orx-noise] Tidy up demos
Produce 720px wide images.
Use main() = application { for reduced indentation
This commit is contained in:
@@ -185,21 +185,8 @@ val v7 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
|
|||||||
val v8 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
|
val v8 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- __demos__ >
|
|
||||||
# Demos
|
|
||||||
[DemoGradientPerturb2DKt](src/demo/kotlin/DemoGradientPerturb2DKt.kt
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### DemoCubicNoise2D01
|
### DemoCubicNoise2D01
|
||||||
[source code](src/jvmDemo/kotlin/DemoCubicNoise2D01.kt)
|
[source code](src/jvmDemo/kotlin/DemoCubicNoise2D01.kt)
|
||||||
|
|
||||||
@@ -220,21 +207,6 @@ val v8 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### DemoNoisesGLSLGui
|
|
||||||
[source code](src/jvmDemo/kotlin/DemoNoisesGLSLGui.kt)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### DemoNoisesGLSL
|
|
||||||
[source code](src/jvmDemo/kotlin/DemoNoisesGLSL.kt)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### DemoRectangleHash01
|
|
||||||
[source code](src/jvmDemo/kotlin/DemoRectangleHash01.kt)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### DemoScatter01
|
### DemoScatter01
|
||||||
[source code](src/jvmDemo/kotlin/DemoScatter01.kt)
|
[source code](src/jvmDemo/kotlin/DemoScatter01.kt)
|
||||||
|
|
||||||
@@ -245,26 +217,31 @@ val v8 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### DemoSimplexGLSL
|
|
||||||
[source code](src/jvmDemo/kotlin/DemoSimplexGLSL.kt)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### DemoTriangleNoise01
|
### DemoTriangleNoise01
|
||||||
[source code](src/jvmDemo/kotlin/DemoTriangleNoise01.kt)
|
[source code](src/jvmDemo/kotlin/DemoTriangleNoise01.kt)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### DemoUHash01
|
|
||||||
[source code](src/jvmDemo/kotlin/DemoUHash01.kt)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### DemoValueNoise2D01
|
### DemoValueNoise2D01
|
||||||
[source code](src/jvmDemo/kotlin/DemoValueNoise2D01.kt)
|
[source code](src/jvmDemo/kotlin/DemoValueNoise2D01.kt)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
### glsl/DemoNoisesGLSLGui
|
||||||
|
[source code](src/jvmDemo/kotlin/glsl/DemoNoisesGLSLGui.kt)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### glsl/DemoNoisesGLSL
|
||||||
|
[source code](src/jvmDemo/kotlin/glsl/DemoNoisesGLSL.kt)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### glsl/DemoSimplexGLSL
|
||||||
|
[source code](src/jvmDemo/kotlin/glsl/DemoSimplexGLSL.kt)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### hammersley/DemoHammersley2D01
|
### hammersley/DemoHammersley2D01
|
||||||
[source code](src/jvmDemo/kotlin/hammersley/DemoHammersley2D01.kt)
|
[source code](src/jvmDemo/kotlin/hammersley/DemoHammersley2D01.kt)
|
||||||
|
|
||||||
@@ -280,6 +257,21 @@ val v8 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
### hash/DemoCircleHash01
|
||||||
|
[source code](src/jvmDemo/kotlin/hash/DemoCircleHash01.kt)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### hash/DemoRectangleHash01
|
||||||
|
[source code](src/jvmDemo/kotlin/hash/DemoRectangleHash01.kt)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### hash/DemoUHash01
|
||||||
|
[source code](src/jvmDemo/kotlin/hash/DemoUHash01.kt)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### phrases/DemoUHashPhrase01
|
### phrases/DemoUHashPhrase01
|
||||||
[source code](src/jvmDemo/kotlin/phrases/DemoUHashPhrase01.kt)
|
[source code](src/jvmDemo/kotlin/phrases/DemoUHashPhrase01.kt)
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
import org.openrndr.application
|
|
||||||
import org.openrndr.extra.noise.shapes.hash
|
|
||||||
import org.openrndr.extra.noise.shapes.uniform
|
|
||||||
import org.openrndr.shape.Circle
|
|
||||||
import kotlin.random.Random
|
|
||||||
|
|
||||||
fun main() {
|
|
||||||
application {
|
|
||||||
configure {
|
|
||||||
width = 720
|
|
||||||
height = 720
|
|
||||||
}
|
|
||||||
program {
|
|
||||||
extend {
|
|
||||||
val b = drawer.bounds
|
|
||||||
val b0 = b.sub(0.0, 0.0, 0.5, 1.0).offsetEdges(-10.0)
|
|
||||||
val b1 = b.sub(0.5, 0.0, 1.0, 1.0).offsetEdges(-10.0)
|
|
||||||
|
|
||||||
val c0 = Circle(b0.center, b0.width/2.0)
|
|
||||||
val c1 = Circle(b1.center, b1.width/2.0)
|
|
||||||
|
|
||||||
val r = Random(0)
|
|
||||||
for (i in 0 until 2000) {
|
|
||||||
drawer.circle(c0.uniform(r), 2.0)
|
|
||||||
drawer.circle(c1.hash(909, i),2.0)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.color.ColorRGBa
|
import org.openrndr.color.ColorRGBa
|
||||||
import org.openrndr.extra.noise.*
|
import org.openrndr.extra.noise.cubicHermite3D
|
||||||
|
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 360
|
||||||
|
}
|
||||||
program {
|
program {
|
||||||
extend {
|
extend {
|
||||||
drawer.points {
|
drawer.points {
|
||||||
@@ -18,4 +21,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -6,15 +6,19 @@ import org.openrndr.extra.noise.simplex
|
|||||||
import org.openrndr.math.Vector2
|
import org.openrndr.math.Vector2
|
||||||
import kotlin.math.absoluteValue
|
import kotlin.math.absoluteValue
|
||||||
|
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 360
|
||||||
|
}
|
||||||
program {
|
program {
|
||||||
val cb = colorBuffer(width, height)
|
val cb = colorBuffer(width, height)
|
||||||
val shad = cb.shadow
|
val shad = cb.shadow
|
||||||
extend {
|
extend {
|
||||||
for (y in 0 until height) {
|
for (y in 0 until height) {
|
||||||
for (x in 0 until width) {
|
for (x in 0 until width) {
|
||||||
val p = gradientPerturbFractal(300, frequency = 0.8, position = Vector2(seconds + x/320.0,y/240.0))
|
val p =
|
||||||
|
gradientPerturbFractal(300, frequency = 0.8, position = Vector2(seconds + x / 320.0, y / 240.0))
|
||||||
val d = simplex(300, p.x, p.y + seconds, seconds).absoluteValue
|
val d = simplex(300, p.x, p.y + seconds, seconds).absoluteValue
|
||||||
shad[x, y] = ColorRGBa(d, d, d, 1.0)
|
shad[x, y] = ColorRGBa(d, d, d, 1.0)
|
||||||
}
|
}
|
||||||
@@ -24,4 +28,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -6,15 +6,19 @@ import org.openrndr.extra.noise.simplex
|
|||||||
import org.openrndr.math.Vector3
|
import org.openrndr.math.Vector3
|
||||||
import kotlin.math.absoluteValue
|
import kotlin.math.absoluteValue
|
||||||
|
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 360
|
||||||
|
}
|
||||||
program {
|
program {
|
||||||
val cb = colorBuffer(width, height)
|
val cb = colorBuffer(width, height)
|
||||||
val shad = cb.shadow
|
val shad = cb.shadow
|
||||||
extend {
|
extend {
|
||||||
for (y in 0 until height) {
|
for (y in 0 until height) {
|
||||||
for (x in 0 until width) {
|
for (x in 0 until width) {
|
||||||
val p = gradientPerturbFractal(300, frequency = 0.8, position = Vector3(x/320.0,y/240.0, seconds))
|
val p =
|
||||||
|
gradientPerturbFractal(300, frequency = 0.8, position = Vector3(x / 320.0, y / 240.0, seconds))
|
||||||
val d = simplex(300, p.x, p.y, p.z).absoluteValue
|
val d = simplex(300, p.x, p.y, p.z).absoluteValue
|
||||||
shad[x, y] = ColorRGBa(d, d, d, 1.0)
|
shad[x, y] = ColorRGBa(d, d, d, 1.0)
|
||||||
}
|
}
|
||||||
@@ -24,4 +28,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import org.openrndr.application
|
|
||||||
import org.openrndr.extra.noise.shapes.hash
|
|
||||||
import org.openrndr.extra.noise.shapes.uniform
|
|
||||||
import kotlin.random.Random
|
|
||||||
|
|
||||||
fun main() {
|
|
||||||
application {
|
|
||||||
configure {
|
|
||||||
width = 720
|
|
||||||
height = 720
|
|
||||||
}
|
|
||||||
program {
|
|
||||||
extend {
|
|
||||||
val b = drawer.bounds
|
|
||||||
val b0 = b.sub(0.0, 0.0, 0.5, 1.0).offsetEdges(-10.0)
|
|
||||||
val b1 = b.sub(0.5, 0.0, 1.0, 1.0).offsetEdges(-10.0)
|
|
||||||
|
|
||||||
val r = Random(0)
|
|
||||||
for (i in 0 until 20000) {
|
|
||||||
drawer.circle(b0.uniform(r), 2.0)
|
|
||||||
drawer.circle(b1.hash(909, i),2.0)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,8 +6,11 @@ import org.openrndr.shape.Ellipse
|
|||||||
import kotlin.math.cos
|
import kotlin.math.cos
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 540
|
||||||
|
}
|
||||||
program {
|
program {
|
||||||
extend {
|
extend {
|
||||||
val shape = Ellipse(Vector2(width / 2.0, height / 2.0), 200.0, 150.0 + cos(seconds) * 125.0).shape
|
val shape = Ellipse(Vector2(width / 2.0, height / 2.0), 200.0, 150.0 + cos(seconds) * 125.0).shape
|
||||||
@@ -25,4 +28,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -7,8 +7,7 @@ import org.openrndr.shape.Triangle
|
|||||||
* Demonstrate the generation of uniformly distributed points inside a list of triangles
|
* Demonstrate the generation of uniformly distributed points inside a list of triangles
|
||||||
* @see <img src="https://raw.githubusercontent.com/openrndr/orx/media/orx-noise/images/DemoTriangleNoise01Kt.png">
|
* @see <img src="https://raw.githubusercontent.com/openrndr/orx/media/orx-noise/images/DemoTriangleNoise01Kt.png">
|
||||||
*/
|
*/
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
height = 720
|
height = 720
|
||||||
@@ -29,4 +28,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import org.openrndr.application
|
|
||||||
import org.openrndr.color.ColorRGBa
|
|
||||||
import org.openrndr.drawImage
|
|
||||||
import org.openrndr.extra.noise.*
|
|
||||||
|
|
||||||
fun main() {
|
|
||||||
application {
|
|
||||||
program {
|
|
||||||
|
|
||||||
|
|
||||||
extend {
|
|
||||||
drawer.points {
|
|
||||||
for (y in 0 until height) {
|
|
||||||
for (x in 0 until width) {
|
|
||||||
val c = fhash3D(100, x + (seconds*60.0).toInt(), y, (0).toInt())
|
|
||||||
//val u = uhash11(x.toUInt()).toDouble() / UInt.MAX_VALUE.toDouble()
|
|
||||||
fill = ColorRGBa(c, c, c, 1.0)
|
|
||||||
point(x.toDouble(), y.toDouble())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.color.ColorRGBa
|
import org.openrndr.color.ColorRGBa
|
||||||
import org.openrndr.extra.noise.*
|
import org.openrndr.extra.noise.valueQuintic3D
|
||||||
|
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 360
|
||||||
|
}
|
||||||
program {
|
program {
|
||||||
extend {
|
extend {
|
||||||
drawer.points {
|
drawer.points {
|
||||||
@@ -18,4 +21,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
package glsl
|
||||||
|
|
||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.draw.colorBuffer
|
import org.openrndr.draw.colorBuffer
|
||||||
import org.openrndr.extra.noise.filters.*
|
import org.openrndr.extra.noise.filters.*
|
||||||
@@ -14,6 +16,10 @@ import kotlin.math.sin
|
|||||||
* The noise color can be set using a `color` or a `gain` property.
|
* The noise color can be set using a `color` or a `gain` property.
|
||||||
*/
|
*/
|
||||||
fun main() = application {
|
fun main() = application {
|
||||||
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 360
|
||||||
|
}
|
||||||
program {
|
program {
|
||||||
val noises = listOf(
|
val noises = listOf(
|
||||||
HashNoise(), SpeckleNoise(), CellNoise(),
|
HashNoise(), SpeckleNoise(), CellNoise(),
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
package glsl
|
||||||
|
|
||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.draw.colorBuffer
|
import org.openrndr.draw.colorBuffer
|
||||||
import org.openrndr.extra.gui.GUI
|
import org.openrndr.extra.gui.GUI
|
||||||
@@ -9,8 +11,10 @@ import org.openrndr.extra.noise.filters.*
|
|||||||
*/
|
*/
|
||||||
fun main() = application {
|
fun main() = application {
|
||||||
configure {
|
configure {
|
||||||
width = 200 * 6 + 200
|
configure {
|
||||||
height = 500
|
width = 720
|
||||||
|
height = 360
|
||||||
|
}
|
||||||
}
|
}
|
||||||
program {
|
program {
|
||||||
val noises = listOf(
|
val noises = listOf(
|
||||||
@@ -18,7 +22,7 @@ fun main() = application {
|
|||||||
ValueNoise(), SimplexNoise3D(), WorleyNoise()
|
ValueNoise(), SimplexNoise3D(), WorleyNoise()
|
||||||
)
|
)
|
||||||
|
|
||||||
val img = colorBuffer(200, 460)
|
val img = colorBuffer((width - 200) / noises.size, 460)
|
||||||
|
|
||||||
val gui = GUI()
|
val gui = GUI()
|
||||||
noises.forEach { gui.add(it) }
|
noises.forEach { gui.add(it) }
|
||||||
@@ -27,7 +31,7 @@ fun main() = application {
|
|||||||
extend {
|
extend {
|
||||||
noises.forEachIndexed { i, noise ->
|
noises.forEachIndexed { i, noise ->
|
||||||
noise.apply(emptyArray(), img)
|
noise.apply(emptyArray(), img)
|
||||||
drawer.image(img, 200.0 + i * 200.0, 20.0)
|
drawer.image(img, 200.0 + i * img.width, 20.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
|
package glsl
|
||||||
|
|
||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.color.rgb
|
import org.openrndr.color.rgb
|
||||||
import org.openrndr.draw.colorBuffer
|
import org.openrndr.draw.colorBuffer
|
||||||
import org.openrndr.extra.noise.Random
|
import org.openrndr.extra.noise.filters.SimplexNoise3D
|
||||||
import org.openrndr.extra.noise.filters.*
|
import org.openrndr.extra.noise.uniform
|
||||||
import org.openrndr.math.Vector3
|
import org.openrndr.math.Vector3
|
||||||
import org.openrndr.math.Vector4
|
import org.openrndr.math.Vector4
|
||||||
import kotlin.math.sin
|
import kotlin.math.sin
|
||||||
@@ -11,10 +13,10 @@ import kotlin.math.sin
|
|||||||
* A sine oscillator with randomized parameters
|
* A sine oscillator with randomized parameters
|
||||||
*/
|
*/
|
||||||
class SinOsc {
|
class SinOsc {
|
||||||
private val freq = Random.double(0.1, 2.0)
|
private val freq = Double.uniform(0.1, 2.0)
|
||||||
private val phase = Random.double(0.0, 6.28)
|
private val phase = Double.uniform(0.0, 6.28)
|
||||||
private val add = Random.double(0.0, 1.0)
|
private val add = Double.uniform(0.0, 1.0)
|
||||||
private val mul = Random.double(0.0, 1.0 - add)
|
private val mul = Double.uniform(0.0, 1.0 - add)
|
||||||
operator fun invoke() = sin(System.currentTimeMillis() * 0.0001 * freq + phase) * mul + add
|
operator fun invoke() = sin(System.currentTimeMillis() * 0.0001 * freq + phase) * mul + add
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +27,10 @@ class SinOsc {
|
|||||||
* randomized sine oscillators.
|
* randomized sine oscillators.
|
||||||
*/
|
*/
|
||||||
fun main() = application {
|
fun main() = application {
|
||||||
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 540
|
||||||
|
}
|
||||||
program {
|
program {
|
||||||
val noise = SimplexNoise3D()
|
val noise = SimplexNoise3D()
|
||||||
val img = colorBuffer(width, height)
|
val img = colorBuffer(width, height)
|
||||||
@@ -10,8 +10,7 @@ import org.openrndr.extra.noise.hammersley.hammersley2D
|
|||||||
* 400 2D Hammersley points mapped within the bounds of the application's resolution.
|
* 400 2D Hammersley points mapped within the bounds of the application's resolution.
|
||||||
* These points are visualized by rendering circles at their respective positions.
|
* These points are visualized by rendering circles at their respective positions.
|
||||||
*/
|
*/
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
height = 720
|
height = 720
|
||||||
@@ -26,4 +25,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -20,8 +20,7 @@ import org.openrndr.math.Vector3
|
|||||||
* to navigate the scene. The visualization relies on the draw loop for continuous
|
* to navigate the scene. The visualization relies on the draw loop for continuous
|
||||||
* rendering of the points.
|
* rendering of the points.
|
||||||
*/
|
*/
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
height = 720
|
height = 720
|
||||||
@@ -43,4 +42,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -7,10 +7,7 @@ import org.openrndr.draw.isolated
|
|||||||
import org.openrndr.extra.camera.Orbital
|
import org.openrndr.extra.camera.Orbital
|
||||||
import org.openrndr.extra.meshgenerators.sphereMesh
|
import org.openrndr.extra.meshgenerators.sphereMesh
|
||||||
import org.openrndr.extra.noise.hammersley.hammersley4D
|
import org.openrndr.extra.noise.hammersley.hammersley4D
|
||||||
import org.openrndr.extra.noise.rsequence.rSeq4D
|
|
||||||
import org.openrndr.math.Vector4
|
import org.openrndr.math.Vector4
|
||||||
import kotlin.math.abs
|
|
||||||
import kotlin.math.min
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Demo that visualizes a 4D Hammersley point set in a 3D space, with colors determined by the 4th dimension.
|
* Demo that visualizes a 4D Hammersley point set in a 3D space, with colors determined by the 4th dimension.
|
||||||
@@ -25,8 +22,7 @@ import kotlin.math.min
|
|||||||
* of the scene. Rendering occurs within the draw loop, providing continuous visualization
|
* of the scene. Rendering occurs within the draw loop, providing continuous visualization
|
||||||
* of the point distribution.
|
* of the point distribution.
|
||||||
*/
|
*/
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
height = 720
|
height = 720
|
||||||
@@ -49,4 +45,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
30
orx-noise/src/jvmDemo/kotlin/hash/DemoCircleHash01.kt
Normal file
30
orx-noise/src/jvmDemo/kotlin/hash/DemoCircleHash01.kt
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package hash
|
||||||
|
|
||||||
|
import org.openrndr.application
|
||||||
|
import org.openrndr.extra.noise.shapes.hash
|
||||||
|
import org.openrndr.extra.noise.shapes.uniform
|
||||||
|
import org.openrndr.shape.Circle
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
fun main() = application {
|
||||||
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 360
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
extend {
|
||||||
|
val b = drawer.bounds
|
||||||
|
val b0 = b.sub(0.0, 0.0, 0.5, 1.0).offsetEdges(-10.0)
|
||||||
|
val b1 = b.sub(0.5, 0.0, 1.0, 1.0).offsetEdges(-10.0)
|
||||||
|
|
||||||
|
val c0 = Circle(b0.center, b0.width / 2.0)
|
||||||
|
val c1 = Circle(b1.center, b1.width / 2.0)
|
||||||
|
|
||||||
|
val r = Random(0)
|
||||||
|
for (i in 0 until 2000) {
|
||||||
|
drawer.circle(c0.uniform(r), 2.0)
|
||||||
|
drawer.circle(c1.hash(909, i), 2.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
orx-noise/src/jvmDemo/kotlin/hash/DemoRectangleHash01.kt
Normal file
27
orx-noise/src/jvmDemo/kotlin/hash/DemoRectangleHash01.kt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package hash
|
||||||
|
|
||||||
|
import org.openrndr.application
|
||||||
|
import org.openrndr.extra.noise.shapes.hash
|
||||||
|
import org.openrndr.extra.noise.shapes.uniform
|
||||||
|
import kotlin.random.Random
|
||||||
|
|
||||||
|
fun main() = application {
|
||||||
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 540
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
extend {
|
||||||
|
val b = drawer.bounds
|
||||||
|
val b0 = b.sub(0.0, 0.0, 0.5, 1.0).offsetEdges(-10.0)
|
||||||
|
val b1 = b.sub(0.5, 0.0, 1.0, 1.0).offsetEdges(-10.0)
|
||||||
|
|
||||||
|
val r = Random(0)
|
||||||
|
for (i in 0 until 20000) {
|
||||||
|
drawer.circle(b0.uniform(r), 2.0)
|
||||||
|
drawer.circle(b1.hash(909, i), 2.0)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
orx-noise/src/jvmDemo/kotlin/hash/DemoUHash01.kt
Normal file
26
orx-noise/src/jvmDemo/kotlin/hash/DemoUHash01.kt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package hash
|
||||||
|
|
||||||
|
import org.openrndr.application
|
||||||
|
import org.openrndr.color.ColorRGBa
|
||||||
|
import org.openrndr.extra.noise.fhash3D
|
||||||
|
|
||||||
|
fun main() = application {
|
||||||
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 360
|
||||||
|
}
|
||||||
|
program {
|
||||||
|
extend {
|
||||||
|
drawer.points {
|
||||||
|
for (y in 0 until height) {
|
||||||
|
for (x in 0 until width) {
|
||||||
|
val c = fhash3D(100, x + (seconds * 60.0).toInt(), y, (0).toInt())
|
||||||
|
//val u = uhash11(x.toUInt()).toDouble() / UInt.MAX_VALUE.toDouble()
|
||||||
|
fill = ColorRGBa(c, c, c, 1.0)
|
||||||
|
point(x.toDouble(), y.toDouble())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,13 +2,16 @@ package phrases
|
|||||||
|
|
||||||
import org.openrndr.application
|
import org.openrndr.application
|
||||||
import org.openrndr.draw.shadeStyle
|
import org.openrndr.draw.shadeStyle
|
||||||
import org.openrndr.extra.noise.phrases.*
|
import org.openrndr.extra.noise.phrases.fhash13
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Demonstrate uniform hashing function phrase in a shadestyle
|
* Demonstrate uniform hashing function phrase in a shadestyle
|
||||||
*/
|
*/
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
configure {
|
||||||
|
width = 720
|
||||||
|
height = 360
|
||||||
|
}
|
||||||
program {
|
program {
|
||||||
extend {
|
extend {
|
||||||
/** A custom shadestyle */
|
/** A custom shadestyle */
|
||||||
@@ -25,4 +28,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -8,8 +8,7 @@ import org.openrndr.extra.noise.rsequence.rSeq2D
|
|||||||
* demonstrating 2D quasirandomly distributed points. The points are generated
|
* demonstrating 2D quasirandomly distributed points. The points are generated
|
||||||
* using the R2 sequence and drawn as circles with a radius of 5.0.
|
* using the R2 sequence and drawn as circles with a radius of 5.0.
|
||||||
*/
|
*/
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
height = 720
|
height = 720
|
||||||
@@ -24,4 +23,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -19,8 +19,7 @@ import org.openrndr.math.Vector3
|
|||||||
* - Generation of quasirandom points in 3D space using the `rSeq3D` function.
|
* - Generation of quasirandom points in 3D space using the `rSeq3D` function.
|
||||||
* - Transformation and rendering of each point as a sphere using vertex buffers.
|
* - Transformation and rendering of each point as a sphere using vertex buffers.
|
||||||
*/
|
*/
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
height = 720
|
height = 720
|
||||||
@@ -42,4 +41,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@@ -27,8 +27,7 @@ import kotlin.math.min
|
|||||||
* of the point and its color calculated by shifting the hue of a base color using
|
* of the point and its color calculated by shifting the hue of a base color using
|
||||||
* the w-coordinate value.
|
* the w-coordinate value.
|
||||||
*/
|
*/
|
||||||
fun main() {
|
fun main() = application {
|
||||||
application {
|
|
||||||
configure {
|
configure {
|
||||||
width = 720
|
width = 720
|
||||||
height = 720
|
height = 720
|
||||||
@@ -51,4 +50,3 @@ fun main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user