Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.
1#define_import_path bevy_gaussian_splatting::helpers
3#import bevy_gaussian_splatting::bindings::{
4 view,
5 gaussian_uniforms,
6}
9fn intrinsic_matrix() -> mat3x4<f32> {
10 let focal = vec2<f32>(
11 view.clip_from_view.x.x * view.viewport.z / 2.0,
12 view.clip_from_view.y.y * view.viewport.w / 2.0,
13 );
15 let Ks = mat3x4<f32>(
16 vec4<f32>(focal.x, 0.0, 0.0, (view.viewport.z - 1.0) / 2.0),
17 vec4<f32>(0.0, focal.y, 0.0, (view.viewport.w - 1.0) / 2.0),
18 vec4<f32>(0.0, 0.0, 0.0, 1.0)
19 );
21 return Ks;
25fn get_rotation_matrix(
26 rotation: vec4<f32>,
27) -> mat3x3<f32> {
28 let r = rotation.x;
29 let x = rotation.y;
30 let y = rotation.z;
31 let z = rotation.w;
33 return mat3x3<f32>(
34 1.0 - 2.0 * (y * y + z * z),
35 2.0 * (x * y - r * z),
36 2.0 * (x * z + r * y),
38 2.0 * (x * y + r * z),
39 1.0 - 2.0 * (x * x + z * z),
40 2.0 * (y * z - r * x),
42 2.0 * (x * z - r * y),
43 2.0 * (y * z + r * x),
44 1.0 - 2.0 * (x * x + y * y),
45 );
49fn get_scale_matrix(
50 scale: vec3<f32>,
51) -> mat3x3<f32> {
52 return mat3x3<f32>(
53 scale.x * gaussian_uniforms.global_scale, 0.0, 0.0,
54 0.0, scale.y * gaussian_uniforms.global_scale, 0.0,
55 0.0, 0.0, scale.z * gaussian_uniforms.global_scale,
56 );
Contents