bevy/crates/bevy_render/src/render_resource
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
..
bind_group.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
bind_group_layout.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
buffer.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
buffer_vec.rs Add 2d meshes and materials (#3460) 2022-01-08 01:29:08 +00:00
mod.rs Add MapMode to wgpu reexports (#3558) 2022-01-05 19:19:22 +00:00
pipeline.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
pipeline_cache.rs fix shader compilation error reporting for non-wgsl shaders (#3441) 2021-12-29 21:04:27 +00:00
pipeline_specializer.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
shader.rs load spirv using correct API (#3466) 2021-12-30 19:55:01 +00:00
texture.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
uniform_vec.rs Prepare crevice for vendored release (#3394) 2021-12-23 22:49:12 +00:00