-
-
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
[Merged by Bors] - Apply vertex colors to ColorMaterial and Mesh2D #4812
Conversation
…outputs. Add an example demonstrating it in action.
This is my first try at submitting a PR to Bevy. I hope I did it properly! Thanks for all your hard work. |
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 some comments on clarifying the example :) Change itself makes sense; I'm impressed at how easy this was to add.
@@ -0,0 +1,39 @@ | |||
//! Shows how to render a polygonal [`Mesh`], generated from a [`Quad`] primitive, in a 2D scene. |
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 mention the colored vertexes presumably.
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've added a second line (the first is copied from the mesh2d
example). I wasn't sure how to reference the other example, if that's preferred.
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.
Yeah, I don't think there's a need to crosslink examples. I'm happy with this description now.
// Build a default quad mesh | ||
let mut mesh = Mesh::from(shape::Quad::default()); | ||
// Build vertex colors for the quad | ||
let vertex_colors: Vec<[f32; 4]> = vec![ |
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 matrix is a little inscrutable for beginners. What do these numbers mean?
I can guess that they're RGBA, with each row representing another vertex, but beginners won't be able to guess that.
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 agree, so I've replaced them with a much more readable Color::RED.as_rgba_f32()
. Thanks!
Hopefully the last couple of commits resolved things: it removed a needless clone of texture_handle, added the example to the examples |
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.
Seems pretty straightforward. LGTM!
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.
bors r+
# Objective - Add Vertex Color support to 2D meshes and ColorMaterial. This extends the work from #4528 (which in turn builds on the excellent tangent handling). ## Solution - Added `#ifdef` wrapped support for vertex colors in the 2D mesh shader and `ColorMaterial` shader. - Added an example, `mesh2d_vertex_color_texture` to demonstrate it in action. ![image](https://user-images.githubusercontent.com/14896751/169530930-6ae0c6be-2f69-40e3-a600-ba91d7178bc3.png) --- ## Changelog - Added optional (ifdef wrapped) vertex color support to the 2dmesh and color material systems.
# Objective - Add Vertex Color support to 2D meshes and ColorMaterial. This extends the work from bevyengine#4528 (which in turn builds on the excellent tangent handling). ## Solution - Added `#ifdef` wrapped support for vertex colors in the 2D mesh shader and `ColorMaterial` shader. - Added an example, `mesh2d_vertex_color_texture` to demonstrate it in action. ![image](https://user-images.githubusercontent.com/14896751/169530930-6ae0c6be-2f69-40e3-a600-ba91d7178bc3.png) --- ## Changelog - Added optional (ifdef wrapped) vertex color support to the 2dmesh and color material systems.
# Objective - Add Vertex Color support to 2D meshes and ColorMaterial. This extends the work from bevyengine#4528 (which in turn builds on the excellent tangent handling). ## Solution - Added `#ifdef` wrapped support for vertex colors in the 2D mesh shader and `ColorMaterial` shader. - Added an example, `mesh2d_vertex_color_texture` to demonstrate it in action. ![image](https://user-images.githubusercontent.com/14896751/169530930-6ae0c6be-2f69-40e3-a600-ba91d7178bc3.png) --- ## Changelog - Added optional (ifdef wrapped) vertex color support to the 2dmesh and color material systems.
Objective
Solution
#ifdef
wrapped support for vertex colors in the 2D mesh shader andColorMaterial
shader.mesh2d_vertex_color_texture
to demonstrate it in action.Changelog