Crate shady

Source
Expand description

A shadertoy like library to be able to easily integrate shadertoy-like stuff in your applications. It provides functions to setup the following uniform buffers (which will be also called Resources within this doc):

  • iAudio: Contains frequency bars of an audio source.
  • iFrame: Contains the current frame count.
  • iMouse: Contains the coordinate points of the user’s mouse.
  • iResolution: Contains the height and width of the surface which will be drawed on.
  • iTime: The playback time of the shader.

Note:

  • You should be familiar with wgpu code in order to be able to use this.
  • shady is not compatible with shadertoy’s shaders so you can’t simply copy+paste the fragment code from shadertoy to application which are using shady (but porting them should be very easy in general).

§Feature flags

Each resource is behind a feature gate so if you don’t want to use some of them, just disable their feature gate.

§Example

An “mini” example can be seen here: https://github.com/TornaxO7/shady/blob/main/shady-lib/examples/mini-simple.rs I tried to make it as small as possible.

Just search after the string SHADY within the file and you’ll see what you can/need to do to include it into your renderer.

Re-exports§

pub use shady_audio;

Structs§

Shady
The main struct of this crate.
ShadyDescriptor
Describes Shady for Shady::new
ShadyRenderPipeline
A wrapper around wgpu::RenderPipeline.

Enums§

MouseState
Represents the state of the mouse.
TemplateLang
The shader languages where the templates can be generated for.

Constants§

FRAGMENT_ENTRYPOINT
The name of the entrypoint function of the fragment shader for shady.

Functions§

create_render_pipeline
Creates a pre-configured pipeline which can then be used in Shady::add_render_pass.