bevy/examples/3d
ira 6a85eb3d7e
Immediate Mode Line/Gizmo Drawing (#6529)
# Objective
Add a convenient immediate mode drawing API for visual debugging.

Fixes #5619
Alternative to #1625
Partial alternative to #5734

Based off https://github.com/Toqozz/bevy_debug_lines with some changes:
 * Simultaneous support for 2D and 3D.
 * Methods for basic shapes; circles, spheres, rectangles, boxes, etc.
 * 2D methods.
 * Removed durations. Seemed niche, and can be handled by users.

<details>
<summary>Performance</summary>

Stress tested using Bevy's recommended optimization settings for the dev
profile with the
following command.
```bash
cargo run --example many_debug_lines \
    --config "profile.dev.package.\"*\".opt-level=3" \
    --config "profile.dev.opt-level=1"
```
I dipped to 65-70 FPS at 300,000 lines
CPU: 3700x
RAM Speed: 3200 Mhz
GPU: 2070 super - probably not very relevant, mostly cpu/memory bound

</details>

<details>
<summary>Fancy bloom screenshot</summary>


![Screenshot_20230207_155033](https://user-images.githubusercontent.com/29694403/217291980-f1e0500e-7a14-4131-8c96-eaaaf52596ae.png)

</details>

## Changelog
 * Added `GizmoPlugin`
 * Added `Gizmos` system parameter for drawing lines and wireshapes.

### TODO
- [ ] Update changelog
- [x] Update performance numbers
- [x] Add credit to PR description

### Future work
- Cache rendering primitives instead of constructing them out of line
segments each frame.
- Support for drawing solid meshes
- Interactions. (See
[bevy_mod_gizmos](https://github.com/LiamGallagher737/bevy_mod_gizmos))
- Fancier line drawing. (See
[bevy_polyline](https://github.com/ForesightMiningSoftwareCorporation/bevy_polyline))
- Support for `RenderLayers`
- Display gizmos for a certain duration. Currently everything displays
for one frame (ie. immediate mode)
- Changing settings per drawn item like drawing on top or drawing to
different `RenderLayers`

Co-Authored By: @lassade <felipe.jorge.pereira@gmail.com>
Co-Authored By: @The5-1 <agaku@hotmail.de> 
Co-Authored By: @Toqozz <toqoz@hotmail.com>
Co-Authored By: @nicopap <nico@nicopap.ch>

---------

Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: IceSentry <c.giguere42@gmail.com>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2023-03-20 20:57:54 +00:00
..
3d_gizmos.rs Immediate Mode Line/Gizmo Drawing (#6529) 2023-03-20 20:57:54 +00:00
3d_scene.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
3d_shapes.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
atmospheric_fog.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
blend_modes.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
bloom_3d.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
fog.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
fxaa.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
lighting.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
lines.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
load_gltf.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
msaa.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
orthographic.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
parenting.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
pbr.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
render_to_texture.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
shadow_biases.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
shadow_caster_receiver.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
skybox.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
spherical_area_lights.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
split_screen.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
spotlight.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
texture.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
tonemapping.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
transparency_3d.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
two_passes.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
update_gltf_scene.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
vertex_colors.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
wireframe.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00