bevy/examples/3d
Joona Aalto 0166db33f7
Deprecate shapes in bevy_render::mesh::shape (#11773)
# Objective

#11431 and #11688 implemented meshing support for Bevy's new geometric
primitives. The next step is to deprecate the shapes in
`bevy_render::mesh::shape` and to later remove them completely for 0.14.

## Solution

Deprecate the shapes and reduce code duplication by utilizing the
primitive meshing API for the old shapes where possible.

Note that some shapes have behavior that can't be exactly reproduced
with the new primitives yet:

- `Box` is more of an AABB with min/max extents
- `Plane` supports a subdivision count
- `Quad` has a `flipped` property

These types have not been changed to utilize the new primitives yet.

---

## Changelog

- Deprecated all shapes in `bevy_render::mesh::shape`
- Changed all examples to use new primitives for meshing

## Migration Guide

Bevy has previously used rendering-specific types like `UVSphere` and
`Quad` for primitive mesh shapes. These have now been deprecated to use
the geometric primitives newly introduced in version 0.13.

Some examples:

```rust
let before = meshes.add(shape::Box::new(5.0, 0.15, 5.0));
let after = meshes.add(Cuboid::new(5.0, 0.15, 5.0));

let before = meshes.add(shape::Quad::default());
let after = meshes.add(Rectangle::default());

let before = meshes.add(shape::Plane::from_size(5.0));
// The surface normal can now also be specified when using `new`
let after = meshes.add(Plane3d::default().mesh().size(5.0, 5.0));

let before = meshes.add(
    Mesh::try_from(shape::Icosphere {
        radius: 0.5,
        subdivisions: 5,
    })
    .unwrap(),
);
let after = meshes.add(Sphere::new(0.5).mesh().ico(5).unwrap());
```
2024-02-08 18:01:34 +00:00
..
3d_gizmos.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
3d_scene.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
3d_shapes.rs Implement Meshable for some 3D primitives (#11688) 2024-02-06 21:44:13 +00:00
3d_viewport_to_world.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
animated_material.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
anti_aliasing.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
atmospheric_fog.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
blend_modes.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
bloom_3d.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
deferred_rendering.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
deterministic.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
fog.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
generate_custom_mesh.rs Mesh insert indices (#11745) 2024-02-06 23:31:48 +00:00
irradiance_volumes.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
lighting.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
lightmaps.rs Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
lines.rs Inverse missing_docs logic (#11676) 2024-02-03 21:40:55 +00:00
load_gltf.rs Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
orthographic.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
parallax_mapping.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
parenting.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
pbr.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
reflection_probes.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
render_to_texture.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
shadow_biases.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
shadow_caster_receiver.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
skybox.rs Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
spherical_area_lights.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
split_screen.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
spotlight.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
ssao.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
texture.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
tonemapping.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
transmission.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
transparency_3d.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
two_passes.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
update_gltf_scene.rs Meshlet prep (#11442) 2024-01-22 15:28:33 +00:00
vertex_colors.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00
wireframe.rs Deprecate shapes in bevy_render::mesh::shape (#11773) 2024-02-08 18:01:34 +00:00