Skip to content

Commit 79ec4c2

Browse files
authored
Merge branch 'main' into motion-blur
2 parents 3067923 + 71be08a commit 79ec4c2

File tree

115 files changed

+1276
-342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1276
-342
lines changed

Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ map_flatten = "warn"
4242

4343
[workspace.lints.rust]
4444
unsafe_op_in_unsafe_fn = "warn"
45+
missing_docs = "warn"
4546

4647
[lints]
4748
workspace = true
@@ -528,6 +529,17 @@ description = "Shows how to create graphics that snap to the pixel grid by rende
528529
category = "2D Rendering"
529530
wasm = true
530531

532+
[[example]]
533+
name = "bounding_2d"
534+
path = "examples/2d/bounding_2d.rs"
535+
doc-scrape-examples = true
536+
537+
[package.metadata.example.bounding_2d]
538+
name = "2D Bounding Volume Intersections"
539+
description = "Showcases bounding volumes and intersection tests"
540+
category = "2D Rendering"
541+
wasm = true
542+
531543
# 3D Rendering
532544
[[example]]
533545
name = "3d_scene"

crates/bevy_a11y/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Accessibility for Bevy
22
3-
#![warn(missing_docs)]
43
#![forbid(unsafe_code)]
54

65
use std::sync::{

crates/bevy_animation/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Animation for the game engine Bevy
22
3-
#![warn(missing_docs)]
4-
53
mod animatable;
64
mod util;
75

crates/bevy_app/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! This crate is about everything concerning the highest-level, application layer of a Bevy app.
22
3-
#![warn(missing_docs)]
4-
53
mod app;
64
mod main_schedule;
75
mod plugin;

crates/bevy_app/src/plugin_group.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{App, AppError, Plugin};
2-
use bevy_utils::{tracing::debug, tracing::warn, HashMap};
2+
use bevy_utils::{tracing::debug, tracing::warn, TypeIdMap};
33
use std::any::TypeId;
44

55
/// Combines multiple [`Plugin`]s into a single unit.
@@ -33,7 +33,7 @@ impl PluginGroup for PluginGroupBuilder {
3333
/// can be disabled, enabled or reordered.
3434
pub struct PluginGroupBuilder {
3535
group_name: String,
36-
plugins: HashMap<TypeId, PluginEntry>,
36+
plugins: TypeIdMap<PluginEntry>,
3737
order: Vec<TypeId>,
3838
}
3939

crates/bevy_asset/macros/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// FIXME(3492): remove once docs are ready
2+
#![allow(missing_docs)]
3+
14
use bevy_macro_utils::BevyManifest;
25
use proc_macro::{Span, TokenStream};
36
use quote::{format_ident, quote};

crates/bevy_asset/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// FIXME(3492): remove once docs are ready
2+
#![allow(missing_docs)]
3+
14
pub mod io;
25
pub mod meta;
36
pub mod processor;

crates/bevy_asset/src/server/info.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
};
77
use bevy_ecs::world::World;
88
use bevy_log::warn;
9-
use bevy_utils::{Entry, HashMap, HashSet};
9+
use bevy_utils::{Entry, HashMap, HashSet, TypeIdMap};
1010
use crossbeam_channel::Sender;
1111
use std::{
1212
any::TypeId,
@@ -61,7 +61,7 @@ impl AssetInfo {
6161

6262
#[derive(Default)]
6363
pub(crate) struct AssetInfos {
64-
path_to_id: HashMap<AssetPath<'static>, HashMap<TypeId, UntypedAssetId>>,
64+
path_to_id: HashMap<AssetPath<'static>, TypeIdMap<UntypedAssetId>>,
6565
infos: HashMap<UntypedAssetId, AssetInfo>,
6666
/// If set to `true`, this informs [`AssetInfos`] to track data relevant to watching for changes (such as `load_dependants`)
6767
/// This should only be set at startup.
@@ -72,10 +72,10 @@ pub(crate) struct AssetInfos {
7272
/// Tracks living labeled assets for a given source asset.
7373
/// This should only be set when watching for changes to avoid unnecessary work.
7474
pub(crate) living_labeled_assets: HashMap<AssetPath<'static>, HashSet<String>>,
75-
pub(crate) handle_providers: HashMap<TypeId, AssetHandleProvider>,
76-
pub(crate) dependency_loaded_event_sender: HashMap<TypeId, fn(&mut World, UntypedAssetId)>,
75+
pub(crate) handle_providers: TypeIdMap<AssetHandleProvider>,
76+
pub(crate) dependency_loaded_event_sender: TypeIdMap<fn(&mut World, UntypedAssetId)>,
7777
pub(crate) dependency_failed_event_sender:
78-
HashMap<TypeId, fn(&mut World, UntypedAssetId, AssetPath<'static>, AssetLoadError)>,
78+
TypeIdMap<fn(&mut World, UntypedAssetId, AssetPath<'static>, AssetLoadError)>,
7979
}
8080

8181
impl std::fmt::Debug for AssetInfos {
@@ -112,7 +112,7 @@ impl AssetInfos {
112112
#[allow(clippy::too_many_arguments)]
113113
fn create_handle_internal(
114114
infos: &mut HashMap<UntypedAssetId, AssetInfo>,
115-
handle_providers: &HashMap<TypeId, AssetHandleProvider>,
115+
handle_providers: &TypeIdMap<AssetHandleProvider>,
116116
living_labeled_assets: &mut HashMap<AssetPath<'static>, HashSet<String>>,
117117
watching_for_changes: bool,
118118
type_id: TypeId,
@@ -205,7 +205,7 @@ impl AssetInfos {
205205
.ok_or(GetOrCreateHandleInternalError::HandleMissingButTypeIdNotSpecified)?;
206206

207207
match handles.entry(type_id) {
208-
Entry::Occupied(entry) => {
208+
bevy_utils::hashbrown::hash_map::Entry::Occupied(entry) => {
209209
let id = *entry.get();
210210
// if there is a path_to_id entry, info always exists
211211
let info = self.infos.get_mut(&id).unwrap();
@@ -246,7 +246,7 @@ impl AssetInfos {
246246
}
247247
}
248248
// The entry does not exist, so this is a "fresh" asset load. We must create a new handle
249-
Entry::Vacant(entry) => {
249+
bevy_utils::hashbrown::hash_map::Entry::Vacant(entry) => {
250250
let should_load = match loading_mode {
251251
HandleLoadingMode::NotLoading => false,
252252
HandleLoadingMode::Request | HandleLoadingMode::Force => true,
@@ -640,7 +640,7 @@ impl AssetInfos {
640640

641641
fn process_handle_drop_internal(
642642
infos: &mut HashMap<UntypedAssetId, AssetInfo>,
643-
path_to_id: &mut HashMap<AssetPath<'static>, HashMap<TypeId, UntypedAssetId>>,
643+
path_to_id: &mut HashMap<AssetPath<'static>, TypeIdMap<UntypedAssetId>>,
644644
loader_dependants: &mut HashMap<AssetPath<'static>, HashSet<AssetPath<'static>>>,
645645
living_labeled_assets: &mut HashMap<AssetPath<'static>, HashSet<String>>,
646646
watching_for_changes: bool,

crates/bevy_asset/src/server/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{
1919
use bevy_ecs::prelude::*;
2020
use bevy_log::{error, info, warn};
2121
use bevy_tasks::IoTaskPool;
22-
use bevy_utils::{CowArc, HashMap, HashSet};
22+
use bevy_utils::{CowArc, HashMap, HashSet, TypeIdMap};
2323
use crossbeam_channel::{Receiver, Sender};
2424
use futures_lite::StreamExt;
2525
use info::*;
@@ -1238,7 +1238,7 @@ pub fn handle_internal_asset_events(world: &mut World) {
12381238

12391239
#[derive(Default)]
12401240
pub(crate) struct AssetLoaders {
1241-
type_id_to_loader: HashMap<TypeId, MaybeAssetLoader>,
1241+
type_id_to_loader: TypeIdMap<MaybeAssetLoader>,
12421242
extension_to_type_id: HashMap<String, TypeId>,
12431243
type_name_to_type_id: HashMap<&'static str, TypeId>,
12441244
preregistered_loaders: HashMap<&'static str, TypeId>,

crates/bevy_audio/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
//! ```
2222
2323
#![forbid(unsafe_code)]
24-
#![warn(missing_docs)]
2524

2625
mod audio;
2726
mod audio_output;

crates/bevy_core/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![warn(missing_docs)]
2-
31
//! This crate provides core functionality for Bevy Engine.
42
53
mod name;

crates/bevy_core_pipeline/src/core_2d/camera_2d.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,7 @@ impl Default for Camera2dBundle {
4545
..Default::default()
4646
};
4747
let transform = Transform::default();
48-
let view_projection =
49-
projection.get_projection_matrix() * transform.compute_matrix().inverse();
50-
let frustum = Frustum::from_view_projection_custom_far(
51-
&view_projection,
52-
&transform.translation,
53-
&transform.back(),
54-
projection.far(),
55-
);
48+
let frustum = projection.compute_frustum(&GlobalTransform::from(transform));
5649
Self {
5750
camera_render_graph: CameraRenderGraph::new(SubGraph2d),
5851
projection,
@@ -84,14 +77,7 @@ impl Camera2dBundle {
8477
..Default::default()
8578
};
8679
let transform = Transform::from_xyz(0.0, 0.0, far - 0.1);
87-
let view_projection =
88-
projection.get_projection_matrix() * transform.compute_matrix().inverse();
89-
let frustum = Frustum::from_view_projection_custom_far(
90-
&view_projection,
91-
&transform.translation,
92-
&transform.back(),
93-
projection.far(),
94-
);
80+
let frustum = projection.compute_frustum(&GlobalTransform::from(transform));
9581
Self {
9682
camera_render_graph: CameraRenderGraph::new(SubGraph3d),
9783
projection,

crates/bevy_core_pipeline/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// FIXME(3492): remove once docs are ready
2+
#![allow(missing_docs)]
3+
14
pub mod blit;
25
pub mod bloom;
36
pub mod contrast_adaptive_sharpening;

crates/bevy_derive/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// FIXME(3492): remove once docs are ready
2+
#![allow(missing_docs)]
3+
14
extern crate proc_macro;
25

36
mod app_plugin;

crates/bevy_diagnostic/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// FIXME(3492): remove once docs are ready
2+
#![allow(missing_docs)]
3+
14
//! This crate provides a straightforward solution for integrating diagnostics in the [Bevy game engine](https://bevyengine.org/).
25
//! It allows users to easily add diagnostic functionality to their Bevy applications, enhancing
36
//! their ability to monitor and optimize their game's.

crates/bevy_dylib/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![warn(missing_docs)]
21
#![allow(clippy::single_component_path_imports)]
32

43
//! Forces dynamic linking of Bevy.

crates/bevy_dynamic_plugin/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// FIXME(11590): remove this once the lint is fixed
22
#![allow(unsafe_op_in_unsafe_fn)]
3+
// FIXME(3492): remove once docs are ready
4+
#![allow(missing_docs)]
35

46
mod loader;
57

crates/bevy_ecs/examples/change_detection.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
//! In this example we will simulate a population of entities. In every tick we will:
2+
//! 1. spawn a new entity with a certain possibility
3+
//! 2. age all entities
4+
//! 3. despawn entities with age > 2
5+
//!
6+
//! To demonstrate change detection, there are some console outputs based on changes in
7+
//! the `EntityCounter` resource and updated Age components
8+
19
use bevy_ecs::prelude::*;
210
use rand::Rng;
311
use std::ops::Deref;
412

5-
// In this example we will simulate a population of entities. In every tick we will:
6-
// 1. spawn a new entity with a certain possibility
7-
// 2. age all entities
8-
// 3. despawn entities with age > 2
9-
//
10-
// To demonstrate change detection, there are some console outputs based on changes in
11-
// the EntityCounter resource and updated Age components
1213
fn main() {
1314
// Create a new empty World to hold our Entities, Components and Resources
1415
let mut world = World::new();

crates/bevy_ecs/examples/events.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
//! In this example a system sends a custom event with a 50/50 chance during any frame.
2+
//! If an event was send, it will be printed by the console in a receiving system.
3+
14
use bevy_ecs::prelude::*;
25

3-
// In this example a system sends a custom event with a 50/50 chance during any frame.
4-
// If an event was send, it will be printed by the console in a receiving system.
56
fn main() {
67
// Create a new empty world and add the event as a resource
78
let mut world = World::new();

crates/bevy_ecs/examples/resources.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
//! In this example we add a counter resource and increase it's value in one system,
2+
//! while a different system prints the current count to the console.
3+
14
use bevy_ecs::prelude::*;
25
use rand::Rng;
36
use std::ops::Deref;
47

5-
// In this example we add a counter resource and increase it's value in one system,
6-
// while a different system prints the current count to the console.
78
fn main() {
89
// Create a world
910
let mut world = World::new();

crates/bevy_ecs/macros/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// FIXME(3492): remove once docs are ready
2+
#![allow(missing_docs)]
3+
14
extern crate proc_macro;
25

36
mod component;

crates/bevy_ecs/src/bundle.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! This module contains the [`Bundle`] trait and some other helper types.
44
55
pub use bevy_ecs_macros::Bundle;
6-
use bevy_utils::{HashMap, HashSet};
6+
use bevy_utils::{HashMap, HashSet, TypeIdMap};
77

88
use crate::{
99
archetype::{
@@ -14,7 +14,6 @@ use crate::{
1414
entity::{Entities, Entity, EntityLocation},
1515
query::DebugCheckedUnwrap,
1616
storage::{SparseSetIndex, SparseSets, Storages, Table, TableRow},
17-
TypeIdMap,
1817
};
1918
use bevy_ptr::OwningPtr;
2019
use bevy_utils::all_tuples;

crates/bevy_ecs/src/component.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ use crate::{
66
storage::{SparseSetIndex, Storages},
77
system::{Local, Resource, SystemParam},
88
world::{FromWorld, World},
9-
TypeIdMap,
109
};
1110
pub use bevy_ecs_macros::Component;
1211
use bevy_ptr::{OwningPtr, UnsafeCellDeref};
1312
#[cfg(feature = "bevy_reflect")]
1413
use bevy_reflect::Reflect;
14+
use bevy_utils::TypeIdMap;
1515
use std::cell::UnsafeCell;
1616
use std::{
1717
alloc::Layout,

0 commit comments

Comments
 (0)