Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Recreate OSM viewer with Bevy#1038

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
matthieu-foucault wants to merge15 commits intoa-b-street:main
base:main
Choose a base branch
Loading
frommatthieu-foucault:bevy_prototype

Conversation

matthieu-foucault
Copy link
Contributor

Day 1: lost way too much time because I tried using dynamic linking, but I have meshes

image

Zireael07 reacted with hooray emoji
Copy link
Collaborator

@dabreegsterdabreegster left a 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

let mut builder = PolygonMeshBuilder::new();
// Call `add_earcutr_input` or each polygon you want in the mesh.
builder.add_earcutr_input(EarcutrInput {
vertices: poly
Copy link
Collaborator

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()

matthieu-foucault reacted with thumbs up emoji
if let Some(mesh) = builder.build() {
commands.spawn(MaterialMesh2dBundle {
mesh: meshes.add(Mesh::from(mesh)).into(),
material: materials.add(ColorMaterial::from(Color::PURPLE)),
Copy link
Collaborator

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

@matthieu-foucault
Copy link
ContributorAuthor

Progress screenshot with road color and intersections.

image

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'. Iasked 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.

@Zireael07
Copy link

Suggestion: don't change the model, just invert when displaying in Bevy?

@dabreegster
Copy link
Collaborator

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 startedsome 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-1 transform... I'd also maybe expect that to work. Not sure how the 2D renderer works, but maybe we need to trydouble_sided orcull_mode: None withhttps://docs.rs/bevy/latest/bevy/pbr/struct.StandardMaterial.html in case the camera / lighting doesn't understand the flipped things.

As a workaround, what if we do this transformation in theRoadBundle code? We could do something likemap_model.get_bounds().max_y - y when transforming all of thePt2Ds to Bevy-land.

@matthieu-foucault
Copy link
ContributorAuthor

I saw you started experimenting with bevy and made some notes about usingbevy_earcutr, that's why I started using it :) .

The solution, whether we're using a transform ormap_model.get_bounds().max_y - y (which I had both tried), is to reverse the order of the vertices in theearcutr output.

Usingdouble_sided orcull_mode: None were not valid options asStandardMaterial doesn't implementMaterial2d

Zireael07 and dabreegster reacted with thumbs up emoji

@matthieu-foucault
Copy link
ContributorAuthor

matthieu-foucault commentedDec 22, 2022
edited
Loading

I'm quite curious to see what the Bevy patterns for lazily rendering the high-zoom details will look like.

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

pubfntoggle_details_visibility(camera_projection:Query<&OrthographicProjection,With<Camera2d>>,mutdetails_visibility:Query<&mutVisibility,With<DetailsLayer>>,){    details_visibility.single_mut().is_visible = camera_projection.single().scale <0.75;}

@matthieu-foucault
Copy link
ContributorAuthor

👋 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!

@dabreegster
Copy link
Collaborator

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!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dabreegsterdabreegsterdabreegster left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@matthieu-foucault@Zireael07@dabreegster

[8]ページ先頭

©2009-2025 Movatter.jp