Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

style: apply cargo fmt to camera3d changes

Richie McIlroye7f2ab41de5c
diff --git a/apps/cli/src/agents.rs b/apps/cli/src/agents.rs
index 478c64887..739d9854a 100644
--- a/apps/cli/src/agents.rs
+++ b/apps/cli/src/agents.rs
@@ -20,10 +20,7 @@ static CAP_DEMO_SKILL: include_dir::Dir<'static> =
// Flatten every embedded file (recursively) so each becomes its own install
// change. include_dir gives direct files via `files()` and nested dirs via
// `dirs()`; file paths are already relative to the embedded root.
-fn collect_demo_files<'a>(
- dir: &'a include_dir::Dir<'a>,
- out: &mut Vec<&'a include_dir::File<'a>>,
-) {
+fn collect_demo_files<'a>(dir: &'a include_dir::Dir<'a>, out: &mut Vec<&'a include_dir::File<'a>>) {
for file in dir.files() {
out.push(file);
}
diff --git a/crates/project/src/configuration.rs b/crates/project/src/configuration.rs
index c0a593419..1e5234c82 100644
--- a/crates/project/src/configuration.rs
+++ b/crates/project/src/configuration.rs
@@ -2455,7 +2455,10 @@ mod tests {
reloaded.camera3d_segments[0].tracks.zoom[0].out_easing,
Some([0.0, 0.0])
);
- assert_eq!(reloaded.camera3d_segments[0].blur.mode, Camera3DBlurMode::Radial);
+ assert_eq!(
+ reloaded.camera3d_segments[0].blur.mode,
+ Camera3DBlurMode::Radial
+ );
}
#[test]
diff --git a/crates/rendering/src/camera3d.rs b/crates/rendering/src/camera3d.rs
index 8fe324318..080f41f60 100644
--- a/crates/rendering/src/camera3d.rs
+++ b/crates/rendering/src/camera3d.rs
@@ -136,15 +136,16 @@ fn effective_frame(
Camera3DFrame {
pose: (!flat).then_some(eased),
- blur: blur_active.then_some(Camera3DBlurFrame {
- strength,
- ..*blur
- }),
+ blur: blur_active.then_some(Camera3DBlurFrame { strength, ..*blur }),
activity: activity.clamp(0.0, 1.0),
}
}
-fn pose_from_activity(pose: &Camera3DProperties, activity: f64, fill_zoom: f64) -> Camera3DProperties {
+fn pose_from_activity(
+ pose: &Camera3DProperties,
+ activity: f64,
+ fill_zoom: f64,
+) -> Camera3DProperties {
let a = activity.clamp(0.0, 1.0);
let zoom = pose.zoom.clamp(0.05, 100.0);
Camera3DProperties {
@@ -585,8 +586,7 @@ mod tests {
content_uv: cap_project::XY::new(0.2, 0.9),
amount: 1.0,
};
- let with_zoom =
- camera3d_inverse_homography(&props, ASPECT, Some(&identity_zoom)).unwrap();
+ let with_zoom = camera3d_inverse_homography(&props, ASPECT, Some(&identity_zoom)).unwrap();
let without = camera3d_inverse_homography(&props, ASPECT, None).unwrap();
assert_eq!(with_zoom.inverse_rows, without.inverse_rows);
}
@@ -638,7 +638,7 @@ mod tests {
},
];
assert_eq!(sample_track(5.0, &[], 0.0), 5.0);
- assert_eq!(sample_track(5.0, &keys, 0.0), 10.0, );
+ assert_eq!(sample_track(5.0, &keys, 0.0), 10.0,);
// Linear handles ([0,0]/[1,1]) give an exact linear midpoint.
assert_close(sample_track(5.0, &keys, 2.0), 15.0, 1e-9, "linear mid");
assert_eq!(sample_track(5.0, &keys, 9.0), 20.0);
@@ -662,7 +662,10 @@ mod tests {
];
// cubic-bezier(0.65, 0, 0.35, 1): slow start, midpoint exactly 0.5.
let quarter = sample_track(0.0, &keys, 0.25);
- assert!(quarter < 0.15, "eased quarter should lag linear, got {quarter}");
+ assert!(
+ quarter < 0.15,
+ "eased quarter should lag linear, got {quarter}"
+ );
assert_close(sample_track(0.0, &keys, 0.5), 0.5, 1e-4, "eased mid");
}
diff --git a/crates/rendering/src/layers/camera3d.rs b/crates/rendering/src/layers/camera3d.rs
index ea9b32754..bcb9e8110 100644
--- a/crates/rendering/src/layers/camera3d.rs
+++ b/crates/rendering/src/layers/camera3d.rs
@@ -87,7 +87,8 @@ impl Camera3DLayer {
let aspect = out_w as f64 / out_h as f64;
if let Some(pose) = frame.pose
- && let Some(homography) = camera3d_inverse_homography(&pose, aspect, uniforms.camera3d_zoom.as_ref())
+ && let Some(homography) =
+ camera3d_inverse_homography(&pose, aspect, uniforms.camera3d_zoom.as_ref())
{
let rows = homography.inverse_rows;
let (hx, hy) = homography.half_extents;
diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rs
index df9d3c720..c3167f012 100644
--- a/crates/rendering/src/lib.rs
+++ b/crates/rendering/src/lib.rs
@@ -5840,11 +5840,8 @@ impl RendererLayers {
Some(Camera3DBlurKind::Gaussian) => {
{
let mut pass = render_pass!(session.other_texture_view(), wgpu::LoadOp::Load);
- self.camera3d.render_blur_h(
- &mut pass,
- device,
- session.current_texture_view(),
- );
+ self.camera3d
+ .render_blur_h(&mut pass, device, session.current_texture_view());
}
let mut pass = render_pass!(session.current_texture_view(), wgpu::LoadOp::Load);
self.camera3d
@@ -5853,11 +5850,8 @@ impl RendererLayers {
Some(Camera3DBlurKind::Bokeh) => {
{
let mut pass = render_pass!(session.other_texture_view(), wgpu::LoadOp::Load);
- self.camera3d.render_blur_v(
- &mut pass,
- device,
- session.current_texture_view(),
- );
+ self.camera3d
+ .render_blur_v(&mut pass, device, session.current_texture_view());
}
session.swap_textures();
}