From e9525029acb88f9053a1d6f39f30de5856dfd822 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 9 Oct 2024 09:22:44 +0200 Subject: [PATCH] Fix debug assertion in `create_labels` (#7639) ### What glam on debug now notices that what we have here is a perspective transform. We actually don't quite care about the perspective divide here, but this fixes the issue and still has the correct label ordering (just to be sure I checked with the spiral of labels generated by the old `test_api` script) image ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using examples from latest `main` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7639?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [rerun.io/viewer](https://rerun.io/viewer/pr/7639?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! * [x] If have noted any breaking changes to the log API in `CHANGELOG.md` and the migration guide - [PR Build Summary](https://build.rerun.io/pr/7639) - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html) To run all checks from `main`, comment on the PR with `@rerun-bot full-check`. --- crates/viewer/re_space_view_spatial/src/ui.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/viewer/re_space_view_spatial/src/ui.rs b/crates/viewer/re_space_view_spatial/src/ui.rs index 04ef5a5c4b6c..0d08bf10893b 100644 --- a/crates/viewer/re_space_view_spatial/src/ui.rs +++ b/crates/viewer/re_space_view_spatial/src/ui.rs @@ -169,7 +169,7 @@ pub fn create_labels( // Closest last (painters algorithm) labels.sort_by_key(|label| { if let UiLabelTarget::Position3D(pos) = label.target { - OrderedFloat::from(-ui_from_world_3d.transform_point3(pos).z) + OrderedFloat::from(-ui_from_world_3d.project_point3(pos).z) } else { OrderedFloat::from(0.0) }