[orx-noise] Add uniform hash glsl phrases

This commit is contained in:
Edwin Jakobs
2024-10-21 21:06:52 +02:00
parent 1b9264c88e
commit 7f60cc5be5
2 changed files with 145 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package phrases
import org.openrndr.application
import org.openrndr.draw.shadeStyle
import org.openrndr.extra.noise.phrases.*
/**
* Demonstrate uniform hashing function phrase in a shadestyle
*/
fun main() {
application {
program {
extend {
/** A custom shadestyle */
val ss = shadeStyle {
fragmentPreamble = """$fhash13"""
fragmentTransform = """
float cf = fhash13(vec3(c_screenPosition, p_time));
x_fill = vec4(cf, cf, cf, 1.0);
""".trimIndent()
parameter("time", seconds)
}
drawer.shadeStyle = ss
drawer.circle(drawer.bounds.center, 100.0)
}
}
}
}