mirror of
https://github.com/bevyengine/bevy
synced 2025-01-09 11:48:56 +00:00
22 lines
440 B
WebGPU Shading Language
22 lines
440 B
WebGPU Shading Language
|
#define_import_path bevy_render::maths
|
||
|
|
||
|
fn affine_to_square(affine: mat3x4<f32>) -> mat4x4<f32> {
|
||
|
return transpose(mat4x4<f32>(
|
||
|
affine[0],
|
||
|
affine[1],
|
||
|
affine[2],
|
||
|
vec4<f32>(0.0, 0.0, 0.0, 1.0),
|
||
|
));
|
||
|
}
|
||
|
|
||
|
fn mat2x4_f32_to_mat3x3_unpack(
|
||
|
a: mat2x4<f32>,
|
||
|
b: f32,
|
||
|
) -> mat3x3<f32> {
|
||
|
return mat3x3<f32>(
|
||
|
a[0].xyz,
|
||
|
vec3<f32>(a[0].w, a[1].xy),
|
||
|
vec3<f32>(a[1].zw, b),
|
||
|
);
|
||
|
}
|