diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-09-10 00:12:15 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-09-10 00:12:18 +0530 |
| commit | 80fd0d3c61f315b83c1eeda40daef31af01ad798 (patch) | |
| tree | 6998720e619f23ef5029d5a755d04ad67cba3cf2 /src/main/kotlin/play | |
| parent | bd52960a3e7bf2ecf12ec73373cd556f37af698b (diff) | |
| download | art-playground-openrndr-80fd0d3c61f315b83c1eeda40daef31af01ad798.tar.gz art-playground-openrndr-80fd0d3c61f315b83c1eeda40daef31af01ad798.zip | |
Ray-march in play_shader
Diffstat (limited to '')
| -rw-r--r-- | src/main/kotlin/play/PlayProgram.kt (renamed from src/main/kotlin/play/PlayShowProgram.kt) | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/src/main/kotlin/play/PlayShowProgram.kt b/src/main/kotlin/play/PlayProgram.kt index 4107cd7..0ec0133 100644 --- a/src/main/kotlin/play/PlayShowProgram.kt +++ b/src/main/kotlin/play/PlayProgram.kt @@ -1,12 +1,13 @@ package play +import java.io.File +import org.openrndr.Program import org.openrndr.application import org.openrndr.draw.* -import org.openrndr.extra.olive.oliveProgram import phenax.utils.* fun main() = application { - recordDuration(10) + recordDuration(10.seconds()) configure { width = 640 @@ -15,27 +16,11 @@ fun main() = application { } oliveProgram { + val cs by liveComputeShader("play_shader") // val image = loadImage("data/images/pm5544.png") // val font = loadFont("data/fonts/default.otf", 64.0) - val cs = computeStyle { - computeTransform = - """ - ivec2 coords = ivec2(gl_GlobalInvocationID.xy); - ivec2 resolution = imageSize(p_outputImg).xy; - float aspect_ratio = resolution.y*1.0 / resolution.x; - - vec2 uv = vec2(1.0, aspect_ratio) * (coords - 0.5*resolution)/resolution; - float dist = length(uv) - 0.1; - float step = step(0.0, dist); - - vec4 color = vec4(step, 0.0, 0.0, 1.0); - imageStore(p_outputImg, coords, color); - """.trimIndent() - } - // val inputBuffer = colorBuffer(width, height, type = ColorType.UINT8) - val outputBuffer = colorBuffer(width, height, type = ColorType.UINT8) extend { @@ -53,8 +38,8 @@ fun main() = application { // drawer.fill = ColorRGBa.WHITE // drawer.text("OPENRNDR", width / 2.0, height / 2.0) - cs.parameter("seconds", seconds) - cs.image("outputImg", outputBuffer.imageBinding(0, ImageAccess.WRITE)) + cs.uniform("seconds", seconds) + cs.image("outputImg", 1, outputBuffer.imageBinding(0, ImageAccess.WRITE)) cs.execute(outputBuffer.width, outputBuffer.height, 1) drawer.image(outputBuffer) } |
