Back home 🏡 WGSL Spec Bevy WGSL Functions

mesh2d_functions.wgsl

Import path

Functions

get_world_from_local

#
fn get_world_from_local(instance_index: u32) -> mat4x4<f32>
Parameter Type
instance_index u32
Returns: mat4x4<f32>

mesh2d_position_local_to_world

#
fn mesh2d_position_local_to_world(world_from_local: mat4x4<f32>, vertex_position: vec4<f32>) -> vec4<f32>
Parameter Type
world_from_local mat4x4<f32>
vertex_position vec4<f32>
Returns: vec4<f32>

mesh2d_position_world_to_clip

#
fn mesh2d_position_world_to_clip(world_position: vec4<f32>) -> vec4<f32>
Parameter Type
world_position vec4<f32>
Returns: vec4<f32>

mesh2d_position_local_to_clip

#
NOTE: The intermediate world_position assignment is important for precision purposes when using the 'equals' depth comparison function.
fn mesh2d_position_local_to_clip(world_from_local: mat4x4<f32>, vertex_position: vec4<f32>) -> vec4<f32>
Parameter Type
world_from_local mat4x4<f32>
vertex_position vec4<f32>
Returns: vec4<f32>

mesh2d_normal_local_to_world

#
fn mesh2d_normal_local_to_world(vertex_normal: vec3<f32>, instance_index: u32) -> vec3<f32>
Parameter Type
vertex_normal vec3<f32>
instance_index u32
Returns: vec3<f32>

mesh2d_tangent_local_to_world

#
fn mesh2d_tangent_local_to_world(world_from_local: mat4x4<f32>, vertex_tangent: vec4<f32>) -> vec4<f32>
Parameter Type
world_from_local mat4x4<f32>
vertex_tangent vec4<f32>
Returns: vec4<f32>