Skip to content

Commit 56aef46

Browse files
committed
Merge branch 'main' into debug-draw
2 parents 2f1a35d + 15c55a1 commit 56aef46

File tree

270 files changed

+9130
-2464
lines changed

Some content is hidden

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

270 files changed

+9130
-2464
lines changed

.github/contributing/example_style_guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ For more advice on writing examples, see the [relevant section](../../CONTRIBUTI
3838
4. In Queries, prefer `With<T>` filters over actually fetching unused data with `&T`.
3939
5. Prefer disjoint queries using `With` and `Without` over param sets when you need more than one query in a single system.
4040
6. Prefer structs with named fields over tuple structs except in the case of single-field wrapper types.
41-
7. Use enum-labels over string-labels for system / schedule / etc. labels.
41+
7. Use enum-labels over string-labels for app / schedule / etc. labels.
4242

4343
## "Feature" examples
4444

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ Our merge strategy relies on the classification of PRs on two axes:
8181
* How controversial are the design decisions
8282
* How complex is the implementation
8383

84+
Each [label](https://github.com/bevyengine/bevy/labels) has a prefix denoting its category:
85+
86+
* A: Area (e.g. A-Animation, A-ECS, A-Rendering)
87+
* C: Category (e.g. C-Breaking-Change, C-Code-Quality, C-Docs)
88+
* D: Difficulty (e.g. D-Complex, D-Good-First-Issue)
89+
* O: Operating System (e.g. O-Linux, O-Web, O-Windows)
90+
* P: Priority (e.g. P-Critical, P-High)
91+
* S: Status (e.g. S-Blocked, S-Controversial, S-Needs-Design)
92+
8493
PRs with non-trivial design decisions are given the [`S-Controversial`] label. This indicates that
8594
the PR needs more thorough design review or an [RFC](https://github.com/bevyengine/rfcs), if complex enough.
8695

Cargo.toml

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ repository = "https://github.com/bevyengine/bevy"
1313
rust-version = "1.67.0"
1414

1515
[workspace]
16-
exclude = ["benches", "crates/bevy_ecs_compile_fail_tests", "crates/bevy_reflect_compile_fail_tests"]
16+
exclude = [
17+
"benches",
18+
"crates/bevy_ecs_compile_fail_tests",
19+
"crates/bevy_reflect_compile_fail_tests",
20+
]
1721
members = [
1822
"crates/*",
1923
"examples/mobile",
@@ -40,11 +44,14 @@ default = [
4044
"bevy_ui",
4145
"png",
4246
"hdr",
47+
"ktx2",
48+
"zstd",
4349
"vorbis",
4450
"x11",
4551
"filesystem_watcher",
4652
"bevy_gizmos",
4753
"android_shared_stdcxx",
54+
"tonemapping_luts"
4855
]
4956

5057
# Force dynamic linking, which improves iterative compile times
@@ -74,6 +81,7 @@ trace = ["bevy_internal/trace"]
7481
wgpu_trace = ["bevy_internal/wgpu_trace"]
7582

7683
# Image format support for texture loading (PNG and HDR are enabled by default)
84+
exr = ["bevy_internal/exr"]
7785
hdr = ["bevy_internal/hdr"]
7886
png = ["bevy_internal/png"]
7987
tga = ["bevy_internal/tga"]
@@ -123,6 +131,13 @@ animation = ["bevy_internal/animation"]
123131
# Enable using a shared stdlib for cxx on Android.
124132
android_shared_stdcxx = ["bevy_internal/android_shared_stdcxx"]
125133

134+
# Enable detailed trace event logging.
135+
# These trace events are expensive even when off, thus they require compile time opt-in.
136+
detailed_trace = ["bevy_internal/detailed_trace"]
137+
138+
# Include tonemapping LUT KTX2 files.
139+
tonemapping_luts = ["bevy_internal/tonemapping_luts"]
140+
126141
[dependencies]
127142
bevy_dylib = { path = "crates/bevy_dylib", version = "0.9.0", default-features = false, optional = true }
128143
bevy_internal = { path = "crates/bevy_internal", version = "0.9.0", default-features = false }
@@ -401,6 +416,17 @@ description = "Loads and renders a glTF file as a scene"
401416
category = "3D Rendering"
402417
wasm = true
403418

419+
[[example]]
420+
name = "tonemapping"
421+
path = "examples/3d/tonemapping.rs"
422+
required-features = ["ktx2", "zstd"]
423+
424+
[package.metadata.example.tonemapping]
425+
name = "Tonemapping"
426+
description = "Compares tonemapping options"
427+
category = "3D Rendering"
428+
wasm = true
429+
404430
[[example]]
405431
name = "fxaa"
406432
path = "examples/3d/fxaa.rs"
@@ -484,7 +510,6 @@ wasm = true
484510
[[example]]
485511
name = "skybox"
486512
path = "examples/3d/skybox.rs"
487-
required-features = ["ktx2", "zstd"]
488513

489514
[package.metadata.example.skybox]
490515
name = "Skybox"
@@ -827,6 +852,26 @@ description = "Shows how to create and register a custom audio source by impleme
827852
category = "Audio"
828853
wasm = true
829854

855+
[[example]]
856+
name = "spatial_audio_2d"
857+
path = "examples/audio/spatial_audio_2d.rs"
858+
859+
[package.metadata.example.spatial_audio_2d]
860+
name = "Spatial Audio 2D"
861+
description = "Shows how to play spatial audio, and moving the emitter in 2D"
862+
category = "Audio"
863+
wasm = true
864+
865+
[[example]]
866+
name = "spatial_audio_3d"
867+
path = "examples/audio/spatial_audio_3d.rs"
868+
869+
[package.metadata.example.spatial_audio_3d]
870+
name = "Spatial Audio 3D"
871+
description = "Shows how to play spatial audio, and moving the emitter in 3D"
872+
category = "Audio"
873+
wasm = true
874+
830875
# Diagnostics
831876
[[example]]
832877
name = "log_diagnostics"
@@ -949,6 +994,16 @@ description = "Query for entities that had a specific component removed earlier
949994
category = "ECS (Entity Component System)"
950995
wasm = false
951996

997+
[[example]]
998+
name = "run_conditions"
999+
path = "examples/ecs/run_conditions.rs"
1000+
1001+
[package.metadata.example.run_conditions]
1002+
name = "Run Conditions"
1003+
description = "Run systems only when one or multiple conditions are met"
1004+
category = "ECS (Entity Component System)"
1005+
wasm = false
1006+
9521007
[[example]]
9531008
name = "startup_system"
9541009
path = "examples/ecs/startup_system.rs"

assets/environment_maps/info.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The pisa_*.ktx2 files were generated from https://github.com/KhronosGroup/glTF-Sample-Environments/blob/master/pisa.hdr using the following tools and commands:
2+
- IBL environment map prefiltering to cubemaps: https://github.com/KhronosGroup/glTF-IBL-Sampler
3+
- Diffuse: ./cli -inputPath pisa.hdr -outCubeMap pisa_diffuse.ktx2 -distribution Lambertian -cubeMapResolution 32
4+
- Specular: ./cli -inputPath pisa.hdr -outCubeMap pisa_specular.ktx2 -distribution GGX -cubeMapResolution 512
5+
- Converting to rgb9e5 format with zstd 'supercompression': https://github.com/DGriffin91/bevy_mod_environment_map_tools
6+
- cargo run --release -- --inputs pisa_diffuse.ktx2,pisa_specular.ktx2 --outputs pisa_diffuse_rgb9e5_zstd.ktx2,pisa_specular_rgb9e5_zstd.ktx2
Binary file not shown.
Binary file not shown.

assets/shaders/array_texture.wgsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#import bevy_pbr::shadows
99
#import bevy_pbr::fog
1010
#import bevy_pbr::pbr_functions
11+
#import bevy_pbr::pbr_ambient
1112

1213
@group(1) @binding(0)
1314
var my_array_texture: texture_2d_array<f32>;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#import bevy_pbr::mesh_view_bindings
2+
#import bevy_pbr::mesh_bindings
3+
#import bevy_pbr::utils
4+
5+
#ifdef TONEMAP_IN_SHADER
6+
#import bevy_core_pipeline::tonemapping
7+
#endif
8+
9+
struct FragmentInput {
10+
@builtin(front_facing) is_front: bool,
11+
@builtin(position) frag_coord: vec4<f32>,
12+
#import bevy_pbr::mesh_vertex_output
13+
};
14+
15+
// Sweep across hues on y axis with value from 0.0 to +15EV across x axis
16+
// quantized into 24 steps for both axis.
17+
fn color_sweep(uv: vec2<f32>) -> vec3<f32> {
18+
var uv = uv;
19+
let steps = 24.0;
20+
uv.y = uv.y * (1.0 + 1.0 / steps);
21+
let ratio = 2.0;
22+
23+
let h = PI * 2.0 * floor(1.0 + steps * uv.y) / steps;
24+
let L = floor(uv.x * steps * ratio) / (steps * ratio) - 0.5;
25+
26+
var color = vec3(0.0);
27+
if uv.y < 1.0 {
28+
color = cos(h + vec3(0.0, 1.0, 2.0) * PI * 2.0 / 3.0);
29+
let maxRGB = max(color.r, max(color.g, color.b));
30+
let minRGB = min(color.r, min(color.g, color.b));
31+
color = exp(15.0 * L) * (color - minRGB) / (maxRGB - minRGB);
32+
} else {
33+
color = vec3(exp(15.0 * L));
34+
}
35+
return color;
36+
}
37+
38+
fn hsv_to_srgb(c: vec3<f32>) -> vec3<f32> {
39+
let K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
40+
let p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
41+
return c.z * mix(K.xxx, clamp(p - K.xxx, vec3(0.0), vec3(1.0)), c.y);
42+
}
43+
44+
// Generates a continuous sRGB sweep.
45+
fn continuous_hue(uv: vec2<f32>) -> vec3<f32> {
46+
return hsv_to_srgb(vec3(uv.x, 1.0, 1.0)) * max(0.0, exp2(uv.y * 9.0) - 1.0);
47+
}
48+
49+
@fragment
50+
fn fragment(in: FragmentInput) -> @location(0) vec4<f32> {
51+
var uv = in.uv;
52+
var out = vec3(0.0);
53+
if uv.y > 0.5 {
54+
uv.y = 1.0 - uv.y;
55+
out = color_sweep(vec2(uv.x, uv.y * 2.0));
56+
} else {
57+
out = continuous_hue(vec2(uv.y * 2.0, uv.x));
58+
}
59+
var color = vec4(out, 1.0);
60+
#ifdef TONEMAP_IN_SHADER
61+
color = tone_mapping(color);
62+
#endif
63+
return color;
64+
}

benches/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ bevy_ecs = { path = "../crates/bevy_ecs" }
1616
bevy_reflect = { path = "../crates/bevy_reflect" }
1717
bevy_tasks = { path = "../crates/bevy_tasks" }
1818
bevy_utils = { path = "../crates/bevy_utils" }
19+
bevy_math = { path = "../crates/bevy_math" }
1920

2021
[profile.release]
2122
opt-level = 3
@@ -50,3 +51,8 @@ harness = false
5051
name = "iter"
5152
path = "benches/bevy_tasks/iter.rs"
5253
harness = false
54+
55+
[[bench]]
56+
name = "bezier"
57+
path = "benches/bevy_math/bezier.rs"
58+
harness = false

benches/benches/bevy_ecs/scheduling/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
use criterion::criterion_group;
22

3-
mod run_criteria;
3+
mod run_condition;
44
mod running_systems;
55
mod schedule;
66

7-
use run_criteria::*;
7+
use run_condition::*;
88
use running_systems::*;
99
use schedule::*;
1010

1111
criterion_group!(
1212
scheduling_benches,
13-
run_criteria_yes,
14-
run_criteria_no,
15-
run_criteria_yes_with_query,
16-
run_criteria_yes_with_resource,
13+
run_condition_yes,
14+
run_condition_no,
15+
run_condition_yes_with_query,
16+
run_condition_yes_with_resource,
1717
empty_systems,
1818
busy_systems,
1919
contrived,

0 commit comments

Comments
 (0)