[Merged by Bors] - Make vertex colors work without textures in bevy_sprite#5685
Closed
jwagner wants to merge 5 commits intobevyengine:mainfrom
Closed
[Merged by Bors] - Make vertex colors work without textures in bevy_sprite#5685jwagner wants to merge 5 commits intobevyengine:mainfrom
jwagner wants to merge 5 commits intobevyengine:mainfrom
Conversation
Contributor
Author
|
Improved the example a bit. Before I was cloning the entire mesh to use it in two entities, now I'm only cloning the handle. |
Contributor
BorisBoutillier
left a comment
There was a problem hiding this comment.
I think updating the example is a good call.
Comment on lines
28
to
35
| var output_color: vec4<f32> = material.color; | ||
| #ifdef VERTEX_COLORS | ||
| output_color = output_color * in.color; | ||
| #endif | ||
| if ((material.flags & COLOR_MATERIAL_FLAGS_TEXTURE_BIT) != 0u) { | ||
| #ifdef VERTEX_COLORS | ||
| output_color = output_color * textureSample(texture, texture_sampler, in.uv) * in.color; | ||
| #else | ||
| output_color = output_color * textureSample(texture, texture_sampler, in.uv); | ||
| #endif | ||
| } | ||
| return output_color; |
Contributor
There was a problem hiding this comment.
I think you should keep the #ifdef and #endif start of line for consistency with all other shader code.
Contributor
Author
There was a problem hiding this comment.
Good point, pushed an update.
BorisBoutillier
approved these changes
Aug 14, 2022
| // Spawn the quad with vertex colors | ||
| commands.spawn_bundle(MaterialMesh2dBundle { | ||
| mesh: mesh_handle.clone(), | ||
| transform: Transform::default() |
Contributor
There was a problem hiding this comment.
This could use from_translation.
Same for below :)
Contributor
Author
There was a problem hiding this comment.
Thanks for the hint. Changed it.
tim-blackbird
approved these changes
Aug 14, 2022
mockersf
approved these changes
Aug 15, 2022
IceSentry
approved these changes
Aug 16, 2022
Member
|
bors r+ |
bors bot
pushed a commit
that referenced
this pull request
Aug 16, 2022
# Objective This PR changes it possible to use vertex colors without a texture using the bevy_sprite ColorMaterial. Fixes #5679 ## Solution - Made multiplication of the output color independent of the COLOR_MATERIAL_FLAGS_TEXTURE_BIT bit - Extended mesh2d_vertex_color_texture example to show off both vertex colors and tinting Not sure if extending the existing example was the right call but it seems to be reasonable to me. I couldn't find any tests for the shaders and I think adding shader testing would be beyond the scope of this PR. So no tests in this PR. 😬 Co-authored-by: Jonas Wagner <jonas@29a.ch>
Contributor
|
Pull request successfully merged into main. Build succeeded: |
maccesch
pushed a commit
to Synphonyte/bevy
that referenced
this pull request
Sep 28, 2022
) # Objective This PR changes it possible to use vertex colors without a texture using the bevy_sprite ColorMaterial. Fixes bevyengine#5679 ## Solution - Made multiplication of the output color independent of the COLOR_MATERIAL_FLAGS_TEXTURE_BIT bit - Extended mesh2d_vertex_color_texture example to show off both vertex colors and tinting Not sure if extending the existing example was the right call but it seems to be reasonable to me. I couldn't find any tests for the shaders and I think adding shader testing would be beyond the scope of this PR. So no tests in this PR. 😬 Co-authored-by: Jonas Wagner <jonas@29a.ch>
james7132
pushed a commit
to james7132/bevy
that referenced
this pull request
Oct 28, 2022
) # Objective This PR changes it possible to use vertex colors without a texture using the bevy_sprite ColorMaterial. Fixes bevyengine#5679 ## Solution - Made multiplication of the output color independent of the COLOR_MATERIAL_FLAGS_TEXTURE_BIT bit - Extended mesh2d_vertex_color_texture example to show off both vertex colors and tinting Not sure if extending the existing example was the right call but it seems to be reasonable to me. I couldn't find any tests for the shaders and I think adding shader testing would be beyond the scope of this PR. So no tests in this PR. 😬 Co-authored-by: Jonas Wagner <jonas@29a.ch>
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Feb 1, 2023
) # Objective This PR changes it possible to use vertex colors without a texture using the bevy_sprite ColorMaterial. Fixes bevyengine#5679 ## Solution - Made multiplication of the output color independent of the COLOR_MATERIAL_FLAGS_TEXTURE_BIT bit - Extended mesh2d_vertex_color_texture example to show off both vertex colors and tinting Not sure if extending the existing example was the right call but it seems to be reasonable to me. I couldn't find any tests for the shaders and I think adding shader testing would be beyond the scope of this PR. So no tests in this PR. 😬 Co-authored-by: Jonas Wagner <jonas@29a.ch>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
This PR changes it possible to use vertex colors without a texture using the bevy_sprite ColorMaterial.
Fixes #5679
Solution
Not sure if extending the existing example was the right call but it seems to be reasonable to me.
I couldn't find any tests for the shaders and I think adding shader testing would be beyond the scope of this PR. So no tests in this PR. 😬