-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Recreate OSM viewer with Bevy #1038
base: main
Are you sure you want to change the base?
Recreate OSM viewer with Bevy #1038
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool to see this come together! Things like the pancam plugin really reduce common effort
apps/osm_viewer_bevy/src/main.rs
Outdated
let mut builder = PolygonMeshBuilder::new(); | ||
// Call `add_earcutr_input` or each polygon you want in the mesh. | ||
builder.add_earcutr_input(EarcutrInput { | ||
vertices: poly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case it's useful later for polygons with holes, there's a way to run earcutr and get vertices + indices already: geom::Tessellation::from(polygon).consume()
apps/osm_viewer_bevy/src/main.rs
Outdated
if let Some(mesh) = builder.build() { | ||
commands.spawn(MaterialMesh2dBundle { | ||
mesh: meshes.add(Mesh::from(mesh)).into(), | ||
material: materials.add(ColorMaterial::from(Color::PURPLE)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if there's always one material per mesh in Bevy, or is there an easy way to specify material through per-vertex attributes? I could imagine cases where both could be useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Progress screenshot with road color and intersections. I've hit a blocker: I noticed that the map is flipped vertically, because Bevy's coordinate system is inverted compared to A/B streets'. I asked on discord to see if there's a Bevy way to fix this, but let me know if you can think of a small change to the map model that would solve this issue. |
Suggestion: don't change the model, just invert when displaying in Bevy? |
Awesome progress! I'm quite curious to see what the Bevy patterns for lazily rendering the high-zoom details will look like. I also got curious about Bevy and started some experiments. Even if something isn't possible yet, the process for making a new general-purpose plugin is pretty lightweight, and the effort helps any other Bevy project out there. Someone in the Discord suggested a As a workaround, what if we do this transformation in the |
I saw you started experimenting with bevy and made some notes about using The solution, whether we're using a transform or Using |
I have a simple implementation where the details layer visibility is changed depending on the zoom level. All the entities are spawned at startup, and toggling visibility is as simple as adding the following system pub fn toggle_details_visibility(
camera_projection: Query<&OrthographicProjection, With<Camera2d>>,
mut details_visibility: Query<&mut Visibility, With<DetailsLayer>>,
) {
details_visibility.single_mut().is_visible = camera_projection.single().scale < 0.75;
} |
Avoids reversing the z-index order
👋 Just a status update: I have a new full time commitment and won't have time to contribute more to this branch. Hopefully some of this exploration is useful for the future of this project. Best of luck with the year ahead! |
Thanks for the heads up and for all you've done here! I'll leave the PR open as a draft for now, and maybe get it a little further along and merge if I have time, or wait for someone else to pick it up. Enjoy your new job! |
Day 1: lost way too much time because I tried using dynamic linking, but I have meshes