From 1f9f01a2387d82e021a98488ba8ab6564b7ac328 Mon Sep 17 00:00:00 2001 From: Bendik Aagaard Lynghaug Date: Mon, 8 Jun 2026 21:00:34 +0200 Subject: [PATCH] add LICENSE, shaders, Cargo.lock, and AUR package Co-Authored-By: Claude Sonnet 4.6 --- .gitignore | 2 - Cargo.lock | 1788 +++++++++++++++++++++++++++++++++ LICENSE | 21 + aur/.SRCINFO | 21 + aur/PKGBUILD | 55 + shaders/black_hole.frag | 47 + shaders/building.frag | 719 +++++++++++++ shaders/cloud.frag | 213 ++++ shaders/cloudninja.frag | 155 +++ shaders/cubes.frag | 79 ++ shaders/example.frag | 23 + shaders/fireflies.frag | 75 ++ shaders/firering.frag | 138 +++ shaders/flags.frag | 441 ++++++++ shaders/fluid_spiral.frag | 225 +++++ shaders/green_lines.frag | 47 + shaders/light_line.frag | 63 ++ shaders/light_wave.frag | 26 + shaders/matrix.frag | 98 ++ shaders/mickey.frag | 67 ++ shaders/rainbow_donut.frag | 17 + shaders/rainbow_lights.frag | 28 + shaders/rainbow_ring.frag | 50 + shaders/rainbow_triagle.frag | 24 + shaders/red_lines.frag | 47 + shaders/slinky.frag | 90 ++ shaders/snake_torus.frag | 132 +++ shaders/snake_torus_lite.frag | 132 +++ shaders/snake_torus_mk2.frag | 159 +++ shaders/space.frag | 177 ++++ shaders/spiral.frag | 47 + shaders/torus.frag | 137 +++ shaders/trippy_cube.frag | 121 +++ shaders/tunnel.frag | 76 ++ shaders/twisty.frag | 18 + shaders/water.frag | 208 ++++ shaders/wave.frag | 41 + shaders/white_hole.frag | 226 +++++ shaders/yellow_lines.frag | 47 + 39 files changed, 6078 insertions(+), 2 deletions(-) create mode 100644 Cargo.lock create mode 100644 LICENSE create mode 100644 aur/.SRCINFO create mode 100644 aur/PKGBUILD create mode 100644 shaders/black_hole.frag create mode 100644 shaders/building.frag create mode 100644 shaders/cloud.frag create mode 100644 shaders/cloudninja.frag create mode 100644 shaders/cubes.frag create mode 100644 shaders/example.frag create mode 100644 shaders/fireflies.frag create mode 100644 shaders/firering.frag create mode 100644 shaders/flags.frag create mode 100644 shaders/fluid_spiral.frag create mode 100644 shaders/green_lines.frag create mode 100644 shaders/light_line.frag create mode 100644 shaders/light_wave.frag create mode 100644 shaders/matrix.frag create mode 100644 shaders/mickey.frag create mode 100644 shaders/rainbow_donut.frag create mode 100644 shaders/rainbow_lights.frag create mode 100644 shaders/rainbow_ring.frag create mode 100644 shaders/rainbow_triagle.frag create mode 100644 shaders/red_lines.frag create mode 100644 shaders/slinky.frag create mode 100644 shaders/snake_torus.frag create mode 100644 shaders/snake_torus_lite.frag create mode 100644 shaders/snake_torus_mk2.frag create mode 100644 shaders/space.frag create mode 100644 shaders/spiral.frag create mode 100644 shaders/torus.frag create mode 100644 shaders/trippy_cube.frag create mode 100644 shaders/tunnel.frag create mode 100644 shaders/twisty.frag create mode 100644 shaders/water.frag create mode 100644 shaders/wave.frag create mode 100644 shaders/white_hole.frag create mode 100644 shaders/yellow_lines.frag diff --git a/.gitignore b/.gitignore index ad51faa..eb5a316 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ target -Cargo.lock -shaders diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..99ad384 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1788 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bit-set" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "calloop" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dbf9978365bac10f54d1d4b04f7ce4427e51f71d61f2fe15e3fed5166474df7" +dependencies = [ + "bitflags", + "polling", + "rustix", + "slab", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop", + "rustix", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "cc" +version = "1.2.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d16d90359e986641506914ba71350897565610e87ce0ad9e6f28569db3dd5c6d" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "serde", + "termcolor", + "unicode-width", +] + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags", + "objc2", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "env_filter" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e90c2accc4b07a8456ea0debdc2e7587bdd890680d71173a15d4ae604f6eef" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glow" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror", + "windows", +] + +[[package]] +name = "gpu-descriptor" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" +dependencies = [ + "bitflags", + "gpu-descriptor-types", + "hashbrown 0.15.5", +] + +[[package]] +name = "gpu-descriptor-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" +dependencies = [ + "bitflags", +] + +[[package]] +name = "gpupaper" +version = "0.1.0" +dependencies = [ + "anyhow", + "bytemuck", + "clap", + "env_logger", + "log", + "naga", + "pollster", + "raw-window-handle", + "smithay-client-toolkit", + "wayland-backend", + "wayland-client", + "wgpu", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "jiff" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00b5dbd620d61dfdcb6007c9c1f6054ebd75319f163d886a9055cec1155073d" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e000de030ff8022ea1da3f466fbb0f3a809f5e51ed31f6dd931c35181ad8e6d7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "js-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2964e92d1d9dc3364cae4d718d93f227e3abb088e747d92e0395bfdedf1c12ca" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "memmap2" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" +dependencies = [ + "libc", +] + +[[package]] +name = "naga" +version = "29.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2630921705b9b01dcdd0b6864b9562ca3c1951eecd0f0c4f5f04f61e412647" +dependencies = [ + "arrayvec", + "bit-set", + "bitflags", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.16.1", + "hexf-parse", + "indexmap", + "libm", + "log", + "num-traits", + "once_cell", + "pp-rs", + "rustc-hash", + "spirv", + "thiserror", + "unicode-ident", +] + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags", + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-metal", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "ordered-float" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7d950ca161dc355eaf28f82b11345ed76c6e1f6eb1f4f4479e0323b9e2fbd0e" +dependencies = [ + "num-traits", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "windows-sys", +] + +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + +[[package]] +name = "portable-atomic" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + +[[package]] +name = "portable-atomic-util" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "pp-rs" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb458bb7f6e250e6eb79d5026badc10a3ebb8f9a15d1fff0f13d17c71f4d6dee" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" + +[[package]] +name = "quick-xml" +version = "0.39.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958f21e8e7ceb5a1aa7fa87fab28e7c75976e0bfe7e23ff069e0a260f894067d" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "smithay-client-toolkit" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0" +dependencies = [ + "bitflags", + "bytemuck", + "calloop", + "calloop-wayland-source", + "cursor-icon", + "libc", + "log", + "memmap2", + "pkg-config", + "rustix", + "thiserror", + "wayland-backend", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkbcommon", + "xkeysym", +] + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasm-bindgen" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf938a0bacb0469e83c1e148908bd7d5a6010354cf4fb73279b7447422e3a89" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f371d383f2fb139252e0bfac3b81b265689bf45b6874af544ffa4c975ac1ebf8" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeff24f84126c0ec2db7a449f0c2ec963c6a49efe0698c4242929da037ca28ed" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d08065faf983b2b80a79fd87d8254c409281cf7de75fc4b773019824196c904" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd04d9e306f1907bd13c6361b5c6bfc7b3b3c095ed3f8a9246390f8dbdee129" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2857dd20b54e916ec7253b3d6b4d5c4d7d4ca2c33c2e11c6c76a99bd8744755d" +dependencies = [ + "cc", + "downcast-rs", + "rustix", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c7c96bb74690c3189b5c9cb4ca1627062bb23693a4fad9d8c3de958260144" +dependencies = [ + "bitflags", + "rustix", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "563a85523cade2429938e790815fd7319062103b9f4a2dc806e9b53b95982d8f" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-experimental" +version = "20250721.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c324a910fd86ebdc364a3e61ec1f11737d3b1d6c273c0239ee8ff4bc0d24b4a" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2dfbb17949fa2088e5d39408c48368947b86f7834484e87b73de55bc14d97d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wgpu" +version = "29.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c239a9a747bbd379590985bac952c2e53cb19873f7072b3370c6a6a8e06837" +dependencies = [ + "arrayvec", + "bitflags", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "js-sys", + "log", + "naga", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "29.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e80ac6cf1895df6342f87d975162108f9d98772a0d74bc404ab7304ac29469e" +dependencies = [ + "arrayvec", + "bit-set", + "bit-vec", + "bitflags", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "indexmap", + "log", + "naga", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash", + "smallvec", + "thiserror", + "wgpu-core-deps-apple", + "wgpu-core-deps-emscripten", + "wgpu-core-deps-windows-linux-android", + "wgpu-hal", + "wgpu-naga-bridge", + "wgpu-types", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "29.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43acd053312501689cd92a01a9638d37f3e41a5fd9534875efa8917ee2d11ac0" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "29.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef043bf135cc68b6f667c55ff4e345ce2b5924d75bad36a47921b0287ca4b24a" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "29.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "725d5c006a8c02967b6d93ef04f6537ec4593313e330cfe86d9d3f946eb90f28" +dependencies = [ + "wgpu-hal", +] + +[[package]] +name = "wgpu-hal" +version = "29.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89a47aef47636562f3937285af4c44b4b5b404b46577471411cc5313a921da7e" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags", + "block2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow", + "glutin_wgl_sys", + "gpu-allocator", + "gpu-descriptor", + "hashbrown 0.16.1", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "naga", + "ndk-sys", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-metal", + "objc2-quartz-core", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "thiserror", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge", + "wgpu-types", + "windows", + "windows-core", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "29.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4684f4410da0cf95a4cb63bb5edaac022461dedb6adf0b64d0d9b5f6890d51" +dependencies = [ + "naga", + "wgpu-types", +] + +[[package]] +name = "wgpu-types" +version = "29.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec2675540fb1a5cfa5ef122d3d5f390e2c75711a0b946410f2d6ac3a0f77d1f6" +dependencies = [ + "bitflags", + "bytemuck", + "js-sys", + "log", + "raw-window-handle", + "web-sys", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "xcursor" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec9e4a500ca8864c5b47b8b482a73d62e4237670e5b5f1d6b9e3cae50f28f2b" + +[[package]] +name = "xkbcommon" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d66ca9352cbd4eecbbc40871d8a11b4ac8107cfc528a6e14d7c19c69d0e1ac9" +dependencies = [ + "libc", + "memmap2", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "xml-rs" +version = "0.8.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f" + +[[package]] +name = "zerocopy" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..add8a78 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Bendik Aagaard Lynghaug + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/aur/.SRCINFO b/aur/.SRCINFO new file mode 100644 index 0000000..86148bc --- /dev/null +++ b/aur/.SRCINFO @@ -0,0 +1,21 @@ +pkgbase = gpupaper-git + pkgdesc = Wayland layer-surface wallpaper runner powered by GLSL/WGSL fragment shaders (wgpu) + pkgver = r1.f53340a + pkgrel = 1 + url = https://prosjekt.klingenbergbygg.no/bl/gpupaper + arch = x86_64 + arch = aarch64 + license = MIT + makedepends = rust + makedepends = cargo + depends = wayland + depends = libglvnd + optdepends = vulkan-icd-loader: Vulkan backend (generic loader) + optdepends = mesa: open-source Vulkan/OpenGL for AMD, Intel, and Raspberry Pi + optdepends = nvidia-utils: NVIDIA Vulkan/OpenGL support + provides = gpupaper + conflicts = gpupaper + source = gpupaper::git+https://prosjekt.klingenbergbygg.no/bl/gpupaper.git + sha256sums = SKIP + +pkgname = gpupaper-git diff --git a/aur/PKGBUILD b/aur/PKGBUILD new file mode 100644 index 0000000..c5defda --- /dev/null +++ b/aur/PKGBUILD @@ -0,0 +1,55 @@ +# Maintainer: Bendik Aagaard Lynghaug +pkgname=gpupaper-git +pkgver=r1.f53340a +pkgrel=1 +pkgdesc="Wayland layer-surface wallpaper runner powered by GLSL/WGSL fragment shaders (wgpu)" +arch=('x86_64' 'aarch64') +url="https://prosjekt.klingenbergbygg.no/bl/gpupaper" +license=('MIT') +depends=('wayland' 'libglvnd') +makedepends=('rust' 'cargo') +optdepends=( + 'vulkan-icd-loader: Vulkan backend (generic loader)' + 'mesa: open-source Vulkan/OpenGL for AMD, Intel, and Raspberry Pi' + 'nvidia-utils: NVIDIA Vulkan/OpenGL support' +) +provides=('gpupaper') +conflicts=('gpupaper') +source=("gpupaper::git+https://prosjekt.klingenbergbygg.no/bl/gpupaper.git") +sha256sums=('SKIP') + +pkgver() { + cd "$srcdir/gpupaper" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd "$srcdir/gpupaper" + export RUSTUP_TOOLCHAIN=stable + cargo fetch --target "$(rustc -vV | sed -n 's/host: //p')" +} + +build() { + cd "$srcdir/gpupaper" + export RUSTUP_TOOLCHAIN=stable + export CARGO_TARGET_DIR=target + cargo build --offline --release +} + +check() { + cd "$srcdir/gpupaper" + export RUSTUP_TOOLCHAIN=stable + cargo test --offline +} + +package() { + cd "$srcdir/gpupaper" + + install -Dm755 "target/release/gpupaper" "$pkgdir/usr/bin/gpupaper" + + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + # Example shaders + install -dm755 "$pkgdir/usr/share/gpupaper/shaders" + install -Dm644 shaders/*.frag "$pkgdir/usr/share/gpupaper/shaders/" +} diff --git a/shaders/black_hole.frag b/shaders/black_hole.frag new file mode 100644 index 0000000..647f931 --- /dev/null +++ b/shaders/black_hole.frag @@ -0,0 +1,47 @@ +//#ifdef GL_ES -- Nice little tunnel... any idea ? -Harley +precision mediump float; +//#endif + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; + +float pi = 3.1415926; +vec2 Offset; +vec2 Scale=vec2(0.002,0.002); +float Saturation = 0.9; // 0 - 1; + + +vec3 lungth(vec2 x,vec3 c){ + return vec3(length(x+c.r),length(x+c.g),length(c.b)); +} + +void main( void ) { + vec2 R = resolution; + + vec2 position = (gl_FragCoord.xy - resolution * 0.5) / resolution.yy; + float th = atan(position.y, position.x) / (1.0 * pi); + float dd = length(position) + 0.00005; + float d = 0.5 / dd + time; + + vec2 x = gl_FragCoord.xy; + vec3 c2=vec3(0,0,0); + x=R*x*Scale*R/R.x; + x*x+sin(x.yx*sqrt(vec2(7,9)))/1.; + c2=lungth(sin(x*sqrt(vec2(3,43))),vec3(5,6,7)*Saturation * d); + x+=sin(x.yx*sqrt(vec2(73,5)))/5.; + c2=2.*lungth(sin(time+x*sqrt(vec2(33.,23.))),c2/9.); + x+=sin(x.yx*sqrt(vec2(93,7)))/3.; + c2=lungth(sin(x*sqrt(vec2(3.,1.))),c2/2.0); + c2=.5+.5*sin(c2*8.); + + vec3 uv = vec3(th + d, th - d, th + sin(d) * 0.45); + float a = 0.5 + cos(uv.x * pi * 2.0) * 0.5; + float b = 0.5 + cos(uv.y * pi * 2.0) * 0.5; + float c = 0.5 + cos(uv.z * pi * 6.0) * 0.5; + vec3 color = mix(vec3(0.5, 0.5, 0.5), vec3(0.1, 0.1, 0.2), pow(a, 0.2)) * 3.; + color += mix(vec3(1.0, 0.2, 1.0), vec3(0.1, 0.1, 0.2), pow(b, 0.1)) * 0.75; + color += mix(c2, vec3(0.1, 0.2, 0.2), pow(c, 0.1)) * 0.75; + + gl_FragColor = vec4( (color * dd), 1.0); +} diff --git a/shaders/building.frag b/shaders/building.frag new file mode 100644 index 0000000..59c00a5 --- /dev/null +++ b/shaders/building.frag @@ -0,0 +1,719 @@ +/* + * Original shader from: https://www.shadertoy.com/view/ltBczc + */ + +#ifdef GL_ES +precision mediump float; +#endif + +// glslsandbox uniforms +uniform float time; +uniform vec2 resolution; + +// shadertoy globals +float iTime = 0.0; +vec3 iResolution = vec3(0.0); +const vec4 iMouse = vec4(0.0); + +// --------[ Original ShaderToy begins here ]---------- // +// "Ocean Structure" by dr2 - 2017 +// License: Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License + +#define REAL_WAVE 0 // real (=1) or fake (=0, less work) water waves +#define N_REFL 3 // number of reflections (1-4, 0 = none) + +float PrBoxDf (vec3 p, vec3 b); +float PrSphDf (vec3 p, float s); +float PrSphAnDf (vec3 p, float r, float w); +float PrCylDf (vec3 p, float r, float h); +float PrTorusDf (vec3 p, float ri, float rc); +float PrCapsDf (vec3 p, float r, float h); +float PrCapsAnDf (vec3 p, float r, float w, float h); +float PrFlatCylDf (vec3 p, float rhi, float rlo, float h); +float Noisefv2 (vec2 p); +float Noisefv3 (vec3 p); +float Fbm1 (float p); +float Fbm2 (vec2 p); +float Fbm3 (vec3 p); +vec3 VaryNf (vec3 p, vec3 n, float f); +vec3 HsvToRgb (vec3 c); +vec2 Rot2D (vec2 q, float a); + +vec3 qHit = vec3(0.), sunDir = vec3(0.), smkPos = vec3(0.); +float dstFar = 0., tCur = 0., smkRadEx = 0., smkRadIn = 0., smkPhs = 0., smkHt = 0., tWav = 0.; +int idObj = 0; +bool isNite = false; +const int idBase = 1, idPlat = 2, isShel = 3, idFrm = 4, idDway = 5, + idTwr = 6, idBrg = 7, idBrCab = 8, idRdw = 9; +const float pi = 3.14159; + +float BridgeDf (vec3 p, float dMin) +{ + float cbRad = 0.06; + vec3 q, qq; + float d, cLen, wRd; + wRd = 1.; + q = p; q.x = abs (q.x) - wRd; q.y -= -0.3; + d = PrBoxDf (q, vec3 (0.15, 5., 0.15)); + q = p; q.y -= 4.85; + d = min (d, PrBoxDf (q, vec3 (wRd + 0.15, 0.15, 0.15))); + if (d < dMin) { dMin = d; qHit = q; idObj = idBrg; } + qq = p; qq.x = abs (qq.x) - wRd + 0.07; qq.z = abs (qq.z); + q = qq; q.y -= 4.92; + q.yz = Rot2D (q.yz, -0.1 * pi); + q.z -= 9.5; + d = PrCylDf (q, cbRad, 9.5); + q = qq; q.y -= 4.82; + q.yz = Rot2D (q.yz, -0.15 * pi); + q.z -= 6.4; + d = min (d, PrCylDf (q, cbRad, 6.4)); + q = qq; q.y -= 4.77; + q.yz = Rot2D (q.yz, -0.26 * pi); + q.z -= 4.; + d = min (d, PrCylDf (q, cbRad, 4.)); + if (d < dMin) { dMin = d; qHit = q; idObj = idBrCab; } + return dMin; +} + +float CentStrucDf (vec3 p, float dMin, float ar) +{ + float cRad = 6., cLen = 8., ww = 0.03, wThk = 0.05, + doorHt = 1.6, doorWd = 1.4; + vec3 q; + vec2 qo; + float d, dd; + q = p; q.y -= -1.05; + d = PrCylDf (q.xzy, 8.5, 0.15); + if (d < dMin) { dMin = d; qHit = q; idObj = idPlat; } + d = PrTorusDf (vec3 (q.xz, abs (abs (q.y - 1.1) - 0.4) - 0.2), 0.03, 8.5); + q.xz = Rot2D (q.xz, 2. * pi * (floor (16. * ar) + 0.5) / 16.); + q.xy -= vec2 (-8.5, 0.9); + d = min (d, PrCylDf (q.xzy, 0.05, 0.82)); + if (d < dMin) { dMin = d; qHit = q; idObj = idBrCab; } + q = p; + qo = Rot2D (q.xz, 2. * pi * (floor (4. * ar) + 0.5) / 4.); + q.xz = qo; q.y -= cLen + 1.2 * doorHt - 9.; + dd = PrFlatCylDf (q.yzx, doorHt, doorWd, 0.); + q = p; q.y -= cLen - 9.; + d = max (max (max (PrCapsAnDf (q.xzy, cRad, wThk, cLen), - q.y), q.y - 1.635 * cLen), - dd); + if (d < dMin) { dMin = d; qHit = q; idObj = isShel; } + q.xz = Rot2D (q.xz, 2. * pi * (floor (8. * ar) + 0.5) / 8.); + d = max (max (max (PrCapsAnDf (q.xzy, cRad, 0.2, cLen), + min (abs (mod (q.y, 2.) - 1.) - 0.1, + dot (vec2 (q.x, abs (q.z)), vec2 (sin (0.04 * 2. * pi / 16.), cos (0.04 * 2. * pi / 16.))))), + - q.y), - dd); + if (d < dMin) { dMin = d; qHit = q; idObj = idFrm; } + q = p; q.xz = qo; q.xy -= vec2 (-0.98 * cRad, cLen + 1.2 * doorHt - 9.); + d = max (max (max (PrFlatCylDf (q.yzx, doorHt, doorWd, 0.1 * cRad), + - PrFlatCylDf (q.yzx, doorHt - ww, doorWd - ww, 0.)), + - (q.y + 2. * doorHt - ww - wThk)), - (q.y + 1.2 * doorHt)); + if (d < dMin) { dMin = d; qHit = q; idObj = idDway; } + return dMin; +} + +float CornStrucDf (vec3 p, float dMin) +{ + vec3 q; + float d, a; + q = p; q.y -= -1.2; + d = PrCylDf (q.xzy, 3.2, 0.15); + if (d < dMin) { dMin = d; qHit = q; idObj = idPlat; } + q = p; q.y -= 1.; + d = max (PrCapsAnDf (q.xzy, 2.5, 0.1, 3.), -2.2 - q.y); + q = p; q.y -= 7.; + d = min (d, max (PrCapsDf (q.xzy, 0.7, 2.), -1. - q.y)); + q = p; + a = (length (q.xz) > 0.) ? atan (q.z, - q.x) / (2. * pi) : 0.; + q.xz = Rot2D (q.xz, 2. * pi * (floor (4. * a + 0.5) / 4.)); + d = max (d, - PrFlatCylDf (q.yzx, 1.5, 1., 0.)); + q = p; + q.xz = Rot2D (q.xz, 2. * pi * (floor (16. * a) + 0.5) / 16.); + q.y -= 4.3; + d = max (d, - (length (max (abs (q.yz) - vec2 (0.6, 0.08), 0.)) - 0.2)); + if (d < dMin) { dMin = d; qHit = q; idObj = idTwr; } + return dMin; +} + +float ObjDf (vec3 p) +{ + vec3 q; + float d, dMin, hs, wRd, ar; + dMin = dstFar; + hs = 5.; + q = p; q.xz = abs (q.xz) - 4.; + d = max (PrSphAnDf (q, 4.85, 0.15), - min (3.9 - q.y, q.y)); + q.y -= 0.5; + d = max (d, 2.2 - min (length (q.yz), length (q.xy))); + if (d < dMin) { dMin = d; qHit = q; idObj = idBase; } + q = p; q.xz = abs (q.xz) - 20.; + d = max (PrSphAnDf (q, 4.85, 0.15), - min (3.9 - q.y, q.y)); + q.y -= 0.5; + d = max (d, 2.2 - min (length (q.yz), length (q.xy))); + if (d < dMin) { dMin = d; qHit = q; idObj = idBase; } + wRd = 1.; + q = p; q.xz = abs (q.xz) - 20.7 + wRd; + d = max (max (length (max (q.xz - wRd, 0.)) - 0.3, + - (length (max (q.xz + wRd, 0.)) - 0.3)), abs (q.y - hs + 1.) - 0.1); + if (d < dMin) { dMin = d; qHit = q; idObj = idRdw; } + q = p; + ar = (length (p.xz) > 0.) ? atan (p.z, - p.x) / (2. * pi) : 0.; + q.y -= hs; + dMin = CentStrucDf (q, dMin, ar); + q = p; q.y -= hs; q.xz = abs (q.xz) - vec2 (20.); + dMin = CornStrucDf (q, dMin); + q = p; q.y -= hs; + q.xz = Rot2D (q.xz, 2. * pi * (floor (4. * ar + 0.5) / 4.)); + q.x += 20.; + dMin = BridgeDf (q, dMin); + return dMin; +} + +float ObjRay (vec3 ro, vec3 rd) +{ + float dHit, d; + dHit = 0.; + for (int j = 0; j < 120; j ++) { + d = ObjDf (ro + dHit * rd); + dHit += d; + if (d < 0.001 || dHit > dstFar) break; + } + return dHit; +} + +vec3 ObjNf (vec3 p) +{ + vec4 v; + vec3 e = vec3 (0.001, -0.001, 0.); + v = vec4 (ObjDf (p + e.xxx), ObjDf (p + e.xyy), ObjDf (p + e.yxy), ObjDf (p + e.yyx)); + return normalize (vec3 (v.x - v.y - v.z - v.w) + 2. * v.yzw); +} + +float WaveHt (vec2 p) +{ + mat2 qRot = mat2 (0.8, -0.6, 0.6, 0.8); + vec4 t4, v4; + vec2 t; + float wFreq, wAmp, ht; + wFreq = 1.; + wAmp = 1.; + ht = 0.; + for (int j = 0; j < 3; j ++) { + p *= qRot; + t = tWav * vec2 (1., -1.); + t4 = (p.xyxy + t.xxyy) * wFreq; + t = vec2 (Noisefv2 (t4.xy), Noisefv2 (t4.zw)); + t4 += 2. * t.xxyy - 1.; + v4 = (1. - abs (sin (t4))) * (abs (sin (t4)) + abs (cos (t4))); + ht += wAmp * dot (pow (1. - sqrt (v4.xz * v4.yw), vec2 (8.)), vec2 (1.)); + wFreq *= 2.; + wAmp *= 0.5; + } + return ht; +} + +vec3 WaveNf (vec3 p, float d) +{ + vec3 vn; + vec2 e; + e = vec2 (max (0.01, 0.005 * d * d), 0.); + p *= 0.3; + vn.xz = 0.4 * (WaveHt (p.xz) - vec2 (WaveHt (p.xz + e.xy), WaveHt (p.xz + e.yx))); + vn.y = e.x; + return normalize (vn); +} + +#if REAL_WAVE + +float WaveRay (vec3 ro, vec3 rd) +{ + vec3 p; + float dHit, h, s, sLo, sHi, f1, f2; + dHit = dstFar; + f1 = 0.4; + f2 = 0.3; + s = max (- (ro.y - 1.2 * f1) / rd.y, 0.); + sLo = s; + for (int j = 0; j < 80; j ++) { + p = ro + s * rd; + h = p.y - f1 * WaveHt (f2 * p.xz); + if (h < 0.) break; + sLo = s; + s += max (0.3, h) + 0.005 * s; + if (s >= dstFar) break; + } + if (h < 0.) { + sHi = s; + for (int j = 0; j < 5; j ++) { + s = 0.5 * (sLo + sHi); + p = ro + s * rd; + h = step (0., p.y - f1 * WaveHt (f2 * p.xz)); + sLo += h * (s - sLo); + sHi += (1. - h) * (s - sHi); + } + dHit = sHi; + } + return dHit; +} + +#endif + +float SmokeDens (vec3 p) +{ + mat2 rMat; + vec3 q, u; + float f; + f = PrTorusDf (p.xzy, smkRadIn, smkRadEx); + if (f < 0.) { + q = p.xzy / smkRadEx; + u = normalize (vec3 (q.xy, 0.)); + q -= u; + rMat = mat2 (vec2 (u.x, - u.y), u.yx); + q.xy = rMat * q.xy; + q.xz = Rot2D (q.xz, 2.5 * tCur); + q.xy = q.xy * rMat; + q += u; + q.xy = Rot2D (q.xy, 0.1 * tCur); + f = smoothstep (0., smkRadIn, - f) * Fbm3 (10. * q); + } else f = 0.; + return f; +} + +vec4 SmokeCol (vec3 ro, vec3 rd, float dstObj) +{ + vec4 col4; + vec3 q; + float densFac, dens, d, h, sh; + d = 0.; + for (int j = 0; j < 150; j ++) { + q = ro + d * rd; + q.xz = abs (q.xz); + q -= smkPos; + h = PrTorusDf (q.xzy, smkRadIn, smkRadEx); + d += h; + if (h < 0.001 || d > dstFar) break; + } + col4 = vec4 (0.); + if (d < min (dstObj, dstFar)) { + densFac = 1.45 * (1.08 - pow (smkPhs, 1.5)); + for (int j = 0; j < 150; j ++) { + q = ro + d * rd; + q.xz = abs (q.xz); + q -= smkPos; + dens = SmokeDens (q); + sh = 0.3 + 0.7 * smoothstep (-0.3, 0.1, dens - SmokeDens (q + 0.1 * sunDir)); + col4 += densFac * dens * (1. - col4.w) * vec4 (sh * vec3 (0.9) - col4.rgb, 0.3); + d += 2.2 * smkRadEx / 150.; + if (col4.w > 0.99 || d > dstFar) break; + } + } + if (isNite) col4.rgb *= vec3 (0.3, 0.4, 0.3); + return col4; +} + +vec4 ObjCol (vec3 n) +{ + vec4 col; + if (idObj == idBase) col = vec4 (0.3, 0.4, 0.1, 0.1); + else if (idObj == idPlat) col = vec4 (0.4, 0.4, 0.3, 0.1); + else if (idObj == isShel) col = vec4 (0.5, 0.5, 0.5, 0.3); + else if (idObj == idFrm) col = vec4 (0.8, 0.8, 0.9, 0.5); + else if (idObj == idDway) col = vec4 (0.7, 0.8, 0.7, 0.3); + else if (idObj == idTwr) col = vec4 (0.7, 0.7, 0.6, 0.3); + else if (idObj == idBrg) col = vec4 (1., 0.3, 0.3, 0.3); + else if (idObj == idBrCab) col = vec4 (0.9, 0.9, 1., 0.5); + else if (idObj == idRdw) col = vec4 (0.4, 0.3, 0.3, 0.1); + return col; +} + +vec4 AurCol (vec3 ro, vec3 rd) +{ + vec4 col, mCol; + vec3 p, dp; + float ar; + dp = rd / rd.y; + p = ro + (40. - ro.y) * dp; + col = vec4 (0.); + mCol = vec4 (0.); + tWav = 0.05 * tCur; + for (float ns = 0.; ns < 50.; ns ++) { + p += dp; + ar = 0.05 - clamp (0.06 * WaveHt (0.01 * p.xz), 0., 0.04); + mCol = mix (mCol, ar * vec4 (HsvToRgb (vec3 (0.34 + 0.007 * ns, 1., 1. - 0.02 * ns)), 1.), 0.5); + col += mCol; + } + return col; +} + +vec3 NtSkyCol (vec3 rd) +{ + vec3 rds; + rds = floor (2000. * rd); + rds = 0.00015 * rds + 0.1 * Noisefv3 (0.0005 * rds.yzx); + for (int j = 0; j < 19; j ++) rds = abs (rds) / dot (rds, rds) - 0.9; + return 0.3 * vec3 (1., 1., 0.9) * min (1., 0.5e-3 * pow (min (6., length (rds)), 5.)); +} + +vec3 BgCol (vec3 ro, vec3 rd) +{ + vec3 col; + float f, a; + if (rd.y > 0.) { + a = atan (rd.x, - rd.z); + if (rd.y < 0.03 * Fbm1 (32. * a) + 0.005) + col = (isNite ? vec3 (0.07, 0.1, 0.07) : vec3 (0.4, 0.5, 0.7)) * (1. - 0.3 * Fbm2 (128. * vec2 (a, rd.y))); + else { + if (isNite) { + vec4 aCol = AurCol (ro, rd); + col = (1. - 0.5 * aCol.a) * NtSkyCol (rd) + 0.6 * aCol.rgb; + } else { + ro.xz += 2. * tCur; + col = vec3 (0.2, 0.3, 0.6) + 0.2 * (1. - max (rd.y, 0.)) + + 0.1 * pow (max (dot (rd, sunDir), 0.), 16.); + f = Fbm2 (0.02 * (ro.xz + rd.xz * (100. - ro.y) / max (rd.y, 0.01))); + col = mix (col, vec3 (1.), 0.2 + 0.8 * f * rd.y); + } + } + } else { + col = vec3 (0.6, 0.5, 0.3); + if (- ro.y / rd.y < dstFar) { + ro += - (ro.y / rd.y) * rd; + col *= 1.1 - 0.2 * Noisefv2 (30. * ro.xz); + } + col = mix (col, 0.9 * (vec3 (0.4, 0.2, 0.1) + 0.2) + 0.1, pow (1. + rd.y, 5.)); + } + return col; +} + +vec4 GlowCol (vec3 ro, vec3 rd, float dstObj) +{ + vec3 gloDir; + float gloDist, wGlow, s; + wGlow = 0.; + for (float j = 0.; j < 4.; j ++) { + gloDir = vec3 (20., 9.3, 20.) * (1. - 2. * vec3 (floor (j / 2.), 0., mod (j, 2.))) - ro; + gloDist = length (gloDir); + s = dot (rd, normalize (gloDir)); + if (s > 0. && gloDist < dstObj) wGlow += 1. - smoothstep (1., 2., sqrt (1. - s * s) * gloDist); + } + gloDir = vec3 (0., 15.5, 0.) - ro; + gloDist = length (gloDir); + s = dot (rd, normalize (gloDir)); + if (s > 0. && gloDist < dstObj) wGlow += 1. - smoothstep (2., 3., sqrt (1. - s * s) * gloDist); + return (0.6 + 0.4 * sin (0.3 * 2. * pi * tCur)) * clamp (wGlow, 0., 1.) * vec4 (1., 0.5, 0.3, 1.); +} + +vec3 ShowScene (vec3 ro, vec3 rd) +{ + vec4 objCol, smkCol, smkColR, smkColW, glwCol, glwColR, glwColW; + vec3 col, vn; + float dstObj, dstWat, reflCol; + bool wRefl; + col = vec3 (0.2, 0.2, 0.); + wRefl = false; + dstObj = ObjRay (ro, rd); + smkCol = SmokeCol (ro, rd, dstObj); + glwCol = GlowCol (ro, rd, dstObj); + glwColR = vec4 (0.); + glwColW = vec4 (0.); + smkColR = vec4 (0.); + smkColW = vec4 (0.); + tWav = 0.4 * tCur; + reflCol = 1.; + if (N_REFL >= 2 && dstObj < dstFar && idObj == isShel) { + if (length (qHit.xz) > 6. || qHit.y >= 8.8) { + ro += dstObj * rd; + vn = ObjNf (ro); + rd = reflect (rd, vn); + ro += 0.01 * rd; + dstObj = ObjRay (ro, rd); + smkColR = SmokeCol (ro, rd, dstObj); + glwColR = GlowCol (ro, rd, dstObj); + reflCol *= 0.9; + } + } + if (N_REFL >= 1 && rd.y < 0.) { +#if REAL_WAVE + dstWat = WaveRay (ro, rd); +#else + dstWat = - ro.y / rd.y; +#endif + if (dstWat < min (dstObj, dstFar)) { + wRefl = true; + ro += dstWat * rd; + vn = WaveNf (ro, dstWat); + rd = reflect (rd, vn); + ro += 0.01 * rd; + dstObj = ObjRay (ro, rd); + smkColW = SmokeCol (ro, rd, dstObj); + glwColW = GlowCol (ro, rd, dstObj); + if (N_REFL >= 3 && dstObj < dstFar && idObj == isShel) { + ro += dstObj * rd; + vn = ObjNf (ro); + rd = reflect (rd, vn); + if (N_REFL == 4) { + ro += 0.01 * rd; + dstObj = ObjRay (ro, rd); + } else { + dstObj = dstFar; + } + } + reflCol *= 0.7; + } + } + if (dstObj < dstFar) { + ro += dstObj * rd; + vn = ObjNf (ro); + if (idObj == idRdw) vn = VaryNf (5. * qHit, vn, 1.); + else if (idObj == idBase) vn = VaryNf (2. * floor (16. * qHit), vn, 2.); + objCol = ObjCol (vn); + if (isNite) col = objCol.rgb * vec3 (0.3, 0.35, 0.3) * (0.2 + 0.8 * max (0.,vn.y)); + else col = objCol.rgb * (0.2 + 0.8 * max (0., max (dot (vn, sunDir), 0.))) + + objCol.a * pow (max (dot (normalize (sunDir - rd), vn), 0.), 64.); + } else if (rd.y > 0.) { + col = BgCol (ro, rd); + } else { +#if N_REFL == 0 + dstWat = - ro.y / rd.y; +#endif + col = BgCol (ro + dstWat * rd, reflect (rd, vec3 (0., 1., 0.))); + reflCol = 0.7; + } + col = clamp (reflCol * col, 0., 1.); + col = mix (col, glwCol.rgb, glwCol.a); + col = mix (col, glwColR.rgb, glwColR.a); + col = mix (col, smkCol.rgb, smkCol.a); + col = mix (col, smkColR.rgb, smkColR.a); + if (wRefl) { + col = mix (col, reflCol * glwColW.rgb, glwColW.a); + col = mix (col, reflCol * smkColW.rgb, smkColW.a); + col = mix (mix (vec3 (0., 0.1, 0.), vec3 (0., 0.05, 0.05), + smoothstep (0.4, 0.6, Fbm2 (0.5 * ro.xz))), col, 1. - pow (abs (rd.y), 4.)); + } + return clamp (col, 0., 1.); +} + +void mainImage (out vec4 fragColor, in vec2 fragCoord) +{ + mat3 vuMat; + vec4 mPtr; + vec3 ro, rd; + vec2 uv, ori, ca, sa; + float el, az; + uv = 2. * fragCoord.xy / iResolution.xy - 1.; + uv.x *= iResolution.x / iResolution.y; + tCur = iTime; + mPtr = iMouse; + mPtr.xy = mPtr.xy / iResolution.xy - 0.5; + smkPhs = mod (0.15 * tCur + 0.3, 1.); + smkPos = vec3 (20., 9. + 10. * smkPhs, 20.); + smkRadIn = 0.6 * (0.1 + 0.9 * smoothstep (0.01, 0.1, smkPhs)); + smkRadEx = smkRadIn + 2.5; + dstFar = 140.; + isNite = true; + az = 0.33 * pi; + el = -0.016 * pi; + if (mPtr.z > 0.) { + if (mPtr.x > 0.45 && mPtr.y < -0.45) isNite = false; + else { + az += pi * mPtr.x; + el += 0.05 * pi * mPtr.y; + } + } else { + az += 0.002 * pi * tCur; + el += 0.01 * pi * sin (0.01 * pi * tCur); + } + el = clamp (el, -0.4 * pi, -0.01 * pi); + ori = vec2 (el, az); + ca = cos (ori); + sa = sin (ori); + vuMat = mat3 (ca.y, 0., - sa.y, 0., 1., 0., sa.y, 0., ca.y) * + mat3 (1., 0., 0., 0., ca.x, - sa.x, 0., sa.x, ca.x); + ro = vuMat * vec3 (0., 10., -100.); + rd = vuMat * normalize (vec3 (uv, 4.2)); + sunDir = vuMat * normalize (vec3 (1., 1., -1.)); + fragColor = vec4 (ShowScene (ro, rd), 1.); +} + +float PrBoxDf (vec3 p, vec3 b) +{ + vec3 d; + d = abs (p) - b; + return min (max (d.x, max (d.y, d.z)), 0.) + length (max (d, 0.)); +} + +float PrSphDf (vec3 p, float s) +{ + return length (p) - s; +} + +float PrSphAnDf (vec3 p, float r, float w) +{ + return abs (length (p) - r) - w; +} + +float PrCylDf (vec3 p, float r, float h) +{ + return max (length (p.xy) - r, abs (p.z) - h); +} + +float PrCapsDf (vec3 p, float r, float h) +{ + return length (p - vec3 (0., 0., h * clamp (p.z / h, -1., 1.))) - r; +} + +float PrCapsAnDf (vec3 p, float r, float w, float h) +{ + p.z = abs (p.z); + return max (length (p - vec3 (0., 0., min (p.z, h + w))) - r, + - length (p - vec3 (0., 0., min (p.z, h - w))) + r) - w; +} + +float PrFlatCylDf (vec3 p, float rhi, float rlo, float h) +{ + float d; + d = length (p.xy - vec2 (rhi * clamp (p.x / rhi, -1., 1.), 0.)) - rlo; + if (h > 0.) d = max (d, abs (p.z) - h); + return d; +} + +float PrTorusDf (vec3 p, float ri, float rc) +{ + return length (vec2 (length (p.xy) - rc, p.z)) - ri; +} + +const float cHashM = 43758.54; + +vec2 Hashv2f (float p) +{ + return fract (sin (p + vec2 (0., 1.)) * cHashM); +} + +vec2 Hashv2v2 (vec2 p) +{ + vec2 cHashVA2 = vec2 (37., 39.); + return fract (sin (vec2 (dot (p, cHashVA2), dot (p + vec2 (1., 0.), cHashVA2))) * cHashM); +} + +vec4 Hashv4v3 (vec3 p) +{ + vec3 cHashVA3 = vec3 (37., 39., 41.); + vec2 e = vec2 (1., 0.); + return fract (sin (vec4 (dot (p + e.yyy, cHashVA3), dot (p + e.xyy, cHashVA3), + dot (p + e.yxy, cHashVA3), dot (p + e.xxy, cHashVA3))) * cHashM); +} + +float Noiseff (float p) +{ + vec2 t; + float ip, fp; + ip = floor (p); + fp = fract (p); + fp = fp * fp * (3. - 2. * fp); + t = Hashv2f (ip); + return mix (t.x, t.y, fp); +} + +float Noisefv2 (vec2 p) +{ + vec2 t, ip, fp; + ip = floor (p); + fp = fract (p); + fp = fp * fp * (3. - 2. * fp); + t = mix (Hashv2v2 (ip), Hashv2v2 (ip + vec2 (0., 1.)), fp.y); + return mix (t.x, t.y, fp.x); +} + +float Noisefv3 (vec3 p) +{ + vec4 t; + vec3 ip, fp; + ip = floor (p); + fp = fract (p); + fp *= fp * (3. - 2. * fp); + t = mix (Hashv4v3 (ip), Hashv4v3 (ip + vec3 (0., 0., 1.)), fp.z); + return mix (mix (t.x, t.y, fp.x), mix (t.z, t.w, fp.x), fp.y); +} + +float Fbm1 (float p) +{ + float f, a; + f = 0.; + a = 1.; + for (int i = 0; i < 5; i ++) { + f += a * Noiseff (p); + a *= 0.5; + p *= 2.; + } + return f * (1. / 1.9375); +} + +float Fbm2 (vec2 p) +{ + float f, a; + f = 0.; + a = 1.; + for (int i = 0; i < 5; i ++) { + f += a * Noisefv2 (p); + a *= 0.5; + p *= 2.; + } + return f * (1. / 1.9375); +} + +float Fbm3 (vec3 p) +{ + float f, a; + f = 0.; + a = 1.; + for (int i = 0; i < 5; i ++) { + f += a * Noisefv3 (p); + a *= 0.5; + p *= 2.; + } + return f * (1. / 1.9375); +} + +float Fbmn (vec3 p, vec3 n) +{ + vec3 s; + float a; + s = vec3 (0.); + a = 1.; + for (int i = 0; i < 5; i ++) { + s += a * vec3 (Noisefv2 (p.yz), Noisefv2 (p.zx), Noisefv2 (p.xy)); + a *= 0.5; + p *= 2.; + } + return dot (s, abs (n)); +} + +vec3 VaryNf (vec3 p, vec3 n, float f) +{ + vec3 g; + vec2 e = vec2 (0.1, 0.); + g = vec3 (Fbmn (p + e.xyy, n), Fbmn (p + e.yxy, n), Fbmn (p + e.yyx, n)) - Fbmn (p, n); + return normalize (n + f * (g - n * dot (n, g))); +} + +vec3 HsvToRgb (vec3 c) +{ + vec3 p; + p = abs (fract (c.xxx + vec3 (1., 2./3., 1./3.)) * 6. - 3.); + return c.z * mix (vec3 (1.), clamp (p - 1., 0., 1.), c.y); +} + +vec2 Rot2D (vec2 q, float a) +{ + return q * cos (a) + q.yx * sin (a) * vec2 (-1., 1.); +} + +// --------[ Original ShaderToy ends here ]---------- // + +void main(void) +{ + iTime = time; + iResolution = vec3(resolution, 0.0); + + mainImage(gl_FragColor, gl_FragCoord.xy); + gl_FragColor.a = 1.0; +} diff --git a/shaders/cloud.frag b/shaders/cloud.frag new file mode 100644 index 0000000..a75dc69 --- /dev/null +++ b/shaders/cloud.frag @@ -0,0 +1,213 @@ +#ifdef GL_ES +precision highp float; +#endif + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; + +#define CHAR_SIZE vec2(6, 7) +#define CHAR_SPACING vec2(6, 9) + +#define DOWN_SCALE 2.0 + +vec2 res; +vec2 start_pos = vec2(0); +vec2 print_pos = vec2(0); +vec2 print_pos_pre_move = vec2(0); +vec3 text_color = vec3(1); + +/* +Top left pixel is the most significant bit. +Bottom right pixel is the least significant bit. + + ███ | +█ █ | +█ █ | +█ █ | +█████ | +█ █ | +█ █ | + +000000 +100010 +100010 +100010 +111110 +100010 +100010 + +011100 (upper 21 bits) +100010 -> 011100 100010 100010 100 -> 935188 +100010 +100 + 010 (lower 21 bits) +111110 -> 010 111110 100010 100010 -> 780450 +100010 +100010 + +vec2(935188.0,780450.0) +*/ + +//Text coloring +#define HEX(i) text_color = mod(vec3(i / 65536,i / 256,i),vec3(256.0))/255.0; +#define RGB(r,g,b) text_color = vec3(r,g,b); + +#define STRWIDTH(c) (c * CHAR_SPACING.x) +#define STRHEIGHT(c) (c * CHAR_SPACING.y) +#define BEGIN_TEXT(x,y) print_pos = floor(vec2(x,y)); start_pos = floor(vec2(x,y)); + +//Automatically generated from the sprite sheet here: http://uzebox.org/wiki/index.php?title=File:Font6x8.png +#define _ col+=char(vec2(0.0,0.0),uv); +#define _spc col+=char(vec2(0.0,0.0),uv)*text_color; +#define _exc col+=char(vec2(276705.0,32776.0),uv)*text_color; +#define _quo col+=char(vec2(1797408.0,0.0),uv)*text_color; +#define _hsh col+=char(vec2(10738.0,1134484.0),uv)*text_color; +#define _dol col+=char(vec2(538883.0,19976.0),uv)*text_color; +#define _pct col+=char(vec2(1664033.0,68006.0),uv)*text_color; +#define _amp col+=char(vec2(545090.0,174362.0),uv)*text_color; +#define _apo col+=char(vec2(798848.0,0.0),uv)*text_color; +#define _lbr col+=char(vec2(270466.0,66568.0),uv)*text_color; +#define _rbr col+=char(vec2(528449.0,33296.0),uv)*text_color; +#define _ast col+=char(vec2(10471.0,1688832.0),uv)*text_color; +#define _crs col+=char(vec2(4167.0,1606144.0),uv)*text_color; +#define _per col+=char(vec2(0.0,1560.0),uv)*text_color; +#define _dsh col+=char(vec2(7.0,1572864.0),uv)*text_color; +#define _com col+=char(vec2(0.0,1544.0),uv)*text_color; +#define _lsl col+=char(vec2(1057.0,67584.0),uv)*text_color; +#define _0 col+=char(vec2(935221.0,731292.0),uv)*text_color; +#define _1 col+=char(vec2(274497.0,33308.0),uv)*text_color; +#define _2 col+=char(vec2(934929.0,1116222.0),uv)*text_color; +#define _3 col+=char(vec2(934931.0,1058972.0),uv)*text_color; +#define _4 col+=char(vec2(137380.0,1302788.0),uv)*text_color; +#define _5 col+=char(vec2(2048263.0,1058972.0),uv)*text_color; +#define _6 col+=char(vec2(401671.0,1190044.0),uv)*text_color; +#define _7 col+=char(vec2(2032673.0,66576.0),uv)*text_color; +#define _8 col+=char(vec2(935187.0,1190044.0),uv)*text_color; +#define _9 col+=char(vec2(935187.0,1581336.0),uv)*text_color; +#define _col col+=char(vec2(195.0,1560.0),uv)*text_color; +#define _scl col+=char(vec2(195.0,1544.0),uv)*text_color; +#define _les col+=char(vec2(135300.0,66052.0),uv)*text_color; +#define _equ col+=char(vec2(496.0,3968.0),uv)*text_color; +#define _grt col+=char(vec2(528416.0,541200.0),uv)*text_color; +#define _que col+=char(vec2(934929.0,1081352.0),uv)*text_color; +#define _ats col+=char(vec2(935285.0,714780.0),uv)*text_color; +#define _A col+=char(vec2(935188.0,780450.0),uv)*text_color; +#define _B col+=char(vec2(1983767.0,1190076.0),uv)*text_color; +#define _C col+=char(vec2(935172.0,133276.0),uv)*text_color; +#define _D col+=char(vec2(1983764.0,665788.0),uv)*text_color; +#define _E col+=char(vec2(2048263.0,1181758.0),uv)*text_color; +#define _F col+=char(vec2(2048263.0,1181728.0),uv)*text_color; +#define _G col+=char(vec2(935173.0,1714334.0),uv)*text_color; +#define _H col+=char(vec2(1131799.0,1714338.0),uv)*text_color; +#define _I col+=char(vec2(921665.0,33308.0),uv)*text_color; +#define _J col+=char(vec2(66576.0,665756.0),uv)*text_color; +#define _K col+=char(vec2(1132870.0,166178.0),uv)*text_color; +#define _L col+=char(vec2(1065220.0,133182.0),uv)*text_color; +#define _M col+=char(vec2(1142100.0,665762.0),uv)*text_color; +#define _N col+=char(vec2(1140052.0,1714338.0),uv)*text_color; +#define _O col+=char(vec2(935188.0,665756.0),uv)*text_color; +#define _P col+=char(vec2(1983767.0,1181728.0),uv)*text_color; +#define _Q col+=char(vec2(935188.0,698650.0),uv)*text_color; +#define _R col+=char(vec2(1983767.0,1198242.0),uv)*text_color; +#define _S col+=char(vec2(935171.0,1058972.0),uv)*text_color; +#define _T col+=char(vec2(2035777.0,33288.0),uv)*text_color; +#define _U col+=char(vec2(1131796.0,665756.0),uv)*text_color; +#define _V col+=char(vec2(1131796.0,664840.0),uv)*text_color; +#define _W col+=char(vec2(1131861.0,699028.0),uv)*text_color; +#define _X col+=char(vec2(1131681.0,84130.0),uv)*text_color; +#define _Y col+=char(vec2(1131794.0,1081864.0),uv)*text_color; +#define _Z col+=char(vec2(1968194.0,133180.0),uv)*text_color; +#define _lsb col+=char(vec2(925826.0,66588.0),uv)*text_color; +#define _rsl col+=char(vec2(16513.0,16512.0),uv)*text_color; +#define _rsb col+=char(vec2(919584.0,1065244.0),uv)*text_color; +#define _pow col+=char(vec2(272656.0,0.0),uv)*text_color; +#define _usc col+=char(vec2(0.0,62.0),uv)*text_color; +#define _a col+=char(vec2(224.0,649374.0),uv)*text_color; +#define _b col+=char(vec2(1065444.0,665788.0),uv)*text_color; +#define _c col+=char(vec2(228.0,657564.0),uv)*text_color; +#define _d col+=char(vec2(66804.0,665758.0),uv)*text_color; +#define _e col+=char(vec2(228.0,772124.0),uv)*text_color; +#define _f col+=char(vec2(401543.0,1115152.0),uv)*text_color; +#define _g col+=char(vec2(244.0,665474.0),uv)*text_color; +#define _h col+=char(vec2(1065444.0,665762.0),uv)*text_color; +#define _i col+=char(vec2(262209.0,33292.0),uv)*text_color; +#define _j col+=char(vec2(131168.0,1066252.0),uv)*text_color; +#define _k col+=char(vec2(1065253.0,199204.0),uv)*text_color; +#define _l col+=char(vec2(266305.0,33292.0),uv)*text_color; +#define _m col+=char(vec2(421.0,698530.0),uv)*text_color; +#define _n col+=char(vec2(452.0,1198372.0),uv)*text_color; +#define _o col+=char(vec2(228.0,665756.0),uv)*text_color; +#define _p col+=char(vec2(484.0,667424.0),uv)*text_color; +#define _q col+=char(vec2(244.0,665474.0),uv)*text_color; +#define _r col+=char(vec2(354.0,590904.0),uv)*text_color; +#define _s col+=char(vec2(228.0,114844.0),uv)*text_color; +#define _t col+=char(vec2(8674.0,66824.0),uv)*text_color; +#define _u col+=char(vec2(292.0,1198868.0),uv)*text_color; +#define _v col+=char(vec2(276.0,664840.0),uv)*text_color; +#define _w col+=char(vec2(276.0,700308.0),uv)*text_color; +#define _x col+=char(vec2(292.0,1149220.0),uv)*text_color; +#define _y col+=char(vec2(292.0,1163824.0),uv)*text_color; +#define _z col+=char(vec2(480.0,1148988.0),uv)*text_color; +#define _lpa col+=char(vec2(401542.0,66572.0),uv)*text_color; +#define _bar col+=char(vec2(266304.0,33288.0),uv)*text_color; +#define _rpa col+=char(vec2(788512.0,1589528.0),uv)*text_color; +#define _tid col+=char(vec2(675840.0,0.0),uv)*text_color; +#define _lar col+=char(vec2(8387.0,1147904.0),uv)*text_color; +#define _nl print_pos = start_pos - vec2(0,CHAR_SPACING.y); + +//Extracts bit b from the given number. +float extract_bit(float n, float b) +{ + b = clamp(b,-1.0,22.0); + return floor(mod(floor(n / pow(2.0,floor(b))),2.0)); +} + +//Returns the pixel at uv in the given bit-packed sprite. +float sprite(vec2 spr, vec2 size, vec2 uv) +{ + uv = floor(uv); + float bit = (size.x-uv.x-1.0) + uv.y * size.x; + bool bounds = all(greaterThanEqual(uv,vec2(0)))&& all(lessThan(uv,size)); + return bounds ? extract_bit(spr.x, bit - 21.0) + extract_bit(spr.y, bit) : 0.0; +} + +//Prints a character and moves the print position forward by 1 character width. +vec3 char(vec2 ch, vec2 uv) +{ + float px = sprite(ch, CHAR_SIZE, uv - print_pos); + print_pos.x += CHAR_SPACING.x; + print_pos.y += sin(4.*print_pos.x-time*10.); + return vec3(px); +} + + +vec3 Text(vec2 uv) +{ + vec3 col = vec3(0.0); + + vec2 center_pos = vec2(res.x/2.0 - STRWIDTH(20.0)/2.0,res.y/2.0 - STRHEIGHT(1.0)/2.0); + + BEGIN_TEXT(center_pos.x,center_pos.y) + HEX(0x00ffFF) _ _ _C _L _O _U _D _ _N _I _N _J _A; + BEGIN_TEXT(res.x/2.0-STRWIDTH(11.0)/2.0,res.y/2.0) + print_pos += vec2(cos(time)*96.,sin(time)*96.); + + // RGB(1,0,0) _M RGB(1,.5,0)_o RGB(1,1,0)_v RGB(0,1,0)_i RGB(0,.5,1)_n RGB(0.5,0,1)_g _ RGB(1,0,0)_T RGB(1,.5,0)_e RGB(1,1,0)_x RGB(0,1,0)_t + + return col; +} + +void main( void ) +{ + res = resolution.xy / DOWN_SCALE; + vec2 uv = gl_FragCoord.xy / DOWN_SCALE; + vec2 duv = floor(gl_FragCoord.xy / DOWN_SCALE); + + vec3 pixel = Text(duv); + + vec3 col = pixel*0.9+0.1; + col *= (1.-distance(mod(uv,vec2(1.0)),vec2(0.65)))*1.2; + + gl_FragColor = vec4(vec3(col), 1.0); +} diff --git a/shaders/cloudninja.frag b/shaders/cloudninja.frag new file mode 100644 index 0000000..275386f --- /dev/null +++ b/shaders/cloudninja.frag @@ -0,0 +1,155 @@ + +#ifdef GL_ES +precision highp float; +#endif + +vec2 uv; + +uniform float time; +uniform vec2 resolution; + +const vec2 ch_size = vec2(1.0, 2.0) * 0.6; // character size (X,Y) +const vec2 ch_space = ch_size + vec2(1.0, 1.0); // character distance Vector(X,Y) +const vec2 ch_start = vec2 (ch_space.x * -5., 1.); // start position + vec2 ch_pos = vec2 (0.0, 0.0); // character position(X,Y) +// vec3 ch_color = vec3 (1.5, 0.75, 0.5); // character color (R,G,B) +//const vec3 bg_color = vec3 (0.2, 0.2, 0.2); // background color (R,G,B) + +#define REPEAT_SIGN false // True/False; True=Multiple, False=Single + +/* 16 segment display...Akin to LED Display. + +Segment bit positions: + + + binary to hex -> 0x119F +*/ + +#define n0 ddigit(0x22FF); +#define n1 ddigit(0x0281); +#define n2 ddigit(0x1177); +#define n3 ddigit(0x11E7); +#define n4 ddigit(0x5508); +#define n5 ddigit(0x11EE); +#define n6 ddigit(0x11FE); +#define n7 ddigit(0x2206); +#define n8 ddigit(0x11FF); +#define n9 ddigit(0x11EF); + +#define A ddigit(0x119F); +#define B ddigit(0x927E); +#define C ddigit(0x007E); +#define D ddigit(0x44E7); +#define E ddigit(0x107E); +#define F ddigit(0x101E); +#define G ddigit(0x807E); +#define H ddigit(0x1199); +#define I ddigit(0x4466); +#define J ddigit(0x4436); +#define K ddigit(0x9218); +#define L ddigit(0x0078); +#define M ddigit(0x0A99); +#define N ddigit(0x8899); +#define O ddigit(0x00FF); +#define P ddigit(0x111F); +#define Q ddigit(0x80FF); +#define R ddigit(0x911F); +#define S ddigit(0x8866); +#define T ddigit(0x4406); +#define U ddigit(0x00F9); +#define V ddigit(0x2218); +#define W ddigit(0xA099); +#define X ddigit(0xAA00); +#define Y ddigit(0x4A00); +#define Z ddigit(0x2266); +#define _ ch_pos.x += ch_space.x; +#define s_dot ddigit(0); +#define s_minus ddigit(0x1100); +#define s_plus ddigit(0x5500); +#define s_greater ddigit(0x2800); +#define s_less ddigit(0x8200); +#define s_sqrt ddigit(0x0C02); +#define nl1 ch_pos = ch_start; ch_pos.y -= 3.0; +#define nl2 ch_pos = ch_start; ch_pos.y -= 6.0; +#define nl3 ch_pos = ch_start; ch_pos.y -= 9.0; + +float dseg(vec2 p0, vec2 p1) +{ + vec2 dir = normalize(p1 - p0); + vec2 cp = (uv - ch_pos - p0) * mat2(dir.x, dir.y,-dir.y, dir.x); + return distance(cp, clamp(cp, vec2(0), vec2(distance(p0, p1), 0))); +} + +bool bit(int n, int b) +{ + return mod(floor(float(n) / exp2(floor(float(b)))), 2.0) != 0.0; +} + +float d = 1e6; + +void ddigit(int n) +{ + float v = 1e6; + vec2 cp = uv - ch_pos; + if (n == 0) v = min(v, dseg(vec2(-0.405, -1.000), vec2(-0.500, -1.000))); + if (bit(n, 0)) v = min(v, dseg(vec2( 0.500, 0.063), vec2( 0.500, 0.937))); + if (bit(n, 1)) v = min(v, dseg(vec2( 0.438, 1.000), vec2( 0.063, 1.000000000))); + if (bit(n, 2)) v = min(v, dseg(vec2(-0.063, 1.000), vec2(-0.438, 1.000))); + if (bit(n, 3)) v = min(v, dseg(vec2(-0.500, 0.937), vec2(-0.500, 0.062))); + if (bit(n, 4)) v = min(v, dseg(vec2(-0.500, -0.063), vec2(-0.500, -0.938))); + if (bit(n, 5)) v = min(v, dseg(vec2(-0.438, -1.000), vec2(-0.063, -1.000))); + if (bit(n, 6)) v = min(v, dseg(vec2( 0.063, -1.000), vec2( 0.438, -1.000))); + if (bit(n, 7)) v = min(v, dseg(vec2( 0.500, -0.938), vec2( 0.500, -0.063))); + if (bit(n, 8)) v = min(v, dseg(vec2( 0.063, 0.000), vec2( 0.438, -0.000))); + if (bit(n, 9)) v = min(v, dseg(vec2( 0.063, 0.063), vec2( 0.438, 0.938))); + if (bit(n, 10)) v = min(v, dseg(vec2( 0.000, 0.063), vec2( 0.000, 0.937))); + if (bit(n, 11)) v = min(v, dseg(vec2(-0.063, 0.063), vec2(-0.438, 0.938))); + if (bit(n, 12)) v = min(v, dseg(vec2(-0.438, 0.000), vec2(-0.063, -0.000))); + if (bit(n, 13)) v = min(v, dseg(vec2(-0.063, -0.063), vec2(-0.438, -0.938))); + if (bit(n, 14)) v = min(v, dseg(vec2( 0.000, -0.938), vec2( 0.000, -0.063))); + if (bit(n, 15)) v = min(v, dseg(vec2( 0.063, -0.063), vec2( 0.438, -0.938))); + ch_pos.x += ch_space.x; + d = min(d, v); +} +mat2 rotate(float a) +{ + float c = cos(a); + float s = sin(a); + return mat2(c, s, -s, c); +} +vec3 hsv2rgb_smooth( in vec3 c ) +{ + vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 ); + + rgb = rgb*rgb*(3.0-2.0*rgb); // cubic smoothing + + return c.z * mix( vec3(1.0), rgb, c.y); +} +void main( void ) +{ + + vec2 aspect = resolution.xy / resolution.y; + uv = ( gl_FragCoord.xy / resolution.y ) - aspect / 2.0; + float _d = 1.0-length(uv); + uv *= 18.0 ; + uv.y -= 3.; + //uv *= rotate(time+uv.x*0.05); + + + + vec3 ch_color = hsv2rgb_smooth(vec3(time*0.4+uv.y*0.1,0.5,1.0)); + + vec3 bg_color = vec3(_d*0.4, _d*0.2, _d*0.1); + + + + + uv.x += -1.+sin(time+uv.y*0.7)*0.5; + ch_pos = ch_start; + + _ C L O U D N I N J A + + + vec3 color = mix(ch_color, bg_color, 1.0- (0.08 / d*2.0)); // shading + gl_FragColor = vec4(color, 1.0); +} diff --git a/shaders/cubes.frag b/shaders/cubes.frag new file mode 100644 index 0000000..2633f89 --- /dev/null +++ b/shaders/cubes.frag @@ -0,0 +1,79 @@ +// Inspired from: https://www.shadertoy.com/view/3dBGWG + +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; +uniform vec2 resolution; + +vec3 rotate(vec3 p,vec3 axis,float theta) +{ + vec3 v = cross(p, axis), u = cross(v, axis); + return u * cos(theta) + v * sin(theta) + axis * dot(p, axis); +} + +vec2 rotate(vec2 p, float theta) +{ + return p * cos(theta) + vec2(-p.y, p.x) * sin(theta); +} + +float deLineBox(vec3 p) +{ + p=mod(p,4.0)-2.0; + float de = 1e5; + for(float j=1.0; j<4.0;j++) + { + p = abs(p)-1.0; + for(int i=0; i<3;i++) + { + vec3 q =p; + q[i]=max(0.0,q[i]); + de= min(de,length(q)-0.03*j); + } + p*=2.0; + } + return de; +} + +float dstepf = 0.0; + +float map(vec3 p) +{ + dstepf += 0.003; + float t = floor(time/5.5)*3.5 + min(8.0, mod(time,10.0)); + p = rotate(p,normalize(vec3(rotate(vec2(1,2),sin(t/3.)),3)),t*0.35); + return deLineBox(p); +} + +void main() +{ + vec2 uv = (gl_FragCoord.xy*2.0-resolution.xy)/resolution.y; + vec3 ro = vec3(3.5)*sin(time*0.02+ 0.2*sin(time*0.1)); + vec3 rd0 = normalize(vec3(uv, -1.0)); + vec3 rd1 = normalize(vec3(uv, (1.0-dot(uv, uv)*0.5)*0.5)); + vec3 rd = mix(rd0, rd1, step(6.0,mod(time,12.0))); + + vec3 col = vec3(0); + float t=0.1, layers=0.0, d, aD; + float thD = 0.03; + + for(float i=0.; i<80.; i++) + { + if(layers>10. || col.x > 1.0 || t>6.0) break; + vec3 p = ro + rd*t; + d = map(p); + aD = (thD-abs(d))/thD; + if(aD>0.) + { + col += aD*aD*(3.0-2.0*aD)/(1.0 + t*t*0.5)*0.15; + layers++; + } + t += max(d, thD*1.5) * dstepf; + } + col = mix(col, vec3(min(col.x*1.5, 1.), pow(col.x, 2.5), pow(col.x, 12.)), + dot(sin(rd.yzx*8. + sin(rd.zxy*8.)), vec3(.1666))+0.4); + col = mix(col, vec3(col.x*col.x*.85, col.x, col.x*col.x*0.3), + dot(sin(rd.yzx*4. + sin(rd.zxy*4.)), vec3(.1666))+0.25); + gl_FragColor = vec4( clamp(col, 0., 1.), 1.0 ); +} diff --git a/shaders/example.frag b/shaders/example.frag new file mode 100644 index 0000000..417caac --- /dev/null +++ b/shaders/example.frag @@ -0,0 +1,23 @@ +// Example Shadertoy-style fragment shader for gpupaper. +// Demonstrates use of 'time' and 'resolution' uniforms. +// +// Usage: gpupaper HDMI-A-1 shaders/example.frag + +uniform vec2 resolution; +uniform float time; + +void mainImage(out vec4 fragColor, in vec2 fragCoord) { + vec2 uv = fragCoord / resolution; + + // Animated gradient + float r = 0.5 + 0.5 * sin(time * 0.7 + uv.x * 3.0); + float g = 0.5 + 0.5 * sin(time * 0.5 + uv.y * 3.0 + 2.094); + float b = 0.5 + 0.5 * sin(time * 0.3 + (uv.x + uv.y) * 3.0 + 4.189); + + // Vignette + vec2 centered = uv - 0.5; + float vignette = 1.0 - dot(centered, centered) * 2.0; + vignette = clamp(vignette, 0.0, 1.0); + + fragColor = vec4(vec3(r, g, b) * vignette, 1.0); +} diff --git a/shaders/fireflies.frag b/shaders/fireflies.frag new file mode 100644 index 0000000..180bdd6 --- /dev/null +++ b/shaders/fireflies.frag @@ -0,0 +1,75 @@ +#ifdef GL_ES +precision mediump float; +#endif + +//dashxdr +// showing the points while performing the mandelbrot function + +uniform float time; +uniform vec2 resolution; +uniform vec2 mouse; +uniform sampler2D bb; + +void main( void ) +{ + + float sum = 0.0; + float size = .0025; + vec2 tpos = gl_FragCoord.xy / resolution; + float px,py; + float scale = 1.0; + float basex = -1.0; + float basey = 0.0; + float x = basex + (mouse.x-.5)*scale; + float y = basey + (mouse.y-.5)*scale; + float t; + if(true) // change to false to control with mouse + { + t = time; + float t1 = t; + float scale1 = .3; + float t2 = t *.61223; + float scale2 = .5; + x = basex + scale1*cos(t1) + scale2*cos(t2); + y = basey + scale1*sin(t1) + scale2*sin(t2); + } + + vec2 position = 2.0*(tpos + vec2(-0.75, -0.5)); + +#define NUM 30 + float u, v; + u = v = .317; + + for(int j=0;j<4;++j) + { + px = py = 0.0; + float x0, y0; + x0 = x + u; + y0 = y + v; + for (int i=0; i < NUM; ++i) { + t = (px*px-py*py)+x0; + py = (2.0*px*py) + y0; + px = t; + float dist = length(vec2(px, py) - position); + if(dist > .0001) + sum += size/dist; + else break; + } + t = u; + u = -v; + v = t; + } + + float val = sum; + + vec3 color; + color = vec3(val, val*0.66666, 0.0); + tpos = .5 + 1.2 * (tpos - .5); +#define INDENT .02 + vec3 tcolor; + if(tpos.x>INDENT && tpos.y>INDENT && + tpos.x < 1.0-INDENT && tpos.y < 1.0-INDENT) + tcolor = .9*texture2D(bb, tpos).rgb; + else tcolor = vec3(0.0); + gl_FragColor = vec4(max(color,tcolor), 1.0); +} diff --git a/shaders/firering.frag b/shaders/firering.frag new file mode 100644 index 0000000..f732248 --- /dev/null +++ b/shaders/firering.frag @@ -0,0 +1,138 @@ +/* +* License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. +* Created by bal-khan +*/ + +precision highp float; + +uniform float time; +uniform vec2 resolution; + +vec2 iResolution; +float iTime; + +vec2 march(vec3 pos, vec3 dir); +vec3 camera(vec2 uv); +void rotate(inout vec2 v, float angle); + +float t; // time +vec3 ret_col; // torus color +vec3 h; // light amount + +#define I_MAX 400. +#define E 0.00001 +#define FAR 50. +#define PI 3.14 + +// blackbody by aiekick : https://www.shadertoy.com/view/lttXDn + +// -------------blackbody----------------- // + +// return color from temperature +//http://www.physics.sfasu.edu/astro/color/blackbody.html +//http://www.vendian.org/mncharity/dir3/blackbody/ +//http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html + +vec3 blackbody(float Temp) +{ + vec3 col = vec3(255.); + col.x = 56100000. * pow(Temp,(-3. / 2.)) + 148.; + col.y = 100.04 * log(Temp) - 623.6; + if (Temp > 6500.) col.y = 35200000. * pow(Temp,(-3. / 2.)) + 184.; + col.z = 194.18 * log(Temp) - 1448.6; + col = clamp(col, 0., 255.)/255.; + if (Temp < 1000.) col *= Temp/1000.; + return col; +} + +// -------------blackbody----------------- // + +void mainImage(out vec4 c_out, in vec2 f) +{ + t = iTime*.125; + vec3 col = vec3(0., 0., 0.); + vec2 R = iResolution.xy, + uv = vec2(f-R/2.) / R.y; + vec3 dir = camera(uv); + vec3 pos = vec3(.0, .0, 0.0); + + pos.z = 4.5+1.5*sin(t*10.); + h*=0.; + vec2 inter = (march(pos, dir)); + col.xyz = ret_col*(1.-inter.x*.0125); + col += h * .4; + c_out = vec4(col,1.0); +} + +float scene(vec3 p) +{ + float var; + float mind = 1e5; + p.z += 10.; + + rotate(p.xz, 1.57-.5*iTime ); + rotate(p.yz, 1.57-.5*iTime ); + var = atan(p.x,p.y); + vec2 q = vec2( ( length(p.xy) )-6.,p.z); + rotate(q, var*.25+iTime*2.*0.); + vec2 oq = q ; + q = abs(q)-2.5; + if (oq.x < q.x && oq.y > q.y) + rotate(q, ( (var*1.)+iTime*0.)*3.14+iTime*0.); + else + rotate(q, ( .28-(var*1.)+iTime*0.)*3.14+iTime*0.); + float oldvar = var; + ret_col = 1.-vec3(.350, .2, .3); + mind = length(q)+.5+1.05*(length(fract(q*.5*(3.+3.*sin(oldvar*1. - iTime*2.)) )-.5)-1.215); + h -= vec3(-3.20,.20,1.0)*vec3(1.)*.0025/(.051+(mind-sin(oldvar*1. - iTime*2. + 3.14)*.125 )*(mind-sin(oldvar*1. - iTime*2. + 3.14)*.125 ) ); + h -= vec3(1.20,-.50,-.50)*vec3(1.)*.025/(.501+(mind-sin(oldvar*1. - iTime*2.)*.5 )*(mind-sin(oldvar*1. - iTime*2.)*.5 ) ); + h += vec3(.25, .4, .5)*.0025/(.021+mind*mind); + + return (mind); +} + +vec2 march(vec3 pos, vec3 dir) +{ + vec2 dist = vec2(0.0, 0.0); + vec3 p = vec3(0.0, 0.0, 0.0); + vec2 s = vec2(0.0, 0.0); + + for (float i = -1.; i < I_MAX; ++i) + { + p = pos + dir * dist.y; + dist.x = scene(p); + dist.y += dist.x*.2; // makes artefacts disappear + // log trick by aiekick + if (log(dist.y*dist.y/dist.x/1e5) > .0 || dist.x < E || dist.y > FAR) + { + break; + } + s.x++; + } + s.y = dist.y; + return (s); +} + +// Utilities + +void rotate(inout vec2 v, float angle) +{ + v = vec2(cos(angle)*v.x+sin(angle)*v.y,-sin(angle)*v.x+cos(angle)*v.y); +} + +vec3 camera(vec2 uv) +{ + float fov = 1.; + vec3 forw = vec3(0.0, 0.0, -1.0); + vec3 right = vec3(1.0, 0.0, 0.0); + vec3 up = vec3(0.0, 1.0, 0.0); + + return (normalize((uv.x) * right + (uv.y) * up + fov * forw)); +} + +void main() { + iTime = time; + iResolution = resolution; + mainImage(gl_FragColor, gl_FragCoord.xy); +} + diff --git a/shaders/flags.frag b/shaders/flags.frag new file mode 100644 index 0000000..8c819ec --- /dev/null +++ b/shaders/flags.frag @@ -0,0 +1,441 @@ +#ifdef GL_ES +precision mediump float; +#endif + +// Community flags + +// Individual flags taken from other shaders +// +// enhanced edition, best viewed at 1 + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; + +#define WAVE + +float kFlagCount = 15.0; // +1 to add new flag + +vec3 Flag0( vec2 p ) +{ + // http://glsl.heroku.com/e#2701.0 + vec3 c = vec3(1.0, 0.48, 0.15); + if((p.y > 0.6 && p.y < 0.7) || (p.x > 0.7 && p.x < 0.76)) c = vec3(1.0, 0.9, 0.3); + return c; +} + +vec3 Flag1( vec2 p ) +{ + // http://glsl.heroku.com/e#2703.0 + // Czech Republic + vec3 c = vec3(1, 1, 1); + if (-p.x + 1.0 > p.y) c = vec3(0, 0, 1); + if (p.y < 0.5) { + c = vec3(1, 0, 0); + if (p.x < p.y) c = vec3(0, 0, 1); + } + + return c; +} + +vec3 Flag2orig( vec2 p ) +{ + // http://glsl.heroku.com/e#2724.0 + // Germany + vec3 c = vec3(0.0); + if(p.y < 0.333) + c = vec3(1.0, 0.8, 0.0); + else if(p.y > 0.333 && p.y < 0.666) + c = vec3(1.0, 0.0, 0.0); + else + c = vec3(0.0); + return c; +} + +vec3 Flag2enh( vec2 p) +{ + // "Germany" + float r = -2.0*time; + vec3 c = vec3(1.0); + p -= 0.5; + p.x *= resolution.x / resolution.y; + p /= 0.43; + if(length(p) >= 1.0) + return vec3(1.0,0.0,0.0); + p = vec2(p.x*cos(r)+p.y*sin(r), -p.x*sin(r)+p.y*cos(r))/0.67 /*should be r*/; + if(abs(p.x) > 1.0 || abs(p.y) > 1.0) + return c; + if(p.y < 0.0) p = vec2(-p.x, -p.y); + if(p.x < 0.0) p = vec2(p.y, -p.x); + if(p.y > 0.2 && p.y < 0.6 && p.x > 0.2) + return c; + return vec3(0.0); +} + +vec3 noise( vec3 p) +{ + return vec3(0.5 + 0.5 * fract(sin(dot(p.xyz, vec3(7.791,12.9898, 78.233)))* 43758.5453)); +} +vec3 Flag2( vec2 p) +{ + if(mod(time,2.0) >= 1.7) + return noise(vec3(time,p.xy)); + if(mod(time,4.0) >= 2.0) + return Flag2orig(p); + return Flag2enh(p); +} + +vec3 Flag3( vec2 p ) +{ + // http://glsl.heroku.com/e#2727.0 + // Poland + float gb = 1.0; + if (p.y < 0.5) + gb = 0.0; + + return vec3( 1.0, gb, gb); +} + +vec3 Flag4( vec2 p ) +{ + // http://glsl.heroku.com/e#2766.0 + // Japan + p -= 0.5; + p.y *= resolution.y / resolution.x; + + float col = clamp((length(p) - 0.12) * 1000.0, 0.0, 1.0); + return vec3(1.0, col, col); +} + +vec3 Flag5( vec2 p ) +{ + // http://glsl.heroku.com/e#2731.1 + // United Kingdom + vec3 kRed = vec3( 204.0 / 255.0, 0.0, 0.0 ); + vec3 kWhite = vec3( 1.0, 1.0, 1.0 ); + vec3 kBlue = vec3( 0.0, 0.0, 102.0 / 255.0 ); + + vec3 c = kBlue; + + p = p * 2.0 - 1.0; + float d = -p.x * sign(p.y) + p.y * sign(p.x); + + if((abs(p.x) < (6.0/60.0)) || (abs(p.y) < (6.0/30.0))) + { + c = kRed; + } + else + if((abs(p.x) < (10.0/60.0)) || (abs(p.y) < (10.0/30.0))) + { + c = kWhite; + } + else + if( (d > 0.0) && (d < 0.15)) + { + c = kRed; + } + else + if( (d > -0.15 * 3.0 / 2.0) && (d < 0.15 * 3.0 /2.0)) + { + c = kWhite; + } + + return c; +} + +vec3 Flag6( vec2 p ) +{ + // http://glsl.heroku.com/e#2737.0 + // Serbia and Montenegro + vec3 c = vec3(0.0); + if(p.y < 0.3333333333333333333333) + c = vec3(0.2, 0.2, 1.0); + else if(p.y > 0.3333333333333333 && p.y < 0.666666666666666666666666) + c = vec3(1.0, 1.0, 1.0); + else + c = vec3(1.0, 0.2, 0.2); + return c; +} + +vec3 Flag7( vec2 p ) +{ + // http://glsl.heroku.com/e#2739.0 + // Italy + vec3 c = vec3(0.807, 0.168, 0.215); + if(p.x < 0.333) + c = vec3(0, 0.572, 0.274); + else if(p.x > 0.333 && p.x < 0.666) + c = vec3(1.0, 1.0, 1.0); + return c; +} + +vec3 Flag8( vec2 p ) +{ + // http://glsl.heroku.com/e#2740.0 + // Spain + vec3 c = vec3(0.666, 0.082, 0.098); + if(p.y > 0.25 && p.y < 0.75) + c = vec3(0.945, 0.749, 0.0); + return c; +} + + +vec3 Flag9( vec2 p ) +{ + // http://glsl.heroku.com/e#2770.4 + // Hungary + + /* + * Author: Yours3!f + * Ripple effect taken from here (glsl.heroku.com/e#2757) + * This flag has proper colors (not just r = 1, b = 1) + */ + vec3 red = vec3(206, 17, 38) / vec3(255); + vec3 green = vec3(0, 135, 81) / vec3(255); + + vec3 c = vec3(1); + + if(p.y > 0.66) + c.xyz = red; + else if(p.y < 0.33) + c.xyz = green; + + return c; +} + +vec3 Flag10( vec2 p ) +{ + // http://glsl.heroku.com/e#2752.0 + // Greek Flag by Optimus + // I am not sure about the color or dimensions but one can fork this + + //Added proper color, by Yours3!f + vec3 blue = vec3(13, 94, 175) / vec3(255); + vec3 white = vec3(1.0, 1.0, 1.0); + vec3 finalcolor = vec3(0.0); + + float stripes = mod(p.y * 4.5, 1.0); + vec3 stripecol = vec3(0.0); + if (stripes < 0.5) + { + stripecol = blue; + } + else + { + stripecol = white; + } + + vec3 crosscol = vec3(0.0); + if (p.x < 0.4 && p.y > 0.444) + { + crosscol = blue; + + if (p.x > 0.15 && p.x < 0.25) crosscol = white; + if (p.y > 0.666 && p.y < 0.778) crosscol = white; + + finalcolor = crosscol; + } + else + { + finalcolor = stripecol; + } + + return finalcolor; +} + + +vec3 Flag11( vec2 p ) +{ + // http://glsl.heroku.com/e#2758.0 + // France + vec3 c = vec3(0.0); + if(p.x < 0.3333333333333333333333) + c = vec3(0.2, 0.2, 1.0); + else if(p.x > 0.3333333333333333 && p.x < 0.666666666666666666666666) + c = vec3(1.0, 1.0, 1.0); + else + c = vec3(1.0, 0.2, 0.2); + + return c; +} + +vec3 Flag12( vec2 p ) +{ + // http://glsl.heroku.com/e#2772.4 + // Denmark! + // by @dennishjorth + // + // Please! Set the precision to 0.5! + // otherwise it hurts your eyes... + + vec3 kRed = vec3( 255.0 / 255.0, 0.0, 0.0 ); + vec3 kWhite = vec3( 1.0, 1.0, 1.0 ); + + vec3 c; + p = p * 2.0 - 1.0; + if((abs(p.x+0.3) < (6.0/60.0)) || (abs(p.y) < (6.0/30.0))) + { + c = kWhite; + } + else + { + c = kRed; + } + return c; +} + +vec3 Flag13( vec2 p ) +{ + // England + vec3 kRed = vec3( 204.0 / 255.0, 0.0, 0.0 ); + vec3 kWhite = vec3( 1.0, 1.0, 1.0 ); + + vec3 c = kWhite; + + p = p * 2.0 - 1.0; + if((abs(p.x) < (6.0/60.0)) || (abs(p.y) < (6.0/30.0))) + { + c = kRed; + } + + return c; +} + +vec3 Flag14( vec2 p ) +{ + // Russia + vec3 c = vec3(0.0); + if(p.y > 0.666) + c = vec3(1.0); + else if(p.y < 0.666 && p.y > 0.333) + c = vec3(0.0, 0.0, 1.0); + else + c = vec3(1.0, 0.0, 0.0); + return c; +} + +vec3 Flag15( vec2 p ) +{ + vec3 c = vec3(0.0); // add new flag code here + return c; +} + +vec3 GetFlagCol(vec2 p, float index) +{ + index = mod(index, kFlagCount); + + if(index < 0.5) { + return Flag0(p); + } + else if(index < 1.5) { + return Flag1(p); + } + else if(index < 2.5) { + return Flag2(p); + } + else if(index < 3.5) { + return Flag3(p); + } + else if(index < 4.5) { + return Flag4(p); + } + else if(index < 5.5) { + return Flag5(p); + } + else if(index < 6.5) { + return Flag6(p); + } + else if(index < 7.5) { + return Flag7(p); + } + else if(index < 8.5) { + return Flag8(p); + } + else if(index < 9.5) { + return Flag9(p); + } + else if(index < 10.5) { + return Flag10(p); + } + else if(index < 11.5) { + return Flag11(p); + } + else if(index < 12.5) { + return Flag12(p); + } + else if(index < 13.5) { + return Flag13(p); + } + else if(index < 14.5) { + return Flag14(p); + } + else if(index < 15.5) { + return Flag15(p); + } + + return vec3(0.0); +} + +void main( void ) +{ + vec2 p = gl_FragCoord.xy / resolution.xy; + + // apply movement + vec2 p2 = p * 8.0; + p2.y += time * 0.2; + + + float shade = 1.0; + + #ifdef WAVE + float nx =0.0; + + float k_freq = 100.0; + float k_x_movement = 0.025; + float k_y_movement = 0.05; + float k_scroll_speed = 4.0; + + float mag = 1.0; + float freq = 1.0; + float scroll_speed = 1.0; + for(int i=0; i<3; i++) + { + // move more near the right + float movement_amount = fract(p2.x); + if(movement_amount > 0.9) movement_amount = 0.0; + + // wibble + float f = (p.x) * freq * k_freq - time * scroll_speed * k_scroll_speed; + float dx = cos( f ) * mag * movement_amount; + float dy = (sin( f ) ) * mag * movement_amount; + + p2.x += dx * k_x_movement; + p2.y += dy * k_y_movement; + + // accumulate dx movement for shading + nx += dx; + + freq *= 2.0; + mag *= 0.5; + scroll_speed *= 2.5; + } + + shade = clamp(0.8 - nx * 0.2, 0.0, 1.0); + #endif // WAVE + + float index = floor(p2.x) + floor(p2.y) * 5.0; + vec2 vFlagCoord = fract(p2) * 1.25; + + // default background + vec3 vCol = vec3(0.0, 0.2, 0.0); + + // get flag col + if((vFlagCoord.x <= 1.0) && (vFlagCoord.y <= 1.0)) + { + vCol = GetFlagCol( vFlagCoord, index ) * shade; + } + + //vCol = GetFlagCol( p, kFlagCount ); // uncomment to show flag full screen + + gl_FragColor = vec4( vCol, 1.0 ); +} diff --git a/shaders/fluid_spiral.frag b/shaders/fluid_spiral.frag new file mode 100644 index 0000000..0d89148 --- /dev/null +++ b/shaders/fluid_spiral.frag @@ -0,0 +1,225 @@ +#ifdef GL_ES +precision lowp float; +#endif +// *********************************************************** +// Alcatraz / Rhodium 4k Intro liquid carbon +// by Jochen "Virgill" Feldkötter +// +// 4kb executable: http://www.pouet.net/prod.php?which=68239 +// Youtube: https://www.youtube.com/watch?v=YK7fbtQw3ZU +// *********************************************************** +// PORTED to GLSLHeroku/Sandbox by JaK^threepixels + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; +uniform sampler2D optTex; +uniform sampler2D backbuffer; + +float lowFreq; +float midFreq; +float highFreq; + + +//#define time iTime +const float GA =2.399; +mat2 rot = mat2(cos(GA),sin(GA),-sin(GA),cos(GA)); + +float bounce = 0.0f; + +// signed box +float sdBox(vec3 p,vec3 b) +{ + vec3 d=abs(p)-b; + return min(max(d.x,max(d.y,d.z)),0.)+length(max(d,0.)); +} + +// rotation +void pR(inout vec2 p,float a) +{ + p=cos(a)*p+sin(a)*vec2(p.y,-p.x); +} + +// 3D noise function (IQ) +float noise(vec3 p) +{ + vec3 ip=floor(p); + p-=ip; + vec3 s=vec3(7,875,113); + vec4 h=vec4(0.,s.yz,s.y+s.z)+dot(ip,s); + p=p*p*(3.-2.*p); + h=mix(fract(sin(h)*43758.5),fract(sin(h+s.x)*43758.5),p.x); + h.xy=mix(h.xz,h.yw,p.y); + return mix(h.x,h.y,p.z); +} + +float map(vec3 p) +{ + p.z-=1.0; + p*=0.9; + pR(p.yz,bounce*1.+0.4*p.x); + return sdBox(p+vec3(0,sin(1.6*time),0),vec3(20.0, 0.05, 1.2))-.4*noise(8.*p+3.*bounce); +} + +// normal calculation +vec3 calcNormal(vec3 pos) +{ + float eps=0.0001; + float d=map(pos); + return normalize(vec3(map(pos+vec3(eps,0,0))-d,map(pos+vec3(0,eps,0))-d,map(pos+vec3(0,0,eps))-d)); +} + + +// standard sphere tracing inside and outside +float castRayx(vec3 ro,vec3 rd) +{ + float function_sign=(map(ro)<0.)?-1.:1.; + float precis=.0001; + float h=precis*2.; + float t=0.; + for(int i=0;i<120;i++) + { + if(abs(h)12.)break; + h=function_sign*map(ro+rd*t); + t+=h; + } + return t; +} + +// refraction +float refr(vec3 pos,vec3 lig,vec3 dir,vec3 nor,float angle,out float t2, out vec3 nor2) +{ + float h=0.; + t2=2.; + vec3 dir2=refract(dir,nor,angle); + for(int i=0;i<50;i++) + { + if(abs(h)>3.) break; + h=map(pos+dir2*t2); + t2-=h; + } + nor2=calcNormal(pos+dir2*t2); + return(.5*clamp(dot(-lig,nor2),0.,1.)+pow(max(dot(reflect(dir2,nor2),lig),0.),8.)); +} + +// softshadow +float softshadow(vec3 ro,vec3 rd) +{ + float sh=1.; + float t=.02; + float h=.0; + for(int i=0;i<22;i++) + { + if(t>20.)continue; + h=map(ro+rd*t); + sh=min(sh,4.*h/t); + t+=h; + } + return sh; +} + +// main function +vec4 mainScene(vec2 fragCoord) +{ + bounce=abs(fract(0.05*time)-.5)*20.; // triangle function + + vec2 uv=gl_FragCoord.xy/resolution.xy; + vec2 p=uv*2.-1.; + +// bouncy cam every 10 seconds + float wobble=(fract(.1*(time-1.))>=0.9)?fract(-time)*0.1*sin(30.*time):0.; + +// camera + vec3 dir = normalize(vec3(2.*gl_FragCoord.xy -resolution.xy, resolution.y)); + vec3 org = vec3(0,2.*wobble,-3.); + + +// standard sphere tracing: + vec3 color = vec3(0.); + vec3 color2 =vec3(0.); + float t=castRayx(org,dir); + vec3 pos=org+dir*t; + vec3 nor=calcNormal(pos); + +// lighting: + vec3 lig=normalize(vec3(.2,6.,.5)); +// scene depth + float depth=clamp((1.-0.09*t),0.,1.); + + vec3 pos2 = vec3(0.); + vec3 nor2 = vec3(0.); + if(t<12.0) + { + color2 = vec3(max(dot(lig,nor),0.) + pow(max(dot(reflect(dir,nor),lig),0.),16.)); + color2 *=clamp(softshadow(pos,lig),0.,1.); // shadow + float t2; + color2.rgb +=refr(pos,lig,dir,nor,0.9, t2, nor2)*depth; + color2-=clamp(.1*t2,0.,1.); // inner intensity loss + + } + + float tmp = 0.; + float T = 1.; + +// animation of glow intensity + float intensity = 0.1*-sin(.209*time+1.)+0.05; + for(int i=0; i<128; i++) + { + float density = 0.; float nebula = noise(org+bounce); + density=intensity-map(org+.5*nor2)*nebula; + if(density>0.) + { + tmp = density / 128.; + T *= 1. -tmp * 100.; + if( T <= 0.) break; + } + org += dir*0.078; + } + vec3 basecol=vec3(1./1. , 1./4. , 1./16.); + T=clamp(T,0.,1.5); + color += basecol* exp(4.*(0.5-T) - 0.8); + color2*=depth; + color2+= (1.-depth)*noise(6.*dir+0.3*time)*.1; // subtle mist + + +// scene depth included in alpha channel + vec4 finalRGB = vec4(vec3(1.*color+0.8*color2)*1.3,abs(0.67-depth)*2.+4.*wobble); + return finalRGB; +} + + +// simplyfied version of Dave Hoskins blur +vec3 dof(sampler2D tex,vec2 uv,float rad) +//vec3 dof(vec3 Coltex,vec2 uv,float rad) +{ + vec3 acc=vec3(0); + vec2 pixel=vec2(.002*resolution.y/resolution.x,.002),angle=vec2(0,rad);; + rad=1.; + for (int j=0;j<80;j++) + { + rad += 1./rad; + angle*=rot; + vec4 col=texture2D(tex,uv+pixel*(rad-1.)*angle); + acc+=col.xyz; + } + return acc/80.; +} + +//------------------------------------------------------------------------------------------- +//void mainImage(out vec4 fragColor,in vec2 fragCoord) +//{ + uniform sampler2D mainRender; +void main() { + +// sampler2D mainRender; + + vec2 uv = gl_FragCoord.xy / resolution.xy; //Condensing this into one line + vec4 mainPixels=mainScene(uv); + mainPixels.w=1.0; + //Can't use an alternate buffer to write in glslsandbox? + //texture2D(backbuffer,uv)=mainPixels; + //gl_FragColor=vec4(dof(backbuffer,uv,texture2D(backbuffer,uv).w),1.); + + gl_FragColor=mainPixels; + //vec4(dof(mainRender,uv,mainPixels.w),1.); +} diff --git a/shaders/green_lines.frag b/shaders/green_lines.frag new file mode 100644 index 0000000..2a72c9c --- /dev/null +++ b/shaders/green_lines.frag @@ -0,0 +1,47 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; +//uniform vec2 mouse; +uniform vec2 resolution; + +// bonniemathew@gmail.com + +//vec3 COLOR1 = vec3(0.0, 0.0, 0.50); +//vec3 COLOR2 = vec3(0.30, .0, 0.0); + +const vec3 COLOR1 = vec3(0.0, 0.0, 0.0); +vec3 COLOR2 = COLOR1; + +float BLOCK_WIDTH = 0.01; + +void main() { + + + vec2 position = ( gl_FragCoord.xy / resolution.xy ); + vec3 final_color = vec3(1.0); + + // For creating the BG pattern + float c1 = mod(position.x, 2.0 * BLOCK_WIDTH); + c1 = step(position.x*0.01, c1); + float c2 = mod(position.y, 2.0 * BLOCK_WIDTH); + c2 = step(BLOCK_WIDTH, c2); + + final_color = mix( position.x * COLOR1, position.y * COLOR2, c1 * c2); + + + // creating the wave + position = -1.0 + 2.0 * position; + float lineWidth = 10.0; + vec2 sPos = position ; + for( float i = 0.0; i < 13.; i++) { + sPos.y += ((0.07*cos(time)) * tan(position.x + i/5.0+ sin(time*0.5))); + + lineWidth = abs(1.0 / (750.0 * sPos.y)); + final_color = final_color + vec3(lineWidth * 0.9, lineWidth*1.9, lineWidth * 0.); + + } + + gl_FragColor = vec4(final_color, 1.0); +} diff --git a/shaders/light_line.frag b/shaders/light_line.frag new file mode 100644 index 0000000..99ee30e --- /dev/null +++ b/shaders/light_line.frag @@ -0,0 +1,63 @@ +// Lightning +// By: Brandon Fogerty +// bfogerty at gmail dot com +// xdpixel.com + + +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; + + +float Hash( vec2 p) +{ + vec3 p2 = vec3(p.xy,2.0); + return fract(sin(dot(p2,vec3(27.1,20.7, 2.4)))*0.5453123); +} + +float noise(in vec2 p) +{ + vec2 i = floor(p); + vec2 f = fract(p); + f *= f * (3.0-2.0*f); + return mix(mix(Hash(i + vec2(0.,0.)), Hash(i + vec2(1.,0.)),f.x), + mix(Hash(i + vec2(0.,1.)), Hash(i + vec2(1.,1.)),f.x), + f.y); +} + +float fbm(vec2 p) +{ + float v = 0.0; + v += noise(p*1.0) * .5; + v += noise(p*2.) * .25; + v += noise(p*4.) * .15; + return v; +} + +void main( void ) +{ + + vec2 uv = ( gl_FragCoord.xy / resolution.xy ) * 2.0 - 1.0; + + vec2 center = vec2(0.0, 0.0); + float angle = time * 0.4; + + //uv.x = cos(angle) * (uv.x - center.x) - sin(angle) * (uv.y - center.y) + center.x; + //uv.y = sin(angle) * (uv.x - center.y) + cos(angle) * (uv.y - center.y) + center.y; + + vec3 finalColor = vec3( 0.0 ); + for( int i=0; i < 3; ++i ) + { + float t = abs( 1.4 / (sin(uv.y + fbm( uv + time * 0.04 )) * 100.0) ); + + finalColor += t * vec3( 2.9, 1.5, .25 ); + finalColor = vec3(t); + } + + gl_FragColor = vec4( finalColor, 1.0 ); + +} diff --git a/shaders/light_wave.frag b/shaders/light_wave.frag new file mode 100644 index 0000000..bf1b774 --- /dev/null +++ b/shaders/light_wave.frag @@ -0,0 +1,26 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; + +uniform vec2 resolution; + +#define PI 30 + + +void main( void ) { + + vec2 p = ( gl_FragCoord.xy / resolution.xy ) -0.5; + + float sx = 0.3 * (p.x*p.x*5.0 - 0.7) * cos( 45.0 * p.x - 15. * pow(time*0.03, 0.7)*9.); + + float dy = 9./ ( 423. * abs(p.y - sx)); + + dy += 11./ (200. * length(p - vec2(p.x, 0.0 + ))); + + gl_FragColor = vec4( (p.x + 0.2 + ) * dy, 0.3 * dy, dy, 6.1 ); + +} diff --git a/shaders/matrix.frag b/shaders/matrix.frag new file mode 100644 index 0000000..62ed792 --- /dev/null +++ b/shaders/matrix.frag @@ -0,0 +1,98 @@ +#define RAIN_SPEED 0.75 // Speed of rain droplets +#define DROP_SIZE 15.0 // Higher value lowers, the size of individual droplets + +precision highp float; + +uniform float time; +uniform vec2 resolution; + +float rand(vec2 co){ + return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); +} + +float rchar(vec2 outer, vec2 inner, float globalTime) { + //return float(rand(floor(inner * 2.0) + outer) > 0.9); + + vec2 seed = floor(inner * 4.0) + outer.y; + if (rand(vec2(outer.y, 23.0)) > 0.98) { + seed += floor((globalTime + rand(vec2(outer.y, 49.0))) * 3.0); + } + + return float(rand(seed) > 0.5); +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) { + + vec2 position = fragCoord.xy / resolution.xy; + vec2 uv = vec2(position.x, position.y); + position.x /= resolution.x / resolution.y; + float globalTime = time * RAIN_SPEED; + + float scaledown = DROP_SIZE; + float rx = fragCoord.x / (40.0 * scaledown); + float mx = 40.0*scaledown*fract(position.x * 30.0 * scaledown); + vec4 result; + + if (mx > 12.0 * scaledown) { + result = vec4(0.0); + } else + { + float x = floor(rx); + float r1x = floor(fragCoord.x / (15.0)); + + + float ry = position.y*600.0 + rand(vec2(x, x * 3.0)) * 100000.0 + globalTime* rand(vec2(r1x, 23.0)) * 120.0; + float my = mod(ry, 15.0); + if (my > 12.0 * scaledown) { + result = vec4(0.0); + } else { + + float y = floor(ry / 15.0); + + float b = rchar(vec2(rx, floor((ry) / 15.0)), vec2(mx, my) / 12.0, globalTime); + float col = max(mod(-y, 24.0) - 4.0, 0.0) / 20.0; + vec3 c = col < 0.8 ? vec3(0.0, col / 0.8, 0.0) : mix(vec3(0.0, 1.0, 0.0), vec3(1.0), (col - 0.8) / 0.2); + + result = vec4(c * b, 1.0) ; + } + } + + position.x += 0.05; + + scaledown = DROP_SIZE; + rx = fragCoord.x / (40.0 * scaledown); + mx = 40.0*scaledown*fract(position.x * 30.0 * scaledown); + + if (mx > 12.0 * scaledown) { + result += vec4(0.0); + } else + { + float x = floor(rx); + float r1x = floor(fragCoord.x / (12.0)); + + + float ry = position.y*700.0 + rand(vec2(x, x * 3.0)) * 100000.0 + globalTime* rand(vec2(r1x, 23.0)) * 120.0; + float my = mod(ry, 15.0); + if (my > 12.0 * scaledown) { + result += vec4(0.0); + } else { + + float y = floor(ry / 15.0); + + float b = rchar(vec2(rx, floor((ry) / 15.0)), vec2(mx, my) / 12.0, globalTime); + float col = max(mod(-y, 24.0) - 4.0, 0.0) / 20.0; + vec3 c = col < 0.8 ? vec3(0.0, col / 0.8, 0.0) : mix(vec3(0.0, 1.0, 0.0), vec3(1.0), (col - 0.8) / 0.2); + + result += vec4(c * b, 1.0) ; + } + } + + result = result * length(vec3(.2)) + 0.22 * vec4(0.,0.5,0.,1.); + if(result.b < 0.5) + result.b = result.g * 0.5 ; + fragColor = result; +} + +void main() { + mainImage(gl_FragColor, gl_FragCoord.xy); +} diff --git a/shaders/mickey.frag b/shaders/mickey.frag new file mode 100644 index 0000000..c0e2c59 --- /dev/null +++ b/shaders/mickey.frag @@ -0,0 +1,67 @@ +/* + * Original shader from: https://www.shadertoy.com/view/4dGfDy + */ + +#ifdef GL_ES +precision mediump float; +#endif + +// glslsandbox uniforms +uniform float time; +uniform vec2 resolution; + +// shadertoy globals +#define iTime time +#define iResolution resolution + +// --------[ Original ShaderToy begins here ]---------- // +float circle(vec2 uv, vec2 position, float radius, float blur) { + uv -=0.5; // position of the circle || to make (0,0) center of the screen + uv.y*=iResolution.y/iResolution.x; //to make it a circle + float d = length(uv-position); + float c = smoothstep(radius,radius-blur,d); //if(d circle.x && p.y - w < circle.y && p.y + w > circle.y; +} + +vec3 palette (in float t) { + vec3 a = vec3(0.93,0.43,0.76); + vec3 b = vec3(0.90,0.31,0.24); + vec3 c = vec3(0.41,0.93,1.0); + vec3 d = vec3(0,0.44,0.32); + return a + b*cos( 2.0*M_PI*(c*t+d) ); +} + +vec3 drawCircle (in vec2 p, in vec2 circle, in vec3 setting) { + if(boxtest(p, circle, setting.x) && !(boxtest(p, circle, setting.x - setting.y))) + return palette(setting.z / 70.0 + time * 0.1); + + return vec3(0.0); +} + +void main (void) { + vec2 uv = (gl_FragCoord.xy / resolution.xy); + vec2 aspect = resolution.xy / min(resolution.x, resolution.y); + vec2 center = vec2(0.5); + vec2 pos = uv - center; + float horizon = 0.03*cos(time); //lil motion here + float fov = -0.5; //if we negate fov the box has a better palette relationship with the planes + + vec3 p = vec3(pos.x, fov, pos.y - horizon); + float scroll = (time * -sign(p.z)); + float bump = noise((vec2(p.x + 100., p.y) * 20.)) * 0.1; + vec2 s = vec2(p.x/p.z, p.y/p.z + bump + scroll) * 0.1; //actual plane position + + bool grid = (fract(s.y / 0.02) > 0.95) || (fract(s.x / 0.02) > 0.95); + vec3 gridColor = (mix(palette(s.y + bump * 0.5), vec3(1.0), float(grid))); + gridColor = mix(gridColor, vec3(1.0), 0.3); //slight desaturate and boost + float fog = pow(sin(uv.y * M_PI), 5.); + vec3 color = mix(gridColor, vec3(1.0), fog); + + float a = sin(time) * 0.6; //box angle + mat2 rot = mat2(cos(a), -sin(a), sin(a), cos(a)); + pos = uv * aspect * rot; + center *= aspect * rot; + + for(int i = 0; i < 50; i++) { + vec3 d = drawCircle(pos, center + vec2(sin(float(i) / 10.0 + time) / 4.0, 0.0), vec3(0.0 + sin(float(i) / 200.0), 0.01 , float(i))); + if(d.x > 0.) color = mix(d, vec3(1.0), 0.3); //slight desaturate and boost + } + gl_FragColor = vec4(color, 1.0); +} diff --git a/shaders/snake_torus.frag b/shaders/snake_torus.frag new file mode 100644 index 0000000..78ae811 --- /dev/null +++ b/shaders/snake_torus.frag @@ -0,0 +1,132 @@ +/* +* License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. +* Created by bal-khan +*/ + +precision highp float; + +uniform float time; +uniform vec2 resolution; + +vec2 march(vec3 pos, vec3 dir); +vec3 camera(vec2 uv); +void rotate(inout vec2 v, float angle); + +float t; // time +vec3 ret_col; // torus color +vec3 h; // light amount + +#define I_MAX 400. +#define E 0.00001 +#define FAR 50. +#define PI 3.14 + +// blackbody by aiekick : https://www.shadertoy.com/view/lttXDn + +// -------------blackbody----------------- // + +// return color from temperature +//http://www.physics.sfasu.edu/astro/color/blackbody.html +//http://www.vendian.org/mncharity/dir3/blackbody/ +//http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html + +vec3 blackbody(float Temp) +{ + vec3 col = vec3(255.); + col.x = 56100000. * pow(Temp,(-3. / 2.)) + 148.; + col.y = 100.04 * log(Temp) - 623.6; + if (Temp > 6500.) col.y = 35200000. * pow(Temp,(-3. / 2.)) + 184.; + col.z = 194.18 * log(Temp) - 1448.6; + col = clamp(col, 0., 255.)/255.; + if (Temp < 1000.) col *= Temp/1000.; + return col; +} + +// -------------blackbody----------------- // + +void mainImage(out vec4 c_out, in vec2 f) +{ + t = time*.125; + vec3 col = vec3(0., 0., 0.); + vec2 R = resolution.xy, + uv = vec2(f-R/2.) / R.y; + vec3 dir = camera(uv); + vec3 pos = vec3(.0, .0, 0.0); + + pos.z = 4.5+1.5*sin(t*10.); + h*=0.; + vec2 inter = (march(pos, dir)); + col.xyz = ret_col*(1.-inter.x*.0125); + col += h * .4; + c_out = vec4(col,1.0); +} + +void main() { + mainImage(gl_FragColor, gl_FragCoord.xy); +} + +float scene(vec3 p) +{ + float var; + float mind = 1e5; + p.z += 10.; + + rotate(p.xz, 1.57-.5*time ); + rotate(p.yz, 1.57-.5*time ); + var = atan(p.x,p.y); + vec2 q = vec2( ( length(p.xy) )-6.,p.z); + rotate(q, var*.25+time*2.*0.); + vec2 oq = q ; + q = abs(q)-2.5; + if (oq.x < q.x && oq.y > q.y) + rotate(q, ( (var*1.)+time*0.)*3.14+time*0.); + else + rotate(q, ( .28-(var*1.)+time*0.)*3.14+time*0.); + float oldvar = var; + ret_col = 1.-vec3(.350, .2, .3); + mind = length(q)+.5+1.05*(length(fract(q*.5*(3.+3.*sin(oldvar*1. - time*2.)) )-.5)-1.215); + h -= vec3(-3.20,.20,1.0)*vec3(1.)*.0025/(.051+(mind-sin(oldvar*1. - time*2. + 3.14)*.125 )*(mind-sin(oldvar*1. - time*2. + 3.14)*.125 ) ); + h -= vec3(1.20,-.50,-.50)*vec3(1.)*.025/(.501+(mind-sin(oldvar*1. - time*2.)*.5 )*(mind-sin(oldvar*1. - time*2.)*.5 ) ); + h += vec3(.25, .4, .5)*.0025/(.021+mind*mind); + + return (mind); +} + +vec2 march(vec3 pos, vec3 dir) +{ + vec2 dist = vec2(0.0, 0.0); + vec3 p = vec3(0.0, 0.0, 0.0); + vec2 s = vec2(0.0, 0.0); + + for (float i = -1.; i < I_MAX; ++i) + { + p = pos + dir * dist.y; + dist.x = scene(p); + dist.y += dist.x*.2; // makes artefacts disappear + // log trick by aiekick + if (log(dist.y*dist.y/dist.x/1e5) > .0 || dist.x < E || dist.y > FAR) + { + break; + } + s.x++; + } + s.y = dist.y; + return (s); +} + +// Utilities + +void rotate(inout vec2 v, float angle) +{ + v = vec2(cos(angle)*v.x+sin(angle)*v.y,-sin(angle)*v.x+cos(angle)*v.y); +} + +vec3 camera(vec2 uv) +{ + float fov = 1.; + vec3 forw = vec3(0.0, 0.0, -1.0); + vec3 right = vec3(1.0, 0.0, 0.0); + vec3 up = vec3(0.0, 1.0, 0.0); + + return (normalize((uv.x) * right + (uv.y) * up + fov * forw)); +} diff --git a/shaders/snake_torus_lite.frag b/shaders/snake_torus_lite.frag new file mode 100644 index 0000000..f7e4cc0 --- /dev/null +++ b/shaders/snake_torus_lite.frag @@ -0,0 +1,132 @@ +/* +* License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. +* Created by bal-khan +*/ + +precision highp float; + +uniform float time; +uniform vec2 resolution; + +vec2 march(vec3 pos, vec3 dir); +vec3 camera(vec2 uv); +void rotate(inout vec2 v, float angle); + +float t; // time +vec3 ret_col; // torus color +vec3 h; // light amount + +#define I_MAX 30. +#define E 0.00001 +#define FAR 50. +#define PI 3.14 + +// blackbody by aiekick : https://www.shadertoy.com/view/lttXDn + +// -------------blackbody----------------- // + +// return color from temperature +//http://www.physics.sfasu.edu/astro/color/blackbody.html +//http://www.vendian.org/mncharity/dir3/blackbody/ +//http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html + +vec3 blackbody(float Temp) +{ + vec3 col = vec3(255.); + col.x = 56100000. * pow(Temp,(-3. / 2.)) + 148.; + col.y = 100.04 * log(Temp) - 623.6; + if (Temp > 6500.) col.y = 35200000. * pow(Temp,(-3. / 2.)) + 184.; + col.z = 194.18 * log(Temp) - 1448.6; + col = clamp(col, 0., 255.)/255.; + if (Temp < 1000.) col *= Temp/1000.; + return col; +} + +// -------------blackbody----------------- // + +void mainImage(out vec4 c_out, in vec2 f) +{ + t = time*.125; + vec3 col = vec3(0., 0., 0.); + vec2 R = resolution.xy, + uv = vec2(f-R/2.) / R.y; + vec3 dir = camera(uv); + vec3 pos = vec3(.0, .0, 0.0); + + pos.z = 4.5+1.5*sin(t*10.); + h*=0.; + vec2 inter = (march(pos, dir)); + col.xyz = ret_col*(1.-inter.x*.0125); + col += h * .4; + c_out = vec4(col,1.0); +} + +void main() { + mainImage(gl_FragColor, gl_FragCoord.xy); +} + +float scene(vec3 p) +{ + float var; + float mind = 1e5; + p.z += 20.; + + rotate(p.xz, 1.57-.5*time ); + rotate(p.yz, 1.57-.5*time ); + var = atan(p.x,p.y); + vec2 q = vec2( ( length(p.xy) )-6.,p.z); + rotate(q, var*.25+time*2.*0.); + vec2 oq = q ; + q = abs(q)-2.5; + if (oq.x < q.x && oq.y > q.y) + rotate(q, ( (var*1.)+time*0.)*3.14+time*0.); + else + rotate(q, ( .28-(var*1.)+time*0.)*3.14+time*0.); + float oldvar = var; + ret_col = 1.-vec3(.350, .2, .3); + mind = length(q)+.5+1.05*(length(fract(q*.5*(3.+3.*sin(oldvar*1. - time*2.)) )-.5)-1.215); + h -= vec3(-3.20,.20,1.0)*vec3(1.)*.0025/(.051+(mind-sin(oldvar*1. - time*2. + 3.14)*.125 )*(mind-sin(oldvar*1. - time*2. + 3.14)*.125 ) ); + h -= vec3(1.20,-.50,-.50)*vec3(1.)*.025/(.501+(mind-sin(oldvar*1. - time*2.)*.5 )*(mind-sin(oldvar*1. - time*2.)*.5 ) ); + h += vec3(.25, .4, .5)*.0025/(.021+mind*mind); + + return (mind); +} + +vec2 march(vec3 pos, vec3 dir) +{ + vec2 dist = vec2(0.0, 0.0); + vec3 p = vec3(0.0, 0.0, 0.0); + vec2 s = vec2(0.0, 0.0); + + for (float i = -1.; i < I_MAX; ++i) + { + p = pos + dir * dist.y; + dist.x = scene(p); + dist.y += dist.x*.6; // makes artefacts disappear + // log trick by aiekick + if (log(dist.y*dist.y/dist.x/1e5) > .0 || dist.x < E || dist.y > FAR) + { + break; + } + s.x++; + } + s.y = dist.y; + return (s); +} + +// Utilities + +void rotate(inout vec2 v, float angle) +{ + v = vec2(cos(angle)*v.x+sin(angle)*v.y,-sin(angle)*v.x+cos(angle)*v.y); +} + +vec3 camera(vec2 uv) +{ + float fov = 1.; + vec3 forw = vec3(0.0, 0.0, -1.0); + vec3 right = vec3(1.0, 0.0, 0.0); + vec3 up = vec3(0.0, 1.0, 0.0); + + return (normalize((uv.x) * right + (uv.y) * up + fov * forw)); +} diff --git a/shaders/snake_torus_mk2.frag b/shaders/snake_torus_mk2.frag new file mode 100644 index 0000000..2b24c6e --- /dev/null +++ b/shaders/snake_torus_mk2.frag @@ -0,0 +1,159 @@ +/* +* License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. +* +* Created by wj just by playing with the formula of the original version +* +* here: https://www.shadertoy.com/view/lt2fDz created by bal-khan +* +* (and by adding some music..= +*/ + +precision highp float; + +uniform float time; +uniform vec2 resolution; + +float iTime; +vec2 iResolution; + +vec2 march(vec3 pos, vec3 dir); +vec3 camera(vec2 uv); +void rotate(inout vec2 v, float angle); + +float t; // time +vec3 ret_col; // torus color +vec3 h; // light amount + +#define I_MAX 400. +#define E 0.00001 +#define FAR 50. +#define PI 3.14 + +// blackbody by aiekick : https://www.shadertoy.com/view/lttXDn + +// -------------blackbody----------------- // + +// return color from temperature +//http://www.physics.sfasu.edu/astro/color/blackbody.html +//http://www.vendian.org/mncharity/dir3/blackbody/ +//http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html + +vec3 blackbody(float Temp) +{ + vec3 col = vec3(255.); + col.x = 56100000. * pow(Temp,(-3. / 2.)) + 148.; + col.y = 100.04 * log(Temp) - 623.6; + if (Temp > 6500.) col.y = 35200000. * pow(Temp,(-3. / 2.)) + 184.; + col.z = 194.18 * log(Temp) - 1448.6; + col = clamp(col, 0., 255.)/255.; + if (Temp < 1000.) col *= Temp/1000.; + return col; +} + +// -------------blackbody----------------- // + +void mainImage(out vec4 c_out, in vec2 f) +{ + t = iTime*.125; + vec3 col = vec3(0., 0., 0.); + vec2 R = iResolution.xy, + uv = vec2(f-R/2.) / R.y; + vec3 dir = camera(uv); + vec3 pos = vec3(.0, .0, 0.0); + + pos.z = 4.5+1.5*sin(t*10.); // add camera movement + + h*=0.; + vec2 inter = (march(pos, dir)); + col.xyz = ret_col*(1.-inter.x*.0125); + col += h * .4; + c_out = vec4(col,1.0); +} + +void main() { + iTime = time; + iResolution = resolution; + mainImage(gl_FragColor, gl_FragCoord.xy); +} + +float scene(vec3 p) +{ + float var; + float mind = 1e5; + + // overall object placement + p.z += 25.; + rotate(p.xz, 1.57-.5*iTime ); + rotate(p.yz, 1.57-.5*iTime ); + + var = atan(p.x,p.y); + vec2 q = vec2( ( length(p.xy) )-9.,p.z); + float ttwists=0.75; + rotate(q, var*ttwists+iTime*0.4); + + vec2 oq = q ; + + q = abs(q)-vec2(3.,3.)-sin(q)*7.; // add some twists + + float twist= 3.3; // twists the "blue" strands + float s= iTime*1.; // add "movement speed" to the "blue" strands + if (oq.x < q.x && oq.y > q.y){ + rotate(q, ( (var*twist)+s)*3.14+s); + }else{ + rotate(q, ( 0.28-(var*twist)+s)*3.14+s); + } + + float oldvar = var; + ret_col = 1.-vec3(.350, .2, .3); + + q=q*0.2; + + mind = length(q)+.5+1.05*(length(fract(q*.5*(3.+3.*sin(oldvar*1. - iTime*1.)) )-.5)-1.215); + // only the coloring: + h -= vec3(-3.20,.20,1.0)*vec3(1.)*.0025/(.051+(mind-sin(oldvar*1. - iTime*2. + 3.14)*.125 )*(mind-sin(oldvar*1. - iTime*2. + 3.14)*.125 ) ); + h -= vec3(1.20,-.50,-.50)*vec3(1.)*.025/(.501+(mind-sin(oldvar*1. - iTime*2.)*.5 )*(mind-sin(oldvar*1. - iTime*2.)*.5 ) ); + h += vec3(.25, .4, .5)*.0025/(.021+mind*mind); + + // add some music feedback + + return (mind); +} + +vec2 march(vec3 pos, vec3 dir) +{ + vec2 dist = vec2(0.0, 0.0); + vec3 p = vec3(0.0, 0.0, 0.0); + vec2 s = vec2(0.0, 0.0); + + for (float i = -1.; i < I_MAX; ++i) + { + p = pos + dir * dist.y; + dist.x = scene(p); + dist.y += dist.x*.2; // makes artefacts disappear + // log trick by aiekick + if (log(dist.y*dist.y/dist.x/1e5) > .0 || dist.x < E || dist.y > FAR) + { + break; + } + s.x++; + } + s.y = dist.y; + return (s); +} + +// Utilities + +void rotate(inout vec2 v, float angle) +{ + v = vec2(cos(angle)*v.x+sin(angle)*v.y,-sin(angle)*v.x+cos(angle)*v.y); +} + +vec3 camera(vec2 uv) +{ + float fov = 1.; + vec3 forw = vec3(0.0, 0.0, -1.0); + vec3 right = vec3(1.0, 0.0, 0.0); + vec3 up = vec3(0.0, 1.0, 0.0); + + return (normalize((uv.x) * right + (uv.y) * up + fov * forw)); +} diff --git a/shaders/space.frag b/shaders/space.frag new file mode 100644 index 0000000..e084080 --- /dev/null +++ b/shaders/space.frag @@ -0,0 +1,177 @@ +#ifdef GL_ES +precision highp float; // ios +#endif + + +uniform float time; +// uniform vec2 mouse; +#define mouse vec2(time* 0.0, time * 0.0) +uniform vec2 resolution; + + +#define iterations 12 +#define formuparam2 0.79 + +#define volsteps 7 +#define stepsize 0.290 + +#define zoom 1.0 +#define tile 0.850 +#define speed2 0.2 + +#define brightness 0.0015 +#define darkmatter 0.100 +#define distfading 0.560 +#define saturation 0.90 + + +#define transverseSpeed zoom +#define cloud 0.17 + + +float triangle(float x, float a) { + float output2 = 2.0*abs( 3.0* ( (x/a) - floor( (x/a) + 0.5) ) ) - 1.0; + return output2; +} + +float field(in vec3 p) { + float strength = 7. + .03 * log(1.e-6 + fract(sin(time) * 373.11)); + float accum = 0.; + float prev = 0.; + float tw = 0.; + + for (int i = 0; i < 6; ++i) { + float mag = dot(p, p); + p = abs(p) / mag + vec3(-.5, -.8 + 0.1*sin(-time*0.1 + 2.0), -1.1+0.3*cos(time*0.3)); + float w = exp(-float(i) / 7.); + accum += w * exp(-strength * pow(abs(mag - prev), 2.3)); + tw += w; + prev = mag; + } + return max(0., 5. * accum / tw - .7); +} + + + +void main() { + vec2 uv2 = 2. * gl_FragCoord.xy / vec2(512) - 1.; + vec2 uvs = uv2 * vec2(512) / 512.; + + float time2 = time; + float speed = -speed2; + speed = .005 * cos(time2*0.02 + 3.1415926/4.0); + //speed = 0.0; + float formuparam = formuparam2; + + //get coords and direction + vec2 uv = uvs; + //mouse rotation + float a_xz = 0.9; + float a_yz = -.6; + float a_xy = 0.9 + time*0.08; + + mat2 rot_xz = mat2(cos(a_xz),sin(a_xz),-sin(a_xz),cos(a_xz)); + mat2 rot_yz = mat2(cos(a_yz),sin(a_yz),-sin(a_yz),cos(a_yz)); + mat2 rot_xy = mat2(cos(a_xy),sin(a_xy),-sin(a_xy),cos(a_xy)); + + + float v2 =1.0; + vec3 dir=vec3(uv*zoom,1.); + vec3 from=vec3(0.0, 0.0,0.0); + from.x -= 2.0*(mouse.x-0.5); + from.y -= 2.0*(mouse.y-0.5); + + + vec3 forward = vec3(0.,0.,1.); + from.x += transverseSpeed*(1.0)*cos(0.01*time) + 0.001*time; + from.y += transverseSpeed*(1.0)*sin(0.01*time) +0.001*time; + from.z += 0.003*time; + + dir.xy*=rot_xy; + forward.xy *= rot_xy; + dir.xz*=rot_xz; + forward.xz *= rot_xz; + dir.yz*= rot_yz; + forward.yz *= rot_yz; + + from.xy*=-rot_xy; + from.xz*=rot_xz; + from.yz*= rot_yz; + + + //zoom + float zooom = (time2-3311.)*speed; + from += forward* zooom; + float sampleShift = mod( zooom, stepsize ); + + float zoffset = -sampleShift; + sampleShift /= stepsize; // make from 0 to 1 + + //volumetric rendering + float s=0.24; + float s3 = s + stepsize/2.0; + vec3 v=vec3(0.); + float t3 = 0.0; + + vec3 backCol2 = vec3(0.); + for (int r=0; r 7 ? min( 12., D) : D; + pa=length(p2); + } + + + //float dm=max(0.,darkmatter-a*a*.001); //dark matter + a*=a*a; // add contrast + //if (r>3) fade*=1.-dm; // dark matter, don't render near + // brightens stuff up a bit + float s1 = s+zoffset; + // need closed form expression for this, now that we shift samples + float fade = pow(distfading,max(0.,float(r)-sampleShift)); + //t3 += fade; + v+=fade; + //backCol2 -= fade; + + // fade out samples as they approach the camera + if( r == 0 ) + fade *= (1. - (sampleShift)); + // fade in samples as they approach from the distance + if( r == volsteps-1 ) + fade *= sampleShift; + v+=vec3(s1,s1*s1,s1*s1*s1*s1)*a*brightness*fade; // coloring based on distance + + backCol2 += mix(.4, 1., v2) * vec3(1.8 * t3 * t3 * t3, 1.4 * t3 * t3, t3) * fade; + + + s+=stepsize; + s3 += stepsize; + }//фор + + v=mix(vec3(length(v)),v,saturation); //color adjust + + vec4 forCol2 = vec4(v*.01,1.); + #ifdef cloud + backCol2 *= cloud; + #endif + backCol2.b *= 1.8; + backCol2.r *= 0.05; + + backCol2.b = 0.5*mix(backCol2.g, backCol2.b, 0.8); + backCol2.g = 0.0; + backCol2.bg = mix(backCol2.gb, backCol2.bg, 0.5*(cos(time*0.01) + 1.0)); + gl_FragColor = forCol2 + vec4(backCol2, 1.0); +} + diff --git a/shaders/spiral.frag b/shaders/spiral.frag new file mode 100644 index 0000000..4d029ae --- /dev/null +++ b/shaders/spiral.frag @@ -0,0 +1,47 @@ +/* + @machine_shaman +*/ +#extension GL_OES_standard_derivatives : enable + +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; + +mat2 rotate(float a) { + float c = cos(a); + float s = sin(a); + return mat2(c, -s, s, c); +} + +void main() { + + vec2 uv = (2. * gl_FragCoord.xy - resolution) / resolution.y; + vec3 col = vec3(0.); + + vec3 ro = vec3(0.0, 0.0, -3.0); + vec3 rd = vec3(uv, 1.0); + vec3 p = vec3(0.0); + float t = 0.; + + for (int i = 0; i < 64; i++) { + p = ro + rd * t; + p.xz *= rotate(p.y * 6.28 * 0.5 + time * 0.5); + vec2 q = vec2(length(p.xy) - 1., p.z); + float d = length(q) - .1; + d = min(d, length(p.xz) - (.3 - .2 * sin(time + p.y * 6.28 * 0.5))); + t += 0.5 * d; + col += .15 / (1. + t * t * t * 0.8); + } + + + + + + gl_FragColor = vec4(col, 1.); + + +} diff --git a/shaders/torus.frag b/shaders/torus.frag new file mode 100644 index 0000000..a614953 --- /dev/null +++ b/shaders/torus.frag @@ -0,0 +1,137 @@ +precision highp float; + +/* +* License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. +* Created by bal-khan +*/ + +uniform float time; +uniform vec2 resolution; + +float iTime; +vec2 iResolution; + +vec2 march(vec3 pos, vec3 dir); +vec3 camera(vec2 uv); +void rotate(inout vec2 v, float angle); + +float t; // time +vec3 ret_col; // torus color +vec3 h; // light amount + +#define I_MAX 400. +#define E 0.00001 +#define FAR 50. +#define PI 3.14 + +// blackbody by aiekick : https://www.shadertoy.com/view/lttXDn + +// -------------blackbody----------------- // + +// return color from temperature +//http://www.physics.sfasu.edu/astro/color/blackbody.html +//http://www.vendian.org/mncharity/dir3/blackbody/ +//http://www.vendian.org/mncharity/dir3/blackbody/UnstableURLs/bbr_color.html + +vec3 blackbody(float Temp) +{ + vec3 col = vec3(255.); + col.x = 56100000. * pow(Temp,(-3. / 2.)) + 148.; + col.y = 100.04 * log(Temp) - 623.6; + if (Temp > 6500.) col.y = 35200000. * pow(Temp,(-3. / 2.)) + 184.; + col.z = 194.18 * log(Temp) - 1448.6; + col = clamp(col, 0., 255.)/255.; + if (Temp < 1000.) col *= Temp/1000.; + return col; +} + +// -------------blackbody----------------- // + +void mainImage(out vec4 c_out, in vec2 f) +{ + t = iTime*.125; + vec3 col = vec3(0., 0., 0.); + vec2 R = iResolution.xy, + uv = vec2(f-R/2.) / R.y; + vec3 dir = camera(uv); + vec3 pos = vec3(.0, .0, 0.0); + + pos.z = 4.5+1.5*sin(t*10.); + h*=0.; + vec2 inter = (march(pos, dir)); + col.xyz = ret_col*(1.-inter.x*.0125); + col += h * .4; + c_out = vec4(col,1.0); +} + +void main() { + iTime = time; + iResolution = resolution; + mainImage(gl_FragColor, gl_FragCoord.xy); +} + +float scene(vec3 p) +{ + float var; + float mind = 1e5; + p.z += 10.; + + rotate(p.xz, 1.57-.5*iTime ); + rotate(p.yz, 1.57-.5*iTime ); + var = atan(p.x,p.y); + vec2 q = vec2( ( length(p.xy) )-6.,p.z); + rotate(q, var*.25+iTime*2.*0.); + vec2 oq = q ; + q = abs(q)-2.5; + if (oq.x < q.x && oq.y > q.y) + rotate(q, ( (var*1.)+iTime*0.)*3.14+iTime*0.); + else + rotate(q, ( .28-(var*1.)+iTime*0.)*3.14+iTime*0.); + float oldvar = var; + ret_col = 1.-vec3(.350, .2, .3); + mind = length(q)+.5+1.05*(length(fract(q*.5*(3.+3.*sin(oldvar*1. - iTime*2.)) )-.5)-1.215); + h -= vec3(-3.20,.20,1.0)*vec3(1.)*.0025/(.051+(mind-sin(oldvar*1. - iTime*2. + 3.14)*.125 )*(mind-sin(oldvar*1. - iTime*2. + 3.14)*.125 ) ); + h -= vec3(1.20,-.50,-.50)*vec3(1.)*.025/(.501+(mind-sin(oldvar*1. - iTime*2.)*.5 )*(mind-sin(oldvar*1. - iTime*2.)*.5 ) ); + h += vec3(.25, .4, .5)*.0025/(.021+mind*mind); + + return (mind); +} + +vec2 march(vec3 pos, vec3 dir) +{ + vec2 dist = vec2(0.0, 0.0); + vec3 p = vec3(0.0, 0.0, 0.0); + vec2 s = vec2(0.0, 0.0); + + for (float i = -1.; i < I_MAX; ++i) + { + p = pos + dir * dist.y; + dist.x = scene(p); + dist.y += dist.x*.2; // makes artefacts disappear + // log trick by aiekick + if (log(dist.y*dist.y/dist.x/1e5) > .0 || dist.x < E || dist.y > FAR) + { + break; + } + s.x++; + } + s.y = dist.y; + return (s); +} + +// Utilities + +void rotate(inout vec2 v, float angle) +{ + v = vec2(cos(angle)*v.x+sin(angle)*v.y,-sin(angle)*v.x+cos(angle)*v.y); +} + +vec3 camera(vec2 uv) +{ + float fov = 1.; + vec3 forw = vec3(0.0, 0.0, -1.0); + vec3 right = vec3(1.0, 0.0, 0.0); + vec3 up = vec3(0.0, 1.0, 0.0); + + return (normalize((uv.x) * right + (uv.y) * up + fov * forw)); +} diff --git a/shaders/trippy_cube.frag b/shaders/trippy_cube.frag new file mode 100644 index 0000000..d279071 --- /dev/null +++ b/shaders/trippy_cube.frag @@ -0,0 +1,121 @@ +#extension GL_OES_standard_derivatives : enable + +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; + +const float PI = 3.14159265; + +mat2 rot(float a){ + float c = cos(a),s = sin(a); + return mat2(c,s,-s,c); +} + +mat3 rot3D(float a){ + float c = cos(a),s = sin(a); + return mat3(c,-s,0., + s,c,0., + 0.,0.,1.0); +} + +float sphere(vec3 p){ + return length(p)-0.5; +} + + + +float deMengerSponge2(vec3 p, vec3 offset, float scale) { + vec4 z = vec4(p, 1.0); + for (int i = 0; i < 10; i++) { + z = abs(z); + if (z.x < z.y) z.xy = z.yx; + if (z.x < z.z) z.xz = z.zx; + if (z.y < z.z) z.yz = z.zy; + z *= scale; + z.xyz -= offset * (scale - 1.0); + if (z.z < -0.5 * offset.z * (scale - 1.0)) + z.z += offset.z * (scale - 1.0); + } + return (length(max(abs(z.xyz) - vec3(1.0, 1.0, 1.0), 0.0))) / z.w; +} + + + +float de(vec3 p) { + p.xy *= rot(time); + p.yz *= rot(time); + return deMengerSponge2(p, vec3(1.0), 3.0); +} + +float dist(vec3 p){ + + + + float d = de(p); + //p.xy = vec2(0.0); + p.xyz *= rot3D(time); + p = abs(p); + + for(int i = 0; i < 10; i++){ + //p.xy = mod(p.xy,4.0); + + p.xzy *= rot3D(0.3); + p.xyz *= rot3D(0.3); + p.yz = mod(p.yz,2.0); + + } + + p.xyz *= rot3D(sin(time)); + d = min(d,sphere(p)); + + return d; +} + +vec3 getnormal(vec3 p){ + float d = 0.0001; + return normalize(vec3( + dist(p+vec3(d,0.,0.))-dist(p+vec3(-d,0.,0.)), + dist(p+vec3(0.,d,0.))-dist(p+vec3(0.,-d,0.)), + dist(p+vec3(0.,0.,d))-dist(p+vec3(0.,0.,-d)) + )); +} + + +void main( void ) { + + vec2 p = ( gl_FragCoord.xy *2.0 -resolution ) / min(resolution.x,resolution.y); + + float angle = 60.0; + float fov = angle * 0.5 * PI/180.0; + vec3 cPos = vec3(0.0,0.0,4.0); + vec3 LightDir = vec3(-0.577,0.577,0.577); + + vec3 ray = normalize(vec3(sin(fov)*p.x,sin(fov)*p.y,-cos(fov))); + + vec2 d = vec2(float(0.0)); + float rLen = 0.0; + vec3 rPos = cPos; + + for(int i = 0; i <99; i++){ + d.x = dist(rPos); + d.y = de(rPos); + rLen +=d.x; + rPos = rLen*ray+cPos; + } + + if(abs(d.x)<0.001){ + vec3 normal = getnormal(rPos); + float diff = clamp(dot(normal,LightDir),0.2,1.0); + gl_FragColor = vec4( vec3(cos(time)*diff*cos(time)+0.5,cos(time)+0.5*diff,sin(time)*diff+0.5),1.0); + if(abs(d.y)<0.001){ + gl_FragColor = vec4(vec3(diff*ray*cos(time)+0.25),1.0); + } + }else{ + gl_FragColor = vec4( vec3(0.0),1.0); + } + +} diff --git a/shaders/tunnel.frag b/shaders/tunnel.frag new file mode 100644 index 0000000..fb9e443 --- /dev/null +++ b/shaders/tunnel.frag @@ -0,0 +1,76 @@ +#extension GL_OES_standard_derivatives : enable + +#ifdef GL_ES +precision highp float; +#endif + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; + +const float PI = 3.141592653589793; +const float PI2 = PI* 2.; + +#define saturate(x) clamp(x,0.,1.) + +float tri(float x){return abs(2.*fract(x*.5-.25)-1.)*2.-1.;} +float sqr(float x){return -2.*(step(.5,fract(x*.5))-.5);} +float circuit(float x){return clamp(tri(x*4.)*.25,(sqr(x)-1.)*.5,(sqr(x+.5)+1.)*.5);} +float circuit2(float x){return clamp(tri(x*.5)*.5,0.,.25);} +float flow(float x,float d){return (1.+sin(x+d*time*5.+3.))*.3+.3;} +vec2 pp(vec2 p){float r=.5/p.y;return vec2(p.x*r, r);} + + +void main(void){ + float t=floor(time * 0.8 *30.)/15.; + vec2 p = ( gl_FragCoord.xy - resolution.xy*.5 ) / resolution.x; + vec2 p2 = p; + vec3 color; + vec3 light_color = vec3(1,0.6,1.0); + float k = mix(fract(-p.y), 1.0, step(0., -p.y)); + if (p.y > 10.0) { + } else { + float l=0.,d=sign(p.y); + vec2 r = p; + vec2 q = p; + q=pp(q); + float n = floor(q.x/.5); + q.x=mod(q.x,.5)-.25; + p=pp(p); + l+=step(abs(q.x+circuit(q.y+sign(p.y)*t+n)),.005); + l+=pow(.001/abs(p.x+circuit(p.y+d*t)),flow(p.y,d)); + l+=pow(.001/abs(p.x+.75+circuit2(p.y+d*t)),(1.+sin(p.y+d*time*5.))*.3+.3); + l+=pow(.001/abs(p.x-.75+circuit2(p.y+d*t)),(1.+sin(p.y+d*time*5.))*.3+.3); + l=saturate(l); + l*=abs(r.y*2.); + l*=abs(sin(r.y*200.+sign(p.y)*time*5.))*.5+.5; + l+=pow(.001/abs(p.x+circuit(p.x+d*time)),(1.+sin(p.x+d*time*5.+3.))*.3+.3); + //l+=pow(.001/abs(p.x+circuit(p.x+d*time + 0.3)),(1.+sin(p.x+d*time*5.+3.))*.3+.3); + color = vec3(l) - vec3(.2, .4, 0.); + color *= k; + } + + float angle = atan(p2.y,p2.x)/(2.*3.14159265359); + angle -= floor(angle); + float rad = length(p2); + + float c = 0.1; + float brightness = 0.012; + float speed = 0.8; + + for (int i = 0; i < 1; ++i){ + float angleRnd = floor(angle*14.)+1.; + float angleRnd1 = fract(angleRnd*fract(angleRnd*.7235)*45.1); + float angleRnd2 = fract(angleRnd*fract(angleRnd*.82657)*13.724); + float t = t*speed + angleRnd1*10.; + float radDist = sqrt(angleRnd2+float(i)); + + float adist = radDist/rad*.1; + float dist = (t*.1+adist); + dist = abs(fract(dist)-.5); + c += (1.0 / (dist))*cos(0.7*(sin(t)))*adist/radDist * brightness; + } + angle = fract(angle+.161); + + gl_FragColor = vec4(color + vec3(c) * light_color, 1.0); +} diff --git a/shaders/twisty.frag b/shaders/twisty.frag new file mode 100644 index 0000000..d5a155c --- /dev/null +++ b/shaders/twisty.frag @@ -0,0 +1,18 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; +uniform vec2 mouse; +uniform vec2 resolution; + +void main() +{ + vec2 r = resolution, + o = gl_FragCoord.xy - r/2.; + o = vec2(length(o) / r.y - .2, atan(o.y,o.x)); + vec4 s = .1*cos(1.6*vec4(0,1,2,3) + time + 0.5 + o.y + sin(o.y) * sin(time)*2.), + e = s.yzwx, + f = min(o.x-s,e-o.x); + gl_FragColor = dot(clamp(f*r.y,0.,1.), 40.*(s-e)) * (s-.1) - f; +} diff --git a/shaders/water.frag b/shaders/water.frag new file mode 100644 index 0000000..17ed3cd --- /dev/null +++ b/shaders/water.frag @@ -0,0 +1,208 @@ +#ifdef GL_ES +precision highp float; +#endif + +uniform float time; +uniform vec2 resolution; + +#define CHAR_SIZE vec2(6, 7) +#define CHAR_SPACING vec2(6, 9) + +vec2 start_pos = vec2(0); +vec2 print_pos = vec2(0); +vec2 print_pos_pre_move = vec2(0); +vec3 text_color = vec3(1); + +/* +Top left pixel is the most significant bit. +Bottom right pixel is the least significant bit. + + ███ | +█ █ | +█ █ | +█ █ | +█████ | +█ █ | +█ █ | + +000000 +100010 +100010 +100010 +111110 +100010 +100010 + +011100 (upper 21 bits) +100010 -> 011100 100010 100010 100 -> 935188 +100010 +100 + 010 (lower 21 bits) +111110 -> 010 111110 100010 100010 -> 780450 +100010 +100010 + +vec2(935188.0,780450.0) +*/ + +//Text coloring +#define HEX(i) text_color = mod(vec3(i / 65536,i / 256,i),vec3(256.0))/255.0; +#define RGB(r,g,b) text_color = vec3(r,g,b); + +#define STRWIDTH(c) (c * CHAR_SPACING.x) +#define STRHEIGHT(c) (c * CHAR_SPACING.y) +#define BEGIN_TEXT(x,y) print_pos = floor(vec2(x,y)); start_pos = floor(vec2(x,y)); + +//Automatically generated from the sprite sheet here: http://uzebox.org/wiki/index.php?title=File:Font6x8.png +#define _ col+=char(vec2(0.0,0.0),uv); +#define _spc col+=char(vec2(0.0,0.0),uv)*text_color; +#define _exc col+=char(vec2(276705.0,32776.0),uv)*text_color; +#define _quo col+=char(vec2(1797408.0,0.0),uv)*text_color; +#define _hsh col+=char(vec2(10738.0,1134484.0),uv)*text_color; +#define _dol col+=char(vec2(538883.0,19976.0),uv)*text_color; +#define _pct col+=char(vec2(1664033.0,68006.0),uv)*text_color; +#define _amp col+=char(vec2(545090.0,174362.0),uv)*text_color; +#define _apo col+=char(vec2(798848.0,0.0),uv)*text_color; +#define _lbr col+=char(vec2(270466.0,66568.0),uv)*text_color; +#define _rbr col+=char(vec2(528449.0,33296.0),uv)*text_color; +#define _ast col+=char(vec2(10471.0,1688832.0),uv)*text_color; +#define _crs col+=char(vec2(4167.0,1606144.0),uv)*text_color; +#define _per col+=char(vec2(0.0,1560.0),uv)*text_color; +#define _dsh col+=char(vec2(7.0,1572864.0),uv)*text_color; +#define _com col+=char(vec2(0.0,1544.0),uv)*text_color; +#define _lsl col+=char(vec2(1057.0,67584.0),uv)*text_color; +#define _0 col+=char(vec2(935221.0,731292.0),uv)*text_color; +#define _1 col+=char(vec2(274497.0,33308.0),uv)*text_color; +#define _2 col+=char(vec2(934929.0,1116222.0),uv)*text_color; +#define _3 col+=char(vec2(934931.0,1058972.0),uv)*text_color; +#define _4 col+=char(vec2(137380.0,1302788.0),uv)*text_color; +#define _5 col+=char(vec2(2048263.0,1058972.0),uv)*text_color; +#define _6 col+=char(vec2(401671.0,1190044.0),uv)*text_color; +#define _7 col+=char(vec2(2032673.0,66576.0),uv)*text_color; +#define _8 col+=char(vec2(935187.0,1190044.0),uv)*text_color; +#define _9 col+=char(vec2(935187.0,1581336.0),uv)*text_color; +#define _col col+=char(vec2(195.0,1560.0),uv)*text_color; +#define _scl col+=char(vec2(195.0,1544.0),uv)*text_color; +#define _les col+=char(vec2(135300.0,66052.0),uv)*text_color; +#define _equ col+=char(vec2(496.0,3968.0),uv)*text_color; +#define _grt col+=char(vec2(528416.0,541200.0),uv)*text_color; +#define _que col+=char(vec2(934929.0,1081352.0),uv)*text_color; +#define _ats col+=char(vec2(935285.0,714780.0),uv)*text_color; +#define _A col+=char(vec2(935188.0,780450.0),uv)*text_color; +#define _B col+=char(vec2(1983767.0,1190076.0),uv)*text_color; +#define _C col+=char(vec2(935172.0,133276.0),uv)*text_color; +#define _D col+=char(vec2(1983764.0,665788.0),uv)*text_color; +#define _E col+=char(vec2(2048263.0,1181758.0),uv)*text_color; +#define _F col+=char(vec2(2048263.0,1181728.0),uv)*text_color; +#define _G col+=char(vec2(935173.0,1714334.0),uv)*text_color; +#define _H col+=char(vec2(1131799.0,1714338.0),uv)*text_color; +#define _I col+=char(vec2(921665.0,33308.0),uv)*text_color; +#define _J col+=char(vec2(66576.0,665756.0),uv)*text_color; +#define _K col+=char(vec2(1132870.0,166178.0),uv)*text_color; +#define _L col+=char(vec2(1065220.0,133182.0),uv)*text_color; +#define _M col+=char(vec2(1142100.0,665762.0),uv)*text_color; +#define _N col+=char(vec2(1140052.0,1714338.0),uv)*text_color; +#define _O col+=char(vec2(935188.0,665756.0),uv)*text_color; +#define _P col+=char(vec2(1983767.0,1181728.0),uv)*text_color; +#define _Q col+=char(vec2(935188.0,698650.0),uv)*text_color; +#define _R col+=char(vec2(1983767.0,1198242.0),uv)*text_color; +#define _S col+=char(vec2(935171.0,1058972.0),uv)*text_color; +#define _T col+=char(vec2(2035777.0,33288.0),uv)*text_color; +#define _U col+=char(vec2(1131796.0,665756.0),uv)*text_color; +#define _V col+=char(vec2(1131796.0,664840.0),uv)*text_color; +#define _W col+=char(vec2(1131861.0,699028.0),uv)*text_color; +#define _X col+=char(vec2(1131681.0,84130.0),uv)*text_color; +#define _Y col+=char(vec2(1131794.0,1081864.0),uv)*text_color; +#define _Z col+=char(vec2(1968194.0,133180.0),uv)*text_color; +#define _lsb col+=char(vec2(925826.0,66588.0),uv)*text_color; +#define _rsl col+=char(vec2(16513.0,16512.0),uv)*text_color; +#define _rsb col+=char(vec2(919584.0,1065244.0),uv)*text_color; +#define _pow col+=char(vec2(272656.0,0.0),uv)*text_color; +#define _usc col+=char(vec2(0.0,62.0),uv)*text_color; +#define _a col+=char(vec2(224.0,649374.0),uv)*text_color; +#define _b col+=char(vec2(1065444.0,665788.0),uv)*text_color; +#define _c col+=char(vec2(228.0,657564.0),uv)*text_color; +#define _d col+=char(vec2(66804.0,665758.0),uv)*text_color; +#define _e col+=char(vec2(228.0,772124.0),uv)*text_color; +#define _f col+=char(vec2(401543.0,1115152.0),uv)*text_color; +#define _g col+=char(vec2(244.0,665474.0),uv)*text_color; +#define _h col+=char(vec2(1065444.0,665762.0),uv)*text_color; +#define _i col+=char(vec2(262209.0,33292.0),uv)*text_color; +#define _j col+=char(vec2(131168.0,1066252.0),uv)*text_color; +#define _k col+=char(vec2(1065253.0,199204.0),uv)*text_color; +#define _l col+=char(vec2(266305.0,33292.0),uv)*text_color; +#define _m col+=char(vec2(421.0,698530.0),uv)*text_color; +#define _n col+=char(vec2(452.0,1198372.0),uv)*text_color; +#define _o col+=char(vec2(228.0,665756.0),uv)*text_color; +#define _p col+=char(vec2(484.0,667424.0),uv)*text_color; +#define _q col+=char(vec2(244.0,665474.0),uv)*text_color; +#define _r col+=char(vec2(354.0,590904.0),uv)*text_color; +#define _s col+=char(vec2(228.0,114844.0),uv)*text_color; +#define _t col+=char(vec2(8674.0,66824.0),uv)*text_color; +#define _u col+=char(vec2(292.0,1198868.0),uv)*text_color; +#define _v col+=char(vec2(276.0,664840.0),uv)*text_color; +#define _w col+=char(vec2(276.0,700308.0),uv)*text_color; +#define _x col+=char(vec2(292.0,1149220.0),uv)*text_color; +#define _y col+=char(vec2(292.0,1163824.0),uv)*text_color; +#define _z col+=char(vec2(480.0,1148988.0),uv)*text_color; +#define _lpa col+=char(vec2(401542.0,66572.0),uv)*text_color; +#define _bar col+=char(vec2(266304.0,33288.0),uv)*text_color; +#define _rpa col+=char(vec2(788512.0,1589528.0),uv)*text_color; +#define _tid col+=char(vec2(675840.0,0.0),uv)*text_color; +#define _lar col+=char(vec2(8387.0,1147904.0),uv)*text_color; +#define _nl print_pos = start_pos - vec2(0,CHAR_SPACING.y); + +//Extracts bit b from the given number. +float extract_bit(float n, float b) +{ + b = clamp(b,-1.0,22.0); + return floor(mod(floor(n / pow(2.0,floor(b))),2.0)); +} + +//Returns the pixel at uv in the given bit-packed sprite. +float sprite(vec2 spr, vec2 size, vec2 uv) +{ + uv = floor(uv); + float bit = (size.x-uv.x-1.0) + uv.y * size.x; + bool bounds = all(greaterThanEqual(uv,vec2(0)))&& all(lessThan(uv,size)); + return bounds ? extract_bit(spr.x, bit - 21.0) + extract_bit(spr.y, bit) : 0.0; +} + +//Prints a character and moves the print position forward by 1 character width. +vec3 char(vec2 ch, vec2 uv) +{ + float px = sprite(ch, CHAR_SIZE, uv - print_pos); + print_pos.x += CHAR_SPACING.x; + print_pos.y += sin(4.*print_pos.x-time*10.); + return vec3(px); +} + + +vec3 Text(vec2 uv) +{ + vec3 col = vec3(0.0); + + vec2 center_pos = vec2(resolution.x/2.0 - STRWIDTH(20.0)/2.0,resolution.y/2.0 - STRHEIGHT(1.0)/2.0); + + BEGIN_TEXT(center_pos.x,center_pos.y) + HEX(0x00ffFF) _ _ _w _ _a _ _t _ _ _e _ _r; + BEGIN_TEXT(resolution.x/2.0-STRWIDTH(11.0)/2.0,resolution.y/2.0) + print_pos += vec2(cos(time)*96.,sin(time)*96.); + + // RGB(1,0,0) _M RGB(1,.5,0)_o RGB(1,1,0)_v RGB(0,1,0)_i RGB(0,.5,1)_n RGB(0.5,0,1)_g _ RGB(1,0,0)_T RGB(1,.5,0)_e RGB(1,1,0)_x RGB(0,1,0)_t + + return col; +} + +void main( void ) +{ + vec2 uv = gl_FragCoord.xy; + vec2 duv = floor(gl_FragCoord.xy); + + vec3 pixel = Text(duv); + + vec3 col = pixel*0.9+0.1; + col *= (1.-distance(mod(uv,vec2(1.0)),vec2(0.65)))*1.2; + + gl_FragColor = vec4(vec3(col), 1.0); +} diff --git a/shaders/wave.frag b/shaders/wave.frag new file mode 100644 index 0000000..c6e4606 --- /dev/null +++ b/shaders/wave.frag @@ -0,0 +1,41 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; +uniform vec2 resolution; + +// bonniemathew@gmail.com + +vec3 COLOR1 = vec3(0.0, 0.0, 0.30); +vec3 COLOR2 = vec3(0.50, .0, 0.0); + +float BLOCK_WIDTH = 0.01; + +void main( void ) { + vec2 position = ( gl_FragCoord.xy / resolution.xy ); + vec3 final_color = vec3(1.0); + + // For creating the BG pattern + float c1 = mod(position.x, 2.0 * BLOCK_WIDTH); + c1 = step(BLOCK_WIDTH, c1); + float c2 = mod(position.y, 2.0 * BLOCK_WIDTH); + c2 = step(BLOCK_WIDTH, c2); + + final_color = mix( position.x * COLOR1, position.y * COLOR2, c1 * c2); + + + // creating the wave + position = -1.0 + 2.0 * position; + float lineWidth = 10.0; + vec2 sPos = position ; + for( float i = 0.0; i < 13.; i++) { + sPos.y += (0.07 * sin(position.x + i/5.0+ time*1.)); + + lineWidth = abs(1.0 / (1000.0 * sPos.y)); + final_color = final_color + vec3(lineWidth * 2.9, lineWidth*0., lineWidth * 1.); + + } + + gl_FragColor = vec4(final_color, 1.0); +} diff --git a/shaders/white_hole.frag b/shaders/white_hole.frag new file mode 100644 index 0000000..2c745ba --- /dev/null +++ b/shaders/white_hole.frag @@ -0,0 +1,226 @@ +/* + * Original shader from: https://www.shadertoy.com/view/wss3zB + */ + + +#ifdef GL_ES +precision highp float; +#endif + +// glslsandbox uniforms +uniform float time; +uniform vec2 resolution; + +// shadertoy globals +float iTime = 0.0; +vec3 iResolution = vec3(0.0); + +// --------[ Original ShaderToy begins here ]---------- // +// Spiral Offset II - Del 06/01/2018 +// watch fullscreen, params have been tweaked to overlap and never loop... :) +// keep watching... :) + +#define TAU 6.283185 + +vec2 rot(vec2 v, float angle) +{ + float c = cos(angle); + float s = sin(angle); + return mat2(c, -s, s, c)*v; +} + +// IQ UnevenCapsule distance func +float cro(in vec2 a, in vec2 b ) { return a.x*b.y - a.y*b.x; } +float sdUnevenCapsule( in vec2 p, in vec2 pa, in vec2 pb, in float ra, in float rb ) +{ + p -= pa; + pb -= pa; + float h = dot(pb,pb); + vec2 q = vec2( dot(p,vec2(pb.y,-pb.x)), dot(p,pb) )/h; + + //----------- + + q.x = abs(q.x); + + float b = ra-rb; + vec2 c = vec2(sqrt(h-b*b),b); + + float k = cro(c,q); + float m = dot(c,q); + float n = dot(q,q); + + if( k < 0.0 ) return sqrt(h*(n )) - ra; + else if( k > c.x ) return sqrt(h*(n+1.0-2.0*q.y)) - rb; + return m - ra; +} + +float TimerInOut(vec4 v) +{ + return smoothstep(v.y,v.y+v.w,v.x) - smoothstep(v.z-v.w,v.z,v.x); +} +float Stime(float scale) +{ + return fract(iTime*scale)*TAU; +} +float Mtime(float mval) +{ + return mod(iTime,mval); +} + +// Trippy spiral calc - Del 06/01/2018 +vec2 spiral(vec2 uv,float zoom, float len, float offset,vec2 capoff, float trip, float scount) +{ + float d = length(uv) * zoom; + d=log(d*trip); + uv = rot(uv,sin(d*offset)+d*scount); + float v = 1.0-sdUnevenCapsule(uv,vec2(0.0,0.0)+capoff,vec2(0.4*len,0.0)+capoff,0.0,0.4*len)*14.0; + return vec2(v,d); // dx , dy +} + +vec2 directionalWaveNormal(vec2 p, float amp, vec2 dir, float freq, float speed, float time, float k) +{ + float a = dot(p, dir) * freq + time * speed; + float b = 0.5 * k * freq * amp * pow((sin(a) + 1.0) * 0.5, k) * cos(a); + return vec2(dir.x * b, dir.y * b); +} + +vec3 summedWaveNormal(vec2 p) +{ + float time = iTime; + vec2 sum = vec2(0.0); + sum += directionalWaveNormal(p, 0.5, normalize(vec2(1, 1)), 5.0, 1.5, time, 1.0); + sum += directionalWaveNormal(p, 0.25,normalize(vec2(1.4, 1.0)), 11.0, 2.4, time, 1.5); + sum += directionalWaveNormal(p, 0.125, normalize(vec2(-0.8, -1.0)), 10.0, 2.0, time, 2.0); + sum += directionalWaveNormal(p, 0.0625, normalize(vec2(1.3, 1.0)), 15.0, 4.0, time, 2.2); + sum += directionalWaveNormal(p, 0.03125, normalize(vec2(-1.7, -1.0)), 5.0, 1.8, time, 3.0); + return normalize(vec3(-sum.x, -sum.y, 1.0)); +} +vec3 background(vec2 p) +{ + vec3 normal = summedWaveNormal(p); + vec3 c = mix(vec3(0.1, 0.15, 0.1), vec3(0.2, 0.25, 0.4), dot(normal, normalize(vec3(0.2, 0.2, 0.5))) * 0.5 + 0.5); + c = mix(c, vec3(0.7, 0.9, 1.0), pow(dot(normal, normalize(vec3(-0.4, 0.1, 1.0))) * 0.5 + 0.5, 2.0)); + c = mix(c, vec3(0.95, 0.98, 1.0), pow(dot(normal, normalize(vec3(-0.1, -0.3, 0.5))) * 0.5 + 0.5, 10.0)); + return clamp(c,0.0,1.0); +} + +float Bub(vec2 uv,float scale) +{ + float time = iTime*0.75; + uv.y-=time*2./scale; + //uv.x += time*0.2; + uv.x+=sin(uv.y+time*.95)*0.025; ///scale; + uv*=scale; + vec2 s=floor(uv); + vec2 f=fract(uv); + float k=3.0; + vec2 p =.5+.35*sin(11.*fract(sin((s+scale)*mat2(7.0,3.0,6.0,5.0))*5.))-f; + float d=length(p); + k=min(d,k); + k=smoothstep(0.0,k,sin(f.x+f.y)*0.01); + return k; +} + +vec3 Bubbles(vec2 uv,float head,float d) +{ + float c = Bub(uv,30.)*.3; + c+=Bub(uv,20.)*.5; + c+=Bub(uv,15.)*.8; + c+=Bub(uv,10.); + c+=Bub(uv,8.); + c+=Bub(uv,6.); + c+=Bub(uv,5.); + vec3 scol = vec3(clamp(c*0.3,0.0,0.3)); + return scol; +} + +vec3 checks(vec2 p) +{ + //p*=1.0+(sin(p.y+p.x+Stime(0.25))*0.15); + //float f = mod( floor(5.5*p.x) + floor(5.5*p.y), 2.0); + //vec3 col = 0.05 + 0.1*f+0.2*vec3(0.1,0.1,0.1); + //return col; + + float d = length(p); + float head = 1.0-length(p); + d+=(0.5+sin(iTime*2.0)*0.5)*0.25; + p *= 0.25; + return Bubbles(p*(d+0.5), head,d); +} + +vec3 hsv2rgb_smooth( in vec3 c ) +{ + vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 ); + + rgb = rgb*rgb*(3.0-2.0*rgb); // cubic smoothing + + return c.z * mix( vec3(1.0), rgb, c.y); +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 uv = (fragCoord.xy - 0.5 * iResolution.xy) / iResolution.y; + + // Create some blends over time... + float t1 = TimerInOut(vec4(Mtime(9.6),1.0, 7.2, 1.8)); + float t2 = TimerInOut(vec4(Mtime(12.0),1.0, 9.0, 1.5)); + float t3 = TimerInOut(vec4(Mtime(21.0),6.0, 14.2, 2.8)); + float t4 = TimerInOut(vec4(Mtime(60.0),15.0,45.0,1.0)); + float t5 = TimerInOut(vec4(Mtime(85.0),57.0, 67.0, 3.1)); + float t6 = TimerInOut(vec4(Mtime(123.0),77.0,101.0,10.0)); + float t7 = TimerInOut(vec4(Mtime(50.0),28.0,45.0,3.5)); + float t8 = TimerInOut(vec4(Mtime(20.0),1.0,13.0,3.1)); + float t9 = TimerInOut(vec4(Mtime(200.0),100.0,199.0,0.5)); + float t10 = TimerInOut(vec4(Mtime(45.0),21.0,31.0,0.75)); + + // various spiral modifiers applied over time + float t = Stime(0.4); + float offset = 25.0 * t1; + float zoom = 1.0 + (sin(Stime(0.17))*0.5) * t2; + vec2 capoff = vec2(sin(uv.y*4.0+Stime(0.125))*0.25, sin(uv.x*2.0+Stime(0.25))*0.75) * t3; + float m = 0.48+sin(Stime(0.15)+uv.y+uv.x)*0.5; + float trip = 1.0-(m*t4); + float scmod = sin(Stime(0.176)); + float scount = 5.0+((3.0+(scmod*5.0))*t5); + + // debug... (disable effects) + //scount = 5.0; + //offset=0.0; + //zoom = 1.0; + //trip = 1.0; + //capoff = vec2(0.0); + + vec2 dist = spiral(uv, zoom, t, offset, capoff, trip, scount); + + float distmod = 0.49+sin(dist.x*0.34+dist.y*1.6+sin(Stime(.1)))*0.5; + dist.x = mix(dist.x, dist.x*distmod, t10); + + + float v2 = smoothstep(0.5-0.1,0.5+0.1,dist.x); + float v = mix(v2,clamp(dist.x,0.0,3.0), t6); + //vec3 col = vec3(v*1.0-l/t); + vec3 col1 = checks(uv); ////vec3(0.0,0.0,0.2); + vec3 col2 = vec3(1.0,0.6,0.5); + // rainbow flavour... + col2 = mix(col2,hsv2rgb_smooth(vec3(fract(iTime*0.1)+dist.x*0.1,1.0,v)),t9); + + vec3 col3 = background(uv); //vec3(0.5,0.7,0.5); + col1 = mix(col1,col3*0.3, t7); + col2 = mix(col2,col3, t8); + vec3 col = mix(col1,col2,v*1.0-dist.y/t); + + // vignette + vec2 q = fragCoord/iResolution.xy; + col *= 0.3 + 0.7*pow(16.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.25); + + fragColor = vec4(col, 1.0); +} +// --------[ Original ShaderToy ends here ]---------- // + +void main(void) +{ + iTime = time; + iResolution = vec3(resolution, 0.0); + + mainImage(gl_FragColor, gl_FragCoord.xy); +} diff --git a/shaders/yellow_lines.frag b/shaders/yellow_lines.frag new file mode 100644 index 0000000..eb57e5c --- /dev/null +++ b/shaders/yellow_lines.frag @@ -0,0 +1,47 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform float time; +//uniform vec2 mouse; +uniform vec2 resolution; + +// bonniemathew@gmail.com + +//vec3 COLOR1 = vec3(0.0, 0.0, 0.50); +//vec3 COLOR2 = vec3(0.30, .0, 0.0); + +const vec3 COLOR1 = vec3(0.0, 0.0, 0.0); +vec3 COLOR2 = COLOR1; + +float BLOCK_WIDTH = 0.01; + +void main( void ) { + + + vec2 position = ( gl_FragCoord.xy / resolution.xy ); + vec3 final_color = vec3(1.0); + + // For creating the BG pattern + float c1 = mod(position.x, 2.0 * BLOCK_WIDTH); + c1 = step(position.x*0.01, c1); + float c2 = mod(position.y, 2.0 * BLOCK_WIDTH); + c2 = step(BLOCK_WIDTH, c2); + + final_color = mix( position.x * COLOR1, position.y * COLOR2, c1 * c2); + + + // creating the wave + position = -1.0 + 2.0 * position; + float lineWidth = 10.0; + vec2 sPos = position ; + for( float i = 0.0; i < 13.; i++) { + sPos.y += ((0.07*cos(time)) * tan(position.x + i/5.0+ sin(time*0.5))); + + lineWidth = abs(1.0 / (750.0 * sPos.y)); + final_color = final_color + vec3(lineWidth * 1.9f, lineWidth*1.9f, lineWidth * 0.); + + } + + gl_FragColor = vec4(final_color, 1.0); +}