-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
don't use bevy_pbr for base bevy_gizmos plugin #17581
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
Conversation
IceSentry
left a comment
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.
I like where this is going, but needs a few changes.
crates/bevy_gizmos/src/lib.rs
Outdated
| const LINE_JOINT_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(1162780797909187908); | ||
|
|
||
| /// A [`Plugin`] that provides an immediate mode drawing api for visual debugging. | ||
| /// It does *not* require `bevy_pbr` |
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.
That comment isn't necessary.
crates/bevy_gizmos/src/view.rs
Outdated
| ) { | ||
| if let Some(view_binding) = view_uniforms.uniforms.binding() { | ||
| for entity in &views { | ||
| let entries = DynamicBindGroupEntries::new_with_indices(((0, view_binding.clone()),)); |
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.
This can be moved to be before the loop.
crates/bevy_gizmos/src/view.rs
Outdated
| layout: Res<OnlyViewLayout>, | ||
| views: Query<Entity>, | ||
| ) { | ||
| if let Some(view_binding) = view_uniforms.uniforms.binding() { |
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.
I'd prefer a let-else with early return but that's a tiny nitpick and purely optional.
Co-authored-by: IceSentry <[email protected]>
Co-authored-by: IceSentry <[email protected]>
crates/bevy_gizmos/src/view.rs
Outdated
| DynamicBindGroupEntries, DynamicBindGroupLayoutEntries, ShaderStages, | ||
| }, | ||
| renderer::RenderDevice, | ||
| view::{ViewUniform, ViewUniforms}, |
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.
This should fix CI
| view::{ViewUniform, ViewUniforms}, | |
| view::{ExtractedView, ViewUniform, ViewUniforms}, |
|
I did the same thing for Now Right now I would love |
|
I'd be more than happy to review and approve a PR that moves shared things from 2d/3d to bevy_render. We want to break appart bevy_render because it's giant, but moving shared things to it still makes sense. I'd also be happy to review and approve a PR that moves the OnlyViewLayout thing to bevy render, but I think this could be done after this current PR is merged. |
|
Ok, I prepare a new PR for
Do you know where in the |
|
Answered in discord to keep this discussion relevant to this PR |
|
Is there something missing to merge this issue ? |
|
A second review. Bevy needs 2 reviews per PR. I'd suggest resolving all conversations just to make sure reviewer don't skip the PR because of it. |
|
Sorry @rambip; we needed a second reviewer. This looks sensible to me: if you get merge conflicts resolved I'll merge this ASAP. |
|
I suspect that the issue in #17945 would be automatically fixed by my proposed solution, so I will merge with my changes. |
)" This reverts commit b574599.
Objective
This PR enables
bevy_gizmosto be used withoutbevy_pbr, for user who want to create their custom mesh rendering logic.It can also be useful for user who just want to use bevy for drawing lines (why not).
This work is part of a bigger effort to make the bevy rendering pipeline more modular. I would like to contribute an exemple to render custom meshes without
bevy_pbr. Something like thisSolution
Now,
bevy_pbris an optional dependency, and used only to debug lights.I query the
ViewUniformsmanually, instead of usingbevy_pbrto get the heavyMeshViewLayoutTesting
I'm not used to testing with bevy at all, but I was able to use successfully in my project.
It might break for some different mesh pipelines, but I don't think so.
Showcase
So nice ...
Migration Guide
I don't think there is any breaking change
Remaining work
Before merging it, it would be useful to:
pipeline_2d.rslogic to remove thebevy_spritedepedency tooview.rstobevy_render, so that it can be used in a more modular way.- include the most recent changes from 0.16