#shadertoy #graphics #shaders #2d-graphics

app shadertoy-rs

用Rust编写的Shadertoy桌面客户端

14个版本

使用旧的Rust 2015

0.7.0 2023年11月10日
0.6.2 2022年7月11日
0.6.0 2022年2月21日
0.4.4 2018年5月10日
0.4.1 2017年7月20日

#61 in 渲染

每月30次下载

MIT许可证

3MB
718 代码行

Build Status Crates.io Version

桌面Shadertoy客户端,用Rust编写。

虽然它仍在开发中,但您可以通过运行一些示例着色器来查看它是否正常工作

cargo run --release -- --example seascape
cargo run --release -- --example elemental-ring

请确保以发布模式构建/运行;在调试模式下,纹理加载需要几秒钟。您还可以从crates.io下载。

只要您限制自己使用支持的统一变量,从Shadertoy直接复制粘贴的着色器应该可以在不修改的情况下运行(如果它们不能运行,请随时提交问题或发起pull请求)。以下是目前支持的统一变量,更多即将到来

  • iGlobalTime
  • iTime(与iGlobalTime相同;Shadertoy最终将弃用iGlobalTime
  • iResolution
  • iMouse
  • iFrame
  • iChannel0iChannel1iChannel2iChannel3
    • 这些都是2D RGBA纹理

如果您在启动应用程序后编辑了它,可以按F5重新加载着色器。

如果您有URL或着色器ID,还可以直接从Shadertoy下载(和可选运行)着色器。例如,要下载经典的Seascape着色器,可以运行

shadertoy get https://www.shadertoy.com/view/Ms2SD1

或者只需

shadertoy get Ms2SD1

添加-r/--run标志以自动运行下载的着色器

目前,CLI看起来像这样

shadertoy 0.7.0
Federico Menozzi <federicogmenozzi@gmail.com>
Desktop client for Shadertoy

USAGE:
    shadertoy [FLAGS] [OPTIONS] [shader] [SUBCOMMAND]

FLAGS:
        --force_srgb_off    Forces SRGB to be off (replicates shadertoy.com color blending)
    -h, --help              Prints help information
    -V, --version           Prints version information

OPTIONS:
    -e, --example <example>      Run example shader from examples/ directory
    -H, --height <height>        Sets window height [default: 400]
        --texture0 <texture0>    Path to 2D RGBA texture for iChannel0
        --texture1 <texture1>    Path to 2D RGBA texture for iChannel1
        --texture2 <texture2>    Path to 2D RGBA texture for iChannel2
        --texture3 <texture3>    Path to 2D RGBA texture for iChannel3
    -W, --width <width>          Sets window width [default: 600]
    -t, --title <title>          Sets the window title
        --wrap0 <wrap0>          Wrap mode for iChannel0 [default: repeat]
                                 [possible values: clamp, repeat, mirror, border]
        --wrap1 <wrap1>          Wrap mode for iChannel1 [default: repeat]
                                 [possible values: clamp, repeat, mirror, border]
        --wrap2 <wrap2>          Wrap mode for iChannel2 [default: repeat]
                                 [possible values: clamp, repeat, mirror, border]
        --wrap3 <wrap3>          Wrap mode for iChannel3 [default: repeat]
                                 [possible values: clamp, repeat, mirror, border]
        --filter0 <filter0>      Filtering for iChannel0 [default: mipmap]
                                 [possible values: scale, mipmap, bilinear, trilinear, anisotropic]
        --filter1 <filter1>      Filtering for iChannel1 [default: mipmap]
                                 [possible values: scale, mipmap, bilinear, trilinear, anisotropic]
        --filter2 <filter2>      Filtering for iChannel2 [default: mipmap]
                                 [possible values: scale, mipmap, bilinear, trilinear, anisotropic]
        --filter3 <filter3>      Filtering for iChannel3 [default: mipmap]
                                 [possible values: scale, mipmap, bilinear, trilinear, anisotropic]
        --anisotropic_max <max>  Max steepness for anisotropic filtering (1-16) [default: 1]


ARGS:
    <shader>    Path to fragment shader

SUBCOMMANDS:
    get     Download shaders from shadertoy.com
    help    Prints this message or the help of the given subcommand(s)

依赖项

~26–38MB
~690K SLoC