Skip to content

Commit f9298be

Browse files
committed
ported to the new bevy 0.19
1 parent 56f7c61 commit f9298be

8 files changed

Lines changed: 41 additions & 41 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/target/
44
**/logs/*.copper
55
**/logs/*.log
6+
**/copper-crash-**.txt

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ serde = { version = "1.0", default-features = false, features = [
3737
"derive",
3838
"alloc",
3939
] }
40-
avian3d = { version = "0.6.1", default-features = false }
41-
bevy = { version = "0.18.0", default-features = false }
40+
avian3d = { version = "0.7.0", default-features = false }
41+
bevy = { version = "0.19.0", default-features = false }
4242
buddy_system_allocator = { version = "0.13", default-features = false }
4343
cached-path = { version = "0.10.0", default-features = false }
4444
cortex-m = "0.7"

examples/cu_flight_controller/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ embedded_build_release = true
2424
ignored = ["bincode"]
2525

2626
[dependencies]
27-
bevy_ecs = { version = "0.18.0", default-features = false }
27+
bevy_ecs = { version = "0.19.0", default-features = false }
2828
## Flight controller components
2929

3030
### Hardware

examples/cu_flight_controller/src/sim.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ use bevy::image::TextureFormatPixelInfo;
2929
use bevy::prelude::{
3030
App, AssetPlugin, AssetServer, Assets, ButtonInput, Camera, Camera3d, Color, Commands,
3131
Component, ComputedNode, DefaultPlugins, Dir3, DirectionalLight, Entity, EnvironmentMapLight,
32-
FixedUpdate, GlobalAmbientLight, GlobalTransform, GltfAssetLabel, Handle, Image, ImageNode,
33-
IsDefaultUiCamera, KeyCode, MessageReader, MessageWriter, MinimalPlugins, Name, Node,
34-
PerspectiveProjection, Pickable, PluginGroup, PositionType, PostUpdate, Projection, Quat,
35-
Query, Res, ResMut, Resource, Scene, SceneRoot, Startup, Text, TextColor, TextFont,
36-
TextureAtlasLayout, Time, Transform, UVec2, UiRect, Update, Val, Vec2, Vec3, Visibility,
37-
Window, WindowPlugin, With, Without, default,
32+
FixedUpdate, FontSize, GlobalAmbientLight, GlobalTransform, GltfAssetLabel, Handle, Image,
33+
ImageNode, IsDefaultUiCamera, KeyCode, MessageReader, MessageWriter, MinimalPlugins, Name,
34+
Node, PerspectiveProjection, Pickable, PluginGroup, PositionType, PostUpdate, Projection, Quat,
35+
Query, Res, ResMut, Resource, Startup, Text, TextColor, TextFont, TextureAtlasLayout, Time,
36+
Transform, UVec2, UiRect, Update, Val, Vec2, Vec3, Visibility, Window, WindowPlugin, With,
37+
Without, WorldAsset, WorldAssetRoot, default,
3838
};
3939
use bevy::render::render_resource::{TextureDimension, TextureFormat, TextureUsages};
4040
#[cfg(not(target_arch = "wasm32"))]
@@ -136,8 +136,8 @@ struct SimKinematics {
136136

137137
#[derive(Resource)]
138138
struct PendingQuadcopterSpawn {
139-
quadcopter_scene: Handle<Scene>,
140-
city_scene: Handle<Scene>,
139+
quadcopter_scene: Handle<WorldAsset>,
140+
city_scene: Handle<WorldAsset>,
141141
}
142142

143143
#[derive(Resource, Clone, Copy, Debug, Default, PartialEq, Eq)]
@@ -785,7 +785,7 @@ fn setup_world(
785785
..default()
786786
}),
787787
Skybox {
788-
image: skybox_handle.clone(),
788+
image: Some(skybox_handle.clone()),
789789
brightness: 1000.0,
790790
..default()
791791
},
@@ -815,7 +815,7 @@ fn setup_world(
815815
Name::new("sun"),
816816
DirectionalLight {
817817
illuminance: 12_000.0,
818-
shadows_enabled: true,
818+
shadow_maps_enabled: true,
819819
..default()
820820
},
821821
Transform::from_translation(Vec3::new(3.0, 10.0, 1.0)).looking_at(Vec3::ZERO, Vec3::Y),
@@ -840,7 +840,7 @@ fn setup_world(
840840

841841
commands.spawn((
842842
Name::new("city"),
843-
SceneRoot(city_scene),
843+
WorldAssetRoot(city_scene),
844844
Transform {
845845
translation: city_translation,
846846
scale: city_scale,
@@ -873,7 +873,7 @@ fn spawn_quadcopter_when_world_ready(
873873
commands
874874
.spawn((
875875
Name::new("quadcopter"),
876-
SceneRoot(pending_spawn.quadcopter_scene.clone()),
876+
WorldAssetRoot(pending_spawn.quadcopter_scene.clone()),
877877
RigidBody::Dynamic,
878878
transform,
879879
position,
@@ -1054,7 +1054,7 @@ fn spawn_loading_overlay(
10541054
Pickable::IGNORE,
10551055
Text::new("Assets loading..."),
10561056
TextFont {
1057-
font_size: 18.0,
1057+
font_size: FontSize::Px(18.0),
10581058
..default()
10591059
},
10601060
TextColor(Color::srgb(0.93, 0.96, 1.0)),
@@ -1107,7 +1107,7 @@ fn spawn_help_overlay(
11071107
Pickable::IGNORE,
11081108
Text::new("View\nRC Link\nArm\nMode\nThrottle\nRoll/Pitch\nYaw\nReset"),
11091109
TextFont {
1110-
font_size: 12.0,
1110+
font_size: FontSize::Px(12.0),
11111111
..default()
11121112
},
11131113
TextColor(Color::srgb(0.78, 0.86, 0.96)),
@@ -1118,7 +1118,7 @@ fn spawn_help_overlay(
11181118
SimHelpValuesText,
11191119
Text::new("FPV (V)\nChecking RC link..."),
11201120
TextFont {
1121-
font_size: 12.0,
1121+
font_size: FontSize::Px(12.0),
11221122
..default()
11231123
},
11241124
TextColor(Color::WHITE),
@@ -1929,11 +1929,11 @@ fn update_osd_overlay(
19291929
let Some(osd_canvas_assets) = osd_canvas_assets else {
19301930
return;
19311931
};
1932-
let Some(canvas_image) = images.get_mut(&osd_canvas_assets.canvas) else {
1932+
let Some(mut canvas_image) = images.get_mut(&osd_canvas_assets.canvas) else {
19331933
return;
19341934
};
19351935

1936-
rasterize_osd_canvas(&osd_overlay, &raster_source, canvas_image);
1936+
rasterize_osd_canvas(&osd_overlay, &raster_source, &mut canvas_image);
19371937
}
19381938

19391939
fn stop_copper_on_exit(mut exit_events: MessageReader<AppExit>, mut copper: ResMut<CopperState>) {
@@ -1960,7 +1960,7 @@ fn register_scene_reflect_types(app: &mut App) {
19601960
app.register_type::<bevy::prelude::Handle<bevy::prelude::StandardMaterial>>();
19611961
app.register_type::<bevy::prelude::Handle<bevy::prelude::Image>>();
19621962
app.register_type::<bevy::prelude::Handle<bevy::prelude::Gltf>>();
1963-
app.register_type::<bevy::prelude::Handle<bevy::prelude::Scene>>();
1963+
app.register_type::<bevy::prelude::Handle<bevy::prelude::WorldAsset>>();
19641964
app.register_type::<bevy::gltf::GltfExtras>();
19651965
app.register_type::<bevy::gltf::GltfSceneExtras>();
19661966
app.register_type::<bevy::gltf::GltfMeshExtras>();

examples/cu_rp_balancebot/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ignored = ["serde"]
1717

1818
[dependencies]
1919
serde = { workspace = true }
20-
bevy_ecs = { version = "0.18.0", default-features = false }
20+
bevy_ecs = { version = "0.19.0", default-features = false }
2121
cu-ads7883-new = { git = "https://github.com/copper-project/copper-rs.git", branch = "master" }
2222
cu-rp-sn754410-new = { git = "https://github.com/copper-project/copper-rs.git", branch = "master" }
2323
cu-rp-encoder = { git = "https://github.com/copper-project/copper-rs.git", branch = "master" }
@@ -76,7 +76,7 @@ cached-path = { workspace = true, features = [
7676
"rustls-tls",
7777
], optional = true }
7878
winit = { version = "=0.30.13", default-features = false, optional = true }
79-
bevy_anti_alias = { version = "0.18.0", optional = true }
79+
bevy_anti_alias = { version = "0.19.0", optional = true }
8080

8181
[target.'cfg(target_arch = "wasm32")'.dependencies]
8282
cu29 = { git = "https://github.com/copper-project/copper-rs.git", branch = "master", default-features = false, features = [
@@ -85,7 +85,7 @@ cu29 = { git = "https://github.com/copper-project/copper-rs.git", branch = "mast
8585
"units",
8686
] }
8787
cu-bevymon = { git = "https://github.com/copper-project/copper-rs.git", branch = "master", default-features = false, optional = true }
88-
bevy_anti_alias = { version = "0.18.0", optional = true }
88+
bevy_anti_alias = { version = "0.19.0", optional = true }
8989
bevy = { workspace = true, default-features = false, features = [
9090
"default_font",
9191
"bevy_render",

examples/cu_rp_balancebot/src/bevymon.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use bevy::asset::UnapprovedPathMode;
1313
use bevy::camera::ClearColorConfig;
1414
use bevy::prelude::{
1515
App, AssetPlugin, BackgroundColor, BorderColor, Camera, Camera2d, ClearColor, Color, Commands,
16-
Component, DefaultPlugins, Entity, FixedUpdate, Pickable, PluginGroup, PostUpdate, Query, Res,
17-
ResMut, Resource, Startup, Text, TextColor, TextFont, Update, Val, Visibility, Window,
18-
WindowPlugin, With, default,
16+
Component, DefaultPlugins, Entity, FixedUpdate, FontSize, Pickable, PluginGroup, PostUpdate,
17+
Query, Res, ResMut, Resource, Startup, Text, TextColor, TextFont, Update, Val, Visibility,
18+
Window, WindowPlugin, With, default,
1919
};
2020
use bevy::render::RenderPlugin;
2121
use bevy::ui::{Node as UiNode, PositionType, UiRect};
@@ -224,7 +224,7 @@ fn spawn_balancebot_layout(
224224
Pickable::IGNORE,
225225
Text::new("Assets loading..."),
226226
TextFont {
227-
font_size: 18.0,
227+
font_size: FontSize::Px(18.0),
228228
..default()
229229
},
230230
TextColor(Color::srgb(0.93, 0.96, 1.0)),
@@ -260,7 +260,7 @@ fn spawn_balancebot_layout(
260260
Pickable::IGNORE,
261261
Text::new("Move\nNavigation\nInteract\nZoom\nPause/Resume\nReset\nShow Forces"),
262262
TextFont {
263-
font_size: 12.0,
263+
font_size: FontSize::Px(12.0),
264264
..default()
265265
},
266266
TextColor(Color::srgba(0.25, 0.25, 0.75, 1.0)),
@@ -269,7 +269,7 @@ fn spawn_balancebot_layout(
269269
Pickable::IGNORE,
270270
Text::new(instructions),
271271
TextFont {
272-
font_size: 12.0,
272+
font_size: FontSize::Px(12.0),
273273
..default()
274274
},
275275
TextColor(Color::WHITE),

examples/cu_rp_balancebot/src/sim.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ struct BalanceBotSim {}
1010
use bevy::asset::{AssetApp, UnapprovedPathMode};
1111
use bevy::prelude::{
1212
App, AssetPlugin, DefaultPlugins, FixedUpdate, Font, ImagePlugin, Mesh, MinimalPlugins,
13-
PluginGroup, PostUpdate, SceneSpawner, StandardMaterial, Startup, Update, Window, WindowPlugin,
14-
default,
13+
PluginGroup, PostUpdate, StandardMaterial, Startup, Update, Window, WindowPlugin, default,
1514
};
1615
use bevy::render::RenderPlugin;
1716
use bevy::scene::ScenePlugin;
@@ -46,7 +45,6 @@ pub fn make_world(headless: bool) -> App {
4645
app.init_asset::<Mesh>();
4746
app.init_asset::<StandardMaterial>();
4847
app.init_asset::<Font>();
49-
app.init_resource::<SceneSpawner>();
5048
} else {
5149
app.add_plugins(
5250
DefaultPlugins

examples/cu_rp_balancebot/src/world/mod.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub fn build_world(app: &mut App, headless: bool, split_monitor: bool) -> &mut A
244244
app.register_type::<Handle<StandardMaterial>>();
245245
app.register_type::<Handle<Image>>();
246246
app.register_type::<Handle<Gltf>>();
247-
app.register_type::<Handle<Scene>>();
247+
app.register_type::<Handle<WorldAsset>>();
248248
app.register_type::<bevy::gltf::GltfExtras>();
249249
app.register_type::<bevy::gltf::GltfSceneExtras>();
250250
app.register_type::<bevy::gltf::GltfMeshExtras>();
@@ -436,7 +436,7 @@ fn setup_scene(
436436
affects_lightmapped_meshes: true,
437437
});
438438

439-
commands.spawn((SceneRoot(scene_handle),));
439+
commands.spawn((WorldAssetRoot(scene_handle),));
440440

441441
let split_target = if layout.split_monitor {
442442
let mut image = Image::new_uninit(
@@ -479,18 +479,19 @@ fn setup_scene(
479479
}
480480

481481
camera.insert(Skybox {
482-
image: skybox_handle,
482+
image: Some(skybox_handle),
483483
brightness: 1000.0,
484484
..default()
485485
});
486486
#[cfg(not(target_arch = "wasm32"))]
487487
camera.insert(ScreenSpaceReflections {
488-
perceptual_roughness_threshold: 0.85,
488+
max_perceptual_roughness: 0.80..0.85,
489489
thickness: 0.01,
490490
linear_steps: 128,
491491
linear_march_exponent: 2.0,
492492
bisection_steps: 8,
493493
use_secant: true,
494+
..default()
494495
});
495496
camera.insert(Fxaa::default());
496497

@@ -545,7 +546,7 @@ fn setup_ui(mut commands: Commands, layout: Res<WorldLayout>) {
545546
Pickable::IGNORE,
546547
Text::new("Assets loading..."),
547548
TextFont {
548-
font_size: 18.0,
549+
font_size: FontSize::Px(18.0),
549550
..default()
550551
},
551552
TextColor(Color::srgb(0.93, 0.96, 1.0)),
@@ -576,7 +577,7 @@ fn setup_ui(mut commands: Commands, layout: Res<WorldLayout>) {
576577
parent.spawn((
577578
Text::new("Move\nNavigation\nInteract\nZoom\nPause/Resume\nReset\nShow Forces"),
578579
TextFont {
579-
font_size: 12.0,
580+
font_size: FontSize::Px(12.0),
580581
..default()
581582
},
582583
TextColor(Color::srgba(0.25, 0.25, 0.75, 1.0)), // Golden color
@@ -586,7 +587,7 @@ fn setup_ui(mut commands: Commands, layout: Res<WorldLayout>) {
586587
parent.spawn((
587588
Text::new(instructions),
588589
TextFont {
589-
font_size: 12.0,
590+
font_size: FontSize::Px(12.0),
590591
..default()
591592
},
592593
TextColor(Color::WHITE),
@@ -758,7 +759,7 @@ fn setup_entities(
758759
// Light
759760
commands.spawn((
760761
PointLight {
761-
shadows_enabled: true,
762+
shadow_maps_enabled: true,
762763
..default()
763764
},
764765
Transform::from_xyz(2.0, 4.0, 2.0),

0 commit comments

Comments
 (0)