Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use re_renderer to draw 2d scenes #465

Merged
merged 13 commits into from
Dec 6, 2022
Merged

use re_renderer to draw 2d scenes #465

merged 13 commits into from
Dec 6, 2022

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Dec 5, 2022

Use re_renderer instead of epaint for everything the 2d scene renders except text labels (and their boxes).

Differences are quite subtle!

before - after
image
after - before
image
after - before
image
(sorry for randomized order oops..)

Added transparency-enabled tinting to re_renderer to enable image layering as we had it before.

Coordinates passed to re_renderer draw data objects are all in scene coordinates! I.e. the camera/projection setup we're passing the the ViewBuilder is doing the job to go all the way from scene to pixel coordinates for us!

Direct follow-up todos:

  • change the hover check to use scene coordinates (by computing the mouse position in scene coordinates). Then the only thing we need ui coordinates for is placing text labels!
  • adjust data structures to not use egui color properties etc., cut out two step data conversions store->scene->renderer similar to what we did with lines in the 3d scene
  • remove egui images from ImageStore? This requires rendering the hover preview also with re_renderer which is a bit excessive for the moment (but so is keeping the extra texture!)

TODO before going in:

  • check more samples
  • test web

(Fixes most of #382, but I'll close only after those additional items)

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I've added a line to CHANGELOG.md (if this is a big enough change to warrant it)

emilk
emilk previously requested changes Dec 5, 2022
Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Niiice! we're getting close.

But I would feel better if #456 could be done before we merge this, so we can be sure we're not leaking GPU resources.

crates/re_renderer/src/color.rs Show resolved Hide resolved
crates/re_viewer/src/misc/tensor_image_cache.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/ui/view_2d/ui.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/ui/view_2d/ui.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/ui/view_2d/ui.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/ui/view_2d/ui.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/ui/view_2d/ui.rs Show resolved Hide resolved
@@ -560,6 +605,7 @@ fn view_2d_scrollable(
check_hovering(*instance_hash, min_dist_sq.sqrt());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason rendering and hovering was coupled together was to save on doing ui_from_space twice. Now that that has been fixed, it would be nice to separate rendering from picking completely!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed! Let's do so in a follow-up

crates/re_viewer/src/ui/view_2d/ui.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/ui/view_2d/ui.rs Outdated Show resolved Hide resolved
@Wumpf Wumpf mentioned this pull request Dec 5, 2022
3 tasks
@Wumpf Wumpf merged commit 566b50a into main Dec 6, 2022
@Wumpf Wumpf deleted the andreas/2dscene-re_renderer branch December 6, 2022 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants