pub struct WGSLPrimitiveHelper;Expand description
Helpers for constructing common WGSL primitive expressions and patterns.
Implementations§
Source§impl WGSLPrimitiveHelper
impl WGSLPrimitiveHelper
Sourcepub fn vec3f(x: f32, y: f32, z: f32) -> String
pub fn vec3f(x: f32, y: f32, z: f32) -> String
Generate a vec3f(x, y, z) constructor expression.
Sourcepub fn vec4f(x: f32, y: f32, z: f32, w: f32) -> String
pub fn vec4f(x: f32, y: f32, z: f32, w: f32) -> String
Generate a vec4f(x, y, z, w) constructor expression.
Sourcepub fn vec3u(x: u32, y: u32, z: u32) -> String
pub fn vec3u(x: u32, y: u32, z: u32) -> String
Generate a vec3u(x, y, z) constructor expression.
Sourcepub fn mat4x4_identity() -> String
pub fn mat4x4_identity() -> String
Generate a mat4x4<f32> identity matrix constructor.
Sourcepub fn perspective_matrix(
fov_y_rad: f32,
aspect: f32,
near: f32,
far: f32,
) -> String
pub fn perspective_matrix( fov_y_rad: f32, aspect: f32, near: f32, far: f32, ) -> String
Generate a mat4x4f perspective projection matrix.
Sourcepub fn ortho_matrix(
left: f32,
right: f32,
bottom: f32,
top: f32,
near: f32,
far: f32,
) -> String
pub fn ortho_matrix( left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32, ) -> String
Generate an orthographic projection matrix.
Sourcepub fn swizzle(base: &str, components: &str) -> String
pub fn swizzle(base: &str, components: &str) -> String
Generate a swizzle expression (e.g., v.xyz).
Sourcepub fn select(false_val: &str, true_val: &str, cond: &str) -> String
pub fn select(false_val: &str, true_val: &str, cond: &str) -> String
Generate a ternary select expression: select(false_val, true_val, cond).
Sourcepub fn atomic_add(ptr: &str, val: &str) -> String
pub fn atomic_add(ptr: &str, val: &str) -> String
Generate an atomicAdd expression.
Auto Trait Implementations§
impl Freeze for WGSLPrimitiveHelper
impl RefUnwindSafe for WGSLPrimitiveHelper
impl Send for WGSLPrimitiveHelper
impl Sync for WGSLPrimitiveHelper
impl Unpin for WGSLPrimitiveHelper
impl UnsafeUnpin for WGSLPrimitiveHelper
impl UnwindSafe for WGSLPrimitiveHelper
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