bevy/examples/2d
davier c2da7800e3 Add 2d meshes and materials (#3460)
# Objective

The current 2d rendering is specialized to render sprites, we need a generic way to render 2d items, using meshes and materials like we have for 3d.

## Solution

I cloned a good part of `bevy_pbr` into `bevy_sprite/src/mesh2d`, removed lighting and pbr itself, adapted it to 2d rendering, added a `ColorMaterial`, and modified the sprite rendering to break batches around 2d meshes.

~~The PR is a bit crude; I tried to change as little as I could in both the parts copied from 3d and the current sprite rendering to make reviewing easier. In the future, I expect we could make the sprite rendering a normal 2d material, cleanly integrated with the rest.~~ _edit: see <https://github.com/bevyengine/bevy/pull/3460#issuecomment-1003605194>_

## Remaining work

- ~~don't require mesh normals~~ _out of scope_
- ~~add an example~~ _done_
- support 2d meshes & materials in the UI?
- bikeshed names (I didn't think hard about naming, please check if it's fine)

## Remaining questions

- ~~should we add a depth buffer to 2d now that there are 2d meshes?~~ _let's revisit that when we have an opaque render phase_
- ~~should we add MSAA support to the sprites, or remove it from the 2d meshes?~~ _I added MSAA to sprites since it's really needed for 2d meshes_
- ~~how to customize vertex attributes?~~ _#3120_



Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-01-08 01:29:08 +00:00
..
contributors.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
many_sprites.rs Fix doc_markdown lints in examples (#3486) 2021-12-29 17:25:34 +00:00
mesh2d.rs Add 2d meshes and materials (#3460) 2022-01-08 01:29:08 +00:00
mesh2d_manual.rs Add 2d meshes and materials (#3460) 2022-01-08 01:29:08 +00:00
rect.rs Add an example to draw a rectangle (#2957) 2021-12-18 00:52:37 +00:00
sprite.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
sprite_flipping.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
sprite_sheet.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
text2d.rs Implement and require #[derive(Component)] on all component structs (#2254) 2021-10-03 19:23:44 +00:00
texture_atlas.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00