pub struct WGSLSnippets;Expand description
Collection of reusable WGSL code snippets for common algorithms.
Implementations§
Source§impl WGSLSnippets
impl WGSLSnippets
Sourcepub fn linear_map(
val: &str,
in_lo: f32,
in_hi: f32,
out_lo: f32,
out_hi: f32,
) -> String
pub fn linear_map( val: &str, in_lo: f32, in_hi: f32, out_lo: f32, out_hi: f32, ) -> String
Emit a linear map from [in_lo, in_hi] to [out_lo, out_hi].
Sourcepub fn linear_to_srgb(c: &str) -> String
pub fn linear_to_srgb(c: &str) -> String
Emit an sRGB gamma correction (linear -> sRGB).
Sourcepub fn srgb_to_linear(c: &str) -> String
pub fn srgb_to_linear(c: &str) -> String
Emit an sRGB -> linear conversion.
Sourcepub fn blinn_phong(normal: &str, halfway: &str, shininess: &str) -> String
pub fn blinn_phong(normal: &str, halfway: &str, shininess: &str) -> String
Emit a Blinn-Phong specular term.
Sourcepub fn rgb_to_hsv_fn() -> String
pub fn rgb_to_hsv_fn() -> String
Emit an RGB-to-HSV conversion expression for a vec3f.
Sourcepub fn hsv_to_rgb_fn() -> String
pub fn hsv_to_rgb_fn() -> String
Emit an HSV-to-RGB conversion function.
Sourcepub fn gaussian_weight(i: i32, sigma: f32) -> f32
pub fn gaussian_weight(i: i32, sigma: f32) -> f32
Emit a Gaussian blur weight at offset i with standard deviation sigma.
Auto Trait Implementations§
impl Freeze for WGSLSnippets
impl RefUnwindSafe for WGSLSnippets
impl Send for WGSLSnippets
impl Sync for WGSLSnippets
impl Unpin for WGSLSnippets
impl UnsafeUnpin for WGSLSnippets
impl UnwindSafe for WGSLSnippets
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more