truck-platform

Crates.iotruck-platform
lib.rstruck-platform
version0.5.0
sourcesrc
created_at2020-12-28 07:36:42.489182
updated_at2022-12-21 08:44:44.61915
descriptiongraphic utility library based on wgpu
homepagehttps://github.com/ricosjp/truck
repositoryhttps://github.com/ricosjp/truck
max_upload_size
id328152
size169,980
crates-owners (github:ricosjp:crates-owners)

documentation

README

truck-platform

Crates.io Docs.rs

Graphic utility library based on wgpu.

Sample Codes

wgsl-sandbox

A sample of creating a render object by implementing "Rendered" in a new structure.

One can use xyr WGSL shader in the following way:

  • Enter the shader path as an argument when executing the program.
  • Drag and drop the shader into the window.

The rule of shaders:

  • One can draw a image by implementing the function:
vec4<f32> main_image(coord: vec2<f32>, env: Environment);
  • The parameter coord is the fragment coordinate. The origin is the lower left.
  • The parameter env has the environment information. The declaration of struct is the following:
struct Environment {
    resolution: vec2<f32>;  // the resolution of the image
    mouse: vec4<f32>;       // the mouse information behaving the same as `iMouse` in Shadertoy.
    time: f32;              // the number of seconds since the application started.
};

Also, see the sample newton-cuberoot.wgsl, default shader, in examples.

Commit count: 1812

cargo fmt