diff options
| author | LLLL Colonq <llll@colonq> | 2025-09-16 01:36:57 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-09-16 01:36:57 -0400 |
| commit | 4ae21efc81f39ca805cefe5c1af722857f22f255 (patch) | |
| tree | d877c34b806c61e9480f1c209fd104fffee43988 | |
| parent | 4db7ffbaafda249ecafa720e52479d5c7b132edb (diff) | |
Add poster maker
| -rw-r--r-- | Cargo.lock | 439 | ||||
| -rw-r--r-- | crates/client/src/client.rs | 2 | ||||
| -rw-r--r-- | crates/renderer/Cargo.toml | 3 | ||||
| -rw-r--r-- | crates/renderer/src/assets/fonts/HennyPenny-Regular.ttf | bin | 0 -> 80564 bytes | |||
| -rw-r--r-- | crates/renderer/src/assets/fonts/OFL.txt | 94 | ||||
| -rw-r--r-- | crates/renderer/src/assets/shaders/automata/frag.glsl | 1 | ||||
| -rw-r--r-- | crates/renderer/src/assets/shaders/irish/frag.glsl | 8 | ||||
| -rw-r--r-- | crates/renderer/src/assets/shaders/irish/vert.glsl | 4 | ||||
| -rw-r--r-- | crates/renderer/src/main.rs | 1 | ||||
| -rw-r--r-- | crates/renderer/src/overlay.rs | 4 | ||||
| -rw-r--r-- | crates/renderer/src/overlay/irish.rs | 113 | ||||
| -rw-r--r-- | crates/renderer/src/overlay/model.rs | 4 | ||||
| -rw-r--r-- | crates/renderer/src/overlay/shader.rs | 2 | ||||
| -rw-r--r-- | crates/renderer/src/terminal.rs | 4 |
14 files changed, 671 insertions, 8 deletions
@@ -62,6 +62,15 @@ dependencies = [ ] [[package]] +name = "aligned-vec" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b" +dependencies = [ + "equator", +] + +[[package]] name = "allocator-api2" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -167,6 +176,12 @@ dependencies = [ ] [[package]] +name = "anyhow" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" + +[[package]] name = "approx" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -176,6 +191,23 @@ dependencies = [ ] [[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" + +[[package]] +name = "arg_enum_proc_macro" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "arrayref" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -206,6 +238,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] +name = "av1-grain" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f3efb2ca85bc610acfa917b5aaa36f3fcbebed5b3182d7f877b02531c4b80c8" +dependencies = [ + "anyhow", + "arrayvec", + "log", + "nom", + "num-rational", + "v_frame", +] + +[[package]] +name = "avif-serialize" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47c8fbc0f831f4519fe8b810b6a7a91410ec83031b8233f730a0480029f6a23f" +dependencies = [ + "arrayvec", +] + +[[package]] name = "backtrace" version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -267,7 +322,7 @@ dependencies = [ "bitflags 2.8.0", "cexpr", "clang-sys", - "itertools", + "itertools 0.13.0", "proc-macro2", "quote", "regex", @@ -283,6 +338,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2c54ff287cfc0a34f38a6b832ea1bd8e448a330b3e40a50859e6488bee07f22" [[package]] +name = "bit_field" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" + +[[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -295,6 +356,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" [[package]] +name = "bitstream-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2" + +[[package]] name = "block-sys" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -314,6 +381,12 @@ dependencies = [ ] [[package]] +name = "built" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ed6191a7e78c36abdb16ab65341eefd73d64d303fffccdbb00d51e4205967b" + +[[package]] name = "bumpalo" version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -396,6 +469,16 @@ dependencies = [ ] [[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -459,6 +542,12 @@ dependencies = [ ] [[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] name = "colorchoice" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -652,6 +741,12 @@ 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.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -800,6 +895,26 @@ dependencies = [ ] [[package]] +name = "equator" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" +dependencies = [ + "equator-macro", +] + +[[package]] +name = "equator-macro" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -816,6 +931,21 @@ dependencies = [ ] [[package]] +name = "exr" +version = "1.73.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83197f59927b46c04a183a619b7c29df34e63e63c7869320862268c0ef687e0" +dependencies = [ + "bit_field", + "half", + "lebe", + "miniz_oxide 0.8.4", + "rayon-core", + "smallvec", + "zune-inflate", +] + +[[package]] name = "extended" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1004,6 +1134,16 @@ dependencies = [ ] [[package]] +name = "gif" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae047235e33e2829703574b54fdec96bfbad892062d97fed2f76022287de61b" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1104,6 +1244,16 @@ dependencies = [ ] [[package]] +name = "half" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] name = "hash32" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1421,13 +1571,38 @@ checksum = "cd6f44aed642f18953a158afeb30206f4d50da59fbc66ecb53c66488de73563b" dependencies = [ "bytemuck", "byteorder-lite", + "color_quant", + "exr", + "gif", + "image-webp", "num-traits", "png", + "qoi", + "ravif", + "rayon", + "rgb", + "tiff", "zune-core", "zune-jpeg", ] [[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error", +] + +[[package]] +name = "imgref" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" + +[[package]] name = "indenter" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1450,6 +1625,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" [[package]] +name = "interpolate_name" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "ipnet" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1463,6 +1649,15 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" @@ -1508,6 +1703,12 @@ dependencies = [ ] [[package]] +name = "jpeg-decoder" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00810f1d8b74be64b13dbf3db89ac67740615d6c891f0e7b6179326533011a07" + +[[package]] name = "js-sys" version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1540,6 +1741,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] +name = "lebe" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" + +[[package]] name = "lexpr" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1567,6 +1774,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] +name = "libfuzzer-sys" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5037190e1f70cbeef565bd267599242926f724d3b8a9f510fd7e0b540cfa4404" +dependencies = [ + "arbitrary", + "cc", +] + +[[package]] name = "libloading" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1612,6 +1829,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] +name = "loop9" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" +dependencies = [ + "imgref", +] + +[[package]] name = "mach2" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1641,6 +1867,16 @@ dependencies = [ ] [[package]] +name = "maybe-rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" +dependencies = [ + "cfg-if", + "rayon", +] + +[[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1779,6 +2015,12 @@ dependencies = [ ] [[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] name = "newton_client" version = "0.1.0" dependencies = [ @@ -1812,6 +2054,7 @@ dependencies = [ "env_logger", "glam", "glow", + "image", "lazy_static", "lexpr", "log", @@ -1854,6 +2097,12 @@ dependencies = [ ] [[package]] +name = "noop_proc_macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" + +[[package]] name = "num-bigint" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2230,6 +2479,21 @@ dependencies = [ ] [[package]] +name = "qoi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] name = "quick-xml" version = "0.37.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2302,6 +2566,56 @@ dependencies = [ ] [[package]] +name = "rav1e" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9" +dependencies = [ + "arbitrary", + "arg_enum_proc_macro", + "arrayvec", + "av1-grain", + "bitstream-io", + "built", + "cfg-if", + "interpolate_name", + "itertools 0.12.1", + "libc", + "libfuzzer-sys", + "log", + "maybe-rayon", + "new_debug_unreachable", + "noop_proc_macro", + "num-derive", + "num-traits", + "once_cell", + "paste", + "profiling", + "rand", + "rand_chacha", + "simd_helpers", + "system-deps", + "thiserror 1.0.69", + "v_frame", + "wasm-bindgen", +] + +[[package]] +name = "ravif" +version = "0.11.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5825c26fddd16ab9f515930d49028a630efec172e903483c94796cfe31893e6b" +dependencies = [ + "avif-serialize", + "imgref", + "loop9", + "quick-error", + "rav1e", + "rayon", + "rgb", +] + +[[package]] name = "raw-window-handle" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2314,6 +2628,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] name = "readkey" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2434,6 +2768,12 @@ dependencies = [ ] [[package]] +name = "rgb" +version = "0.8.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c6a884d2998352bb4daf0183589aec883f16a6da1f4dde84d8e2e9a5409a1ce" + +[[package]] name = "ring" version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2663,6 +3003,15 @@ dependencies = [ ] [[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] name = "serde_urlencoded" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2709,6 +3058,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] +name = "simd_helpers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" +dependencies = [ + "quote", +] + +[[package]] name = "slab" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2982,6 +3340,25 @@ dependencies = [ ] [[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] name = "teleia" version = "0.1.0" dependencies = [ @@ -3100,6 +3477,17 @@ dependencies = [ ] [[package]] +name = "tiff" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" +dependencies = [ + "flate2", + "jpeg-decoder", + "weezl", +] + +[[package]] name = "tiny-skia" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3192,10 +3580,25 @@ dependencies = [ ] [[package]] +name = "toml" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -3204,6 +3607,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -3381,12 +3786,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] +name = "v_frame" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2" +dependencies = [ + "aligned-vec", + "num-traits", + "wasm-bindgen", +] + +[[package]] name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + +[[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3633,6 +4055,12 @@ dependencies = [ ] [[package]] +name = "weezl" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a751b3277700db47d3e574514de2eced5e54dc8a5436a3bf7a0b248b2cee16f3" + +[[package]] name = "wide" version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4202,6 +4630,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" [[package]] +name = "zune-inflate" +version = "0.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" +dependencies = [ + "simd-adler32", +] + +[[package]] name = "zune-jpeg" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index 713d022..55c3e07 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -31,7 +31,7 @@ impl teleia::state::Game for Game { fn render(&mut self, ctx: &context::Context, st: &mut state::State) -> Erm<()> { ctx.clear(); self.assets.font.render_text( - ctx, + ctx, st, &glam::Vec2::new(0.0, 0.0), "hello computer", ); diff --git a/crates/renderer/Cargo.toml b/crates/renderer/Cargo.toml index ae24dd4..e66e198 100644 --- a/crates/renderer/Cargo.toml +++ b/crates/renderer/Cargo.toml @@ -25,4 +25,5 @@ base64 = "0.22.1" # base64 encoding/decoding polling = "*" # polling sockets termion = "*" # terminal escapes device_query = "*" # get pressed keys when unfocused -byteorder = "*" # read little-endian numbers
\ No newline at end of file +byteorder = "*" # read little-endian numbers +image = "*" # read and write image files
\ No newline at end of file diff --git a/crates/renderer/src/assets/fonts/HennyPenny-Regular.ttf b/crates/renderer/src/assets/fonts/HennyPenny-Regular.ttf Binary files differnew file mode 100644 index 0000000..ad308b7 --- /dev/null +++ b/crates/renderer/src/assets/fonts/HennyPenny-Regular.ttf diff --git a/crates/renderer/src/assets/fonts/OFL.txt b/crates/renderer/src/assets/fonts/OFL.txt new file mode 100644 index 0000000..0011741 --- /dev/null +++ b/crates/renderer/src/assets/fonts/OFL.txt @@ -0,0 +1,94 @@ +Copyright (c) 2011, BrownFox (gayaneh.b@gmail.com|www.brownfox.org),
+with Reserved Font Names "Henny Penny"
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+https://openfontlicense.org
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/crates/renderer/src/assets/shaders/automata/frag.glsl b/crates/renderer/src/assets/shaders/automata/frag.glsl index 29f5c71..05ee47d 100644 --- a/crates/renderer/src/assets/shaders/automata/frag.glsl +++ b/crates/renderer/src/assets/shaders/automata/frag.glsl @@ -5,5 +5,6 @@ void main() { vec2 tcfull = vec2(vertex_texcoord.x, 1.0 - vertex_texcoord.y); vec4 texel = texture(texture_data, tcfull); + texel.a /= 1.15; frag_color = texel; } diff --git a/crates/renderer/src/assets/shaders/irish/frag.glsl b/crates/renderer/src/assets/shaders/irish/frag.glsl new file mode 100644 index 0000000..8fba8bf --- /dev/null +++ b/crates/renderer/src/assets/shaders/irish/frag.glsl @@ -0,0 +1,8 @@ +uniform sampler2D texture_data; + +void main() +{ + vec2 tcfull = vec2(vertex_texcoord.x, vertex_texcoord.y); + vec4 texel = texture(texture_data, tcfull); + frag_color = texel; +} diff --git a/crates/renderer/src/assets/shaders/irish/vert.glsl b/crates/renderer/src/assets/shaders/irish/vert.glsl new file mode 100644 index 0000000..e324f7e --- /dev/null +++ b/crates/renderer/src/assets/shaders/irish/vert.glsl @@ -0,0 +1,4 @@ +void main() +{ + default_main(); +}
\ No newline at end of file diff --git a/crates/renderer/src/main.rs b/crates/renderer/src/main.rs index 854eae2..1e16092 100644 --- a/crates/renderer/src/main.rs +++ b/crates/renderer/src/main.rs @@ -30,6 +30,7 @@ pub fn main() -> Erm<()> { Box::new(overlay::automata::Overlay::new(ctx)), Box::new(overlay::shader::Overlay::new(ctx)), Box::new(overlay::drawing::Overlay::new(ctx)), + Box::new(overlay::irish::Overlay::new(ctx)), // Box::new(overlay::model::Overlay::new(ctx)), ]) })?; diff --git a/crates/renderer/src/overlay.rs b/crates/renderer/src/overlay.rs index accf3bb..9d1f722 100644 --- a/crates/renderer/src/overlay.rs +++ b/crates/renderer/src/overlay.rs @@ -2,6 +2,7 @@ pub mod model; pub mod shader; pub mod drawing; pub mod automata; +pub mod irish; use teleia::*; @@ -71,6 +72,9 @@ impl State { sexp!((avatar overlay cursor)), sexp!((avatar overlay emacs)), sexp!((avatar automata spawn)), + sexp!((overlay irish start)), + sexp!((overlay irish update)), + sexp!((overlay irish save)), ]), fig_binary: fig::BinaryClient::new("shiro:32051", false, &[ b"background frame" diff --git a/crates/renderer/src/overlay/irish.rs b/crates/renderer/src/overlay/irish.rs new file mode 100644 index 0000000..6cf3d52 --- /dev/null +++ b/crates/renderer/src/overlay/irish.rs @@ -0,0 +1,113 @@ +use teleia::*; + +use lexpr::sexp; +use base64::prelude::*; + +use crate::{fig, overlay, toggle}; + +pub const WIDTH: f32 = 500.0; +pub const HEIGHT: f32 = 700.0; + +pub struct Quote { + text: String, + start_time: u64, +} + +pub struct Overlay { + fb: framebuffer::Framebuffer, + shader: shader::Shader, + font: font::TrueType, + quote: Option<Quote>, +} + +impl Overlay { + pub fn new(ctx: &context::Context) -> Self { + Self { + fb: framebuffer::Framebuffer::new(ctx, &glam::Vec2::new(WIDTH, HEIGHT), &glam::Vec2::new(0.0, 0.0)), + shader: shader::Shader::new(ctx, include_str!("../assets/shaders/irish/vert.glsl"), include_str!("../assets/shaders/irish/frag.glsl")), + font: font::TrueType::new(ctx, 40.0, include_bytes!("../assets/fonts/HennyPenny-Regular.ttf")), + quote: None, + } + } + pub fn handle_start( + &mut self, + ctx: &context::Context, st: &state::State, + msg: fig::SexpMessage + ) -> Option<()> { + let bq = BASE64_STANDARD.decode(msg.data.get(0)?.as_str()?).ok()?; + let quote = String::from_utf8_lossy(&bq); + self.quote = Some(Quote { text: quote.to_string(), start_time: st.tick }); + Some(()) + } + pub fn handle_update( + &mut self, + ctx: &context::Context, st: &state::State, + msg: fig::SexpMessage + ) -> Option<()> { + let bq = BASE64_STANDARD.decode(msg.data.get(0)?.as_str()?).ok()?; + let quote = String::from_utf8_lossy(&bq); + if let Some(q) = &mut self.quote { + q.text = quote.to_string(); + } + Some(()) + } + pub fn handle_save( + &mut self, + ctx: &context::Context, st: &state::State, + msg: fig::SexpMessage + ) -> Option<()> { + let bq = BASE64_STANDARD.decode(msg.data.get(0)?.as_str()?).ok()?; + let path = String::from_utf8_lossy(&bq); + let mut buf = vec![0; (WIDTH * HEIGHT * 4.0) as usize]; + self.fb.get_pixels_raw(ctx, &mut buf); + let img = image::RgbaImage::from_raw(WIDTH as u32, HEIGHT as u32, buf)?; + img.save_with_format(path.to_string(), image::ImageFormat::Png).ok()?; + Some(()) + } +} + +impl overlay::Overlay for Overlay { + fn reset(&mut self, ctx: &context::Context, st: &mut state::State, ost: &mut overlay::State) -> Erm<()> { + self.quote = None; + Ok(()) + } + fn handle(&mut self, ctx: &context::Context, st: &mut state::State, ost: &mut overlay::State, msg: fig::SexpMessage) -> Erm<()> { + let malformed = format!("malformed {} data: {}", msg.event, msg.data); + if msg.event == sexp!((overlay irish start)) { + if self.handle_start(ctx, st, msg).is_none() { log::warn!("{}", malformed) } + } else if msg.event == sexp!((overlay irish update)) { + if self.handle_update(ctx, st, msg).is_none() { log::warn!("{}", malformed) } + } else if msg.event == sexp!((overlay irish save)) { + if self.handle_save(ctx, st, msg).is_none() { log::warn!("{}", malformed) } + } + Ok(()) + } + fn render(&mut self, ctx: &context::Context, st: &mut state::State, ost: &mut overlay::State) -> Erm<()> { + if let Some(q) = &self.quote { + st.bind_framebuffer(ctx, &self.fb); + ctx.clear(); + st.bind_2d(ctx, &ost.assets.shader_flat); + ost.backgrounds.drawing.bind(ctx); + ost.assets.shader_flat.set_f32(ctx, "transparency", 0.0); + ost.assets.shader_flat.set_mat4(ctx, "view", &glam::Mat4::IDENTITY); + ost.assets.shader_flat.set_mat4(ctx, "position", &glam::Mat4::IDENTITY); + st.mesh_square.render(ctx); + self.font.render_text_helper(ctx, st, + &glam::Vec2::new(0.0, 0.0), + &glam::Vec2::new(21.0, 40.0), + &q.text, + &[] + ); + st.bind_render_framebuffer(ctx); + st.bind_2d(ctx, &self.shader); + self.fb.bind_texture(ctx); + self.shader.set_position_2d( + ctx, + &glam::Vec2::new(1000.0, 200.0), + &glam::Vec2::new(WIDTH, HEIGHT) + ); + st.mesh_square.render(ctx); + } + Ok(()) + } +} diff --git a/crates/renderer/src/overlay/model.rs b/crates/renderer/src/overlay/model.rs index 98b008e..26c06bf 100644 --- a/crates/renderer/src/overlay/model.rs +++ b/crates/renderer/src/overlay/model.rs @@ -52,7 +52,7 @@ impl teleia::state::Game for Terminal { self.terminal.update(ctx, &self.model_fb); ctx.clear_color(glam::Vec4::new(0.0, 0.0, 0.0, 0.0)); ctx.clear(); - self.terminal.render(ctx, &glam::Vec2::new(12.0, 250.0)); + self.terminal.render(ctx, st, &glam::Vec2::new(12.0, 250.0)); Ok(()) } } @@ -119,7 +119,7 @@ impl overlay::Overlay for Overlay { self.terminal.update(ctx, &self.model_fb); ctx.clear_color(glam::Vec4::new(0.0, 0.0, 0.0, 0.0)); ctx.clear(); - self.terminal.render(ctx, &glam::Vec2::new(12.0, 250.0)); + self.terminal.render(ctx, st, &glam::Vec2::new(12.0, 250.0)); st.projection = old_projection; Ok(()) } diff --git a/crates/renderer/src/overlay/shader.rs b/crates/renderer/src/overlay/shader.rs index 11133bf..dd35031 100644 --- a/crates/renderer/src/overlay/shader.rs +++ b/crates/renderer/src/overlay/shader.rs @@ -93,7 +93,7 @@ impl overlay::Overlay for Overlay { authors.push(format!("music by {}", a)); } let astr: String = authors.join(", "); - ost.assets.font.render_text(ctx, &glam::Vec2::new(0.0, 0.0), &astr); + ost.assets.font.render_text(ctx, st, &glam::Vec2::new(0.0, 0.0), &astr); Ok(()) } } diff --git a/crates/renderer/src/terminal.rs b/crates/renderer/src/terminal.rs index 325c108..cca2de6 100644 --- a/crates/renderer/src/terminal.rs +++ b/crates/renderer/src/terminal.rs @@ -194,7 +194,7 @@ impl Terminal { } return (CharPair { first: ' ', second: Some(' ') }, glam::Vec3::new(0.0, 0.0, 0.0)); } - pub fn render(&self, ctx: &context::Context, pos: &glam::Vec2) { + pub fn render(&self, ctx: &context::Context, st: &state::State, pos: &glam::Vec2) { let mut s = String::new(); let mut colors = Vec::new(); for row in 0..self.height { @@ -207,7 +207,7 @@ impl Terminal { s += "\n"; colors.push(glam::Vec3::new(1.0, 1.0, 1.0)); } - self.font.render_text_helper(ctx, pos, &s, &colors); + self.font.render_text_helper(ctx, st, pos, &s, &colors); } pub fn write_tty<W>(&self, out: &mut W) where W: Write { |
