-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add per-entity colored wireframes #3677
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.
Just a couple of nits. The examples are good, the code is clear and the functionality is lovely. Thanks!
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.
Looks great. We can quibble over the pub
-ness, but I'm otherwise very happy with this PR.
689922a
to
6cbb184
Compare
@UberLambda Could you rebase this PR, I was about to make a PR with exactly this feature. The code looks good to me, but there are conflicts. |
de1f156
to
e096e8e
Compare
@IceSentry Rebased, it seems to work + it passes tests (locally) 👀 |
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.
Left some feedback about doc comments that I'd like to see cleaned up before we merge :)
I like the new |
About the overloaded use of Maybe something like |
Maybe |
|
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.
Resolve the conflicts and switch to ExtractComponentPlugin
for the Wireframe
component extraction and we can get this merged.
299dee5
to
5e26fcb
Compare
Done, I think? (I did not have much time for this in the past week) |
I suggest making wireframe color a separate component from the toggle to enable/disable it. This would allow entities to specify their preferred wireframe color in general, even when wireframe is off (useful for when controlling the wireframe globally via the resource). |
I'd like to block on |
Separate Wireframe from WireframeColor
5e26fcb
to
4443213
Compare
Done! (I like @inodentry's solution more than having an |
This is much better now, but next time, please make a separate commit. Rebasing is completely fine, but I would have liked seeing the diff between the previous version. Other than that, good job 👍 |
Yeah, sorry - I had to get accustomed to the squash/rebase/squash dance lately 😅 |
@UberLambda could you rebase and fix the conflicts? Hopefully we can get this merged before 0.8 |
I've spoken with the author; this needs to be adopted. |
EDIT: Duh, there's already another PR #5303. I can review it |
Closing in favor of #5303. |
# Objective - Make the wireframe colors configurable at the global level and the single mesh level - Based on #5314 This video shows what happens when playing with various settings from the example https://github.com/bevyengine/bevy/assets/8348954/1ee9aee0-fab7-4da8-bc5d-8d0562bb34e6 ## Solution - Add a `color` field to the `WireframeMaterial` - Use a `WireframeColor` component to configure the color per entity - Add a `default_color` field to `WireframeConfig` for global wireframes or wireframes with no specified color. ## Notes - Most of the docs and the general idea for `WireframeColor` came from [UberLambda](https://github.com/UberLambda) in #3677 but the code ended up completely different so I created a separate branch. ~~I'm not sure how to correctly credit them on this PR.~~ (I re-created the commit but I added them as co-author in the commit message) ~~Closes #3677 ~~Closes #5301 ~~#5314 should be merged before this PR.~~
# Objective - Make the wireframe colors configurable at the global level and the single mesh level - Based on bevyengine#5314 This video shows what happens when playing with various settings from the example https://github.com/bevyengine/bevy/assets/8348954/1ee9aee0-fab7-4da8-bc5d-8d0562bb34e6 ## Solution - Add a `color` field to the `WireframeMaterial` - Use a `WireframeColor` component to configure the color per entity - Add a `default_color` field to `WireframeConfig` for global wireframes or wireframes with no specified color. ## Notes - Most of the docs and the general idea for `WireframeColor` came from [UberLambda](https://github.com/UberLambda) in bevyengine#3677 but the code ended up completely different so I created a separate branch. ~~I'm not sure how to correctly credit them on this PR.~~ (I re-created the commit but I added them as co-author in the commit message) ~~Closes bevyengine#3677 ~~Closes bevyengine#5301 ~~bevyengine#5314 should be merged before this PR.~~
# Objective - Make the wireframe colors configurable at the global level and the single mesh level - Based on bevyengine#5314 This video shows what happens when playing with various settings from the example https://github.com/bevyengine/bevy/assets/8348954/1ee9aee0-fab7-4da8-bc5d-8d0562bb34e6 ## Solution - Add a `color` field to the `WireframeMaterial` - Use a `WireframeColor` component to configure the color per entity - Add a `default_color` field to `WireframeConfig` for global wireframes or wireframes with no specified color. ## Notes - Most of the docs and the general idea for `WireframeColor` came from [UberLambda](https://github.com/UberLambda) in bevyengine#3677 but the code ended up completely different so I created a separate branch. ~~I'm not sure how to correctly credit them on this PR.~~ (I re-created the commit but I added them as co-author in the commit message) ~~Closes bevyengine#3677 ~~Closes bevyengine#5301 ~~bevyengine#5314 should be merged before this PR.~~
# Objective - Make the wireframe colors configurable at the global level and the single mesh level - Based on bevyengine#5314 This video shows what happens when playing with various settings from the example https://github.com/bevyengine/bevy/assets/8348954/1ee9aee0-fab7-4da8-bc5d-8d0562bb34e6 ## Solution - Add a `color` field to the `WireframeMaterial` - Use a `WireframeColor` component to configure the color per entity - Add a `default_color` field to `WireframeConfig` for global wireframes or wireframes with no specified color. ## Notes - Most of the docs and the general idea for `WireframeColor` came from [UberLambda](https://github.com/UberLambda) in bevyengine#3677 but the code ended up completely different so I created a separate branch. ~~I'm not sure how to correctly credit them on this PR.~~ (I re-created the commit but I added them as co-author in the commit message) ~~Closes bevyengine#3677 ~~Closes bevyengine#5301 ~~bevyengine#5314 should be merged before this PR.~~
Objective
This branch adds per-entity-colored wireframes to
WireframePlugin
.This feature is mostly useful for debugging; for instance, think of differently-colored selection wireframes in an editor.
Solution
Wireframe
component now has acolor: Color
field, which defaults to white.If present, this sets the color of the wirefame for that specific entity only.
WireframeConfig
.Wireframe
colors have precedence over theWireframeConfig
one.DynamicUniformVec
on GPU. They are extracted fromWireframe
components (and theWireframeConfig
) by a system in theRenderApp
.