Skip to content

Commit

Permalink
Bevy v0.15.0 (#87)
Browse files Browse the repository at this point in the history
#86

---------

Co-authored-by: Elie Génard <[email protected]>
Co-authored-by: Spencer C. Imbleau <[email protected]>
Co-authored-by: Robert Brewitz <[email protected]>
  • Loading branch information
4 people authored Feb 3, 2025
1 parent 53c3373 commit ae710fe
Show file tree
Hide file tree
Showing 35 changed files with 324 additions and 319 deletions.
94 changes: 50 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,78 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v4
- name: Setup | Checkout
uses: actions/checkout@v4

- name: Setup | Ubuntu dependencies
run: sudo apt install libasound2-dev libudev-dev pkg-config
- name: Setup | Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Setup | Toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt
- name: Setup | Toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt

- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Build | Clippy
run: cargo clippy -- -D warnings
- name: Build | Clippy
run: cargo clippy -- -D warnings

- name: Build | Rustfmt
run: cargo fmt -- --check
- name: Build | Rustfmt
run: cargo fmt -- --check

check:
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v4
- name: Setup | Checkout
uses: actions/checkout@v4

- name: Setup | Ubuntu dependencies
run: sudo apt install libasound2-dev libudev-dev pkg-config
- name: Setup | Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Setup | Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Setup | Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Rust Cache
uses: Swatinem/rust-cache@v2

- name: Build | Check (native)
run: cargo check
- name: Build | Check (native)
run: cargo check

- name: Build | Check (wasm)
run: cargo check --target wasm32-unknown-unknown
- name: Build | Check (wasm)
run: cargo check --target wasm32-unknown-unknown

test:
needs: [check]
runs-on: ubuntu-latest
steps:
- name: Setup | Checkout
uses: actions/checkout@v4
- name: Setup | Checkout
uses: actions/checkout@v4

- name: Setup | Ubuntu dependencies
run: sudo apt install libasound2-dev libudev-dev pkg-config
- name: Setup | Ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Setup | Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Setup | Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Setup | wasm-pack
uses: jetli/[email protected]
- name: Setup | wasm-pack
uses: jetli/[email protected]

- name: Rust Cache
uses: Swatinem/[email protected]
- name: Rust Cache
uses: Swatinem/[email protected]

- name: Build | Test (native)
run: cargo test
- name: Build | Test (native)
run: cargo test

- name: Build | Test (wasm)
run: wasm-pack test --node
- name: Build | Test (wasm)
run: wasm-pack test --node
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ You can find its changes [documented below](#061---2024-08-14).

This release supports Bevy version 0.14 and has an [MSRV][] of 1.80.

### Changed

- bevy_vello now uses Bevy 0.15

## [0.6.1] - 2024-08-14

This release supports Bevy version 0.14 and has an [MSRV][] of 1.80.
Expand Down
15 changes: 9 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ license = "(MIT OR Apache-2.0) AND OFL-1.1"
repository = "https://github.com/linebender/bevy_vello"

[workspace.dependencies]
bevy = { version = "0.14.0", default-features = false, features = [
bevy = { version = "0.15.1", default-features = false, features = [
"bevy_asset",
"bevy_winit",
"bevy_window",
"bevy_core_pipeline",
"bevy_pbr",
"bevy_render",
Expand Down Expand Up @@ -51,14 +52,16 @@ repository.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = { workspace = true }
vello = "0.2.1"
vello_svg = "0.3.0"
velato = "0.3.0"
thiserror = "1.0.61"
vello = "0.4.0"
vello_svg = "0.6.0"
velato = "0.5.0"
thiserror = "2.0.11"
once_cell = "1.19.0"
skrifa = "0.26.5"
bytemuck = { version = "1.21.0", features = ["derive"] }

[dev-dependencies]
wasm-bindgen-test = "0.3.42"
wasm-bindgen-test = "0.3.50"

[features]
default = ["default_font"]
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ cargo run -p demo

|bevy|bevy_vello|
|---|---|
|0.14|0.5-0.6, main|
|0.15|main|
|0.14|0.5-0.6|
|0.13|0.1-0.4|
|< 0.13| unsupported |

Expand Down
35 changes: 16 additions & 19 deletions examples/cube3d/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,21 @@ fn setup(
});
// Main pass cube, with material containing the rendered first pass texture.
commands.spawn((
PbrBundle {
mesh: meshes.add(Cuboid::new(4.0, 4.0, 4.0)),
material: material_handle,
transform: Transform::from_xyz(0.0, 0.0, 1.5)
.with_rotation(Quat::from_rotation_x(-std::f32::consts::PI / 5.0)),
..default()
},
Mesh3d(meshes.add(Cuboid::new(4.0, 4.0, 4.0))),
MeshMaterial3d(material_handle),
Transform::from_xyz(0.0, 0.0, 1.5)
.with_rotation(Quat::from_rotation_x(-std::f32::consts::PI / 5.0)),
MainPassCube,
));
// The main pass camera.
commands.spawn(PointLightBundle {
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 10.0)),
..default()
});
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(0.0, 0.0, 15.0).looking_at(Vec3::ZERO, Vec3::Y),
..default()
});
commands
.spawn(PointLight::default())
.insert(Transform::from_translation(Vec3::new(0.0, 0.0, 10.0)));

commands
.spawn(Camera3d::default())
.insert(Transform::from_xyz(0.0, 0.0, 15.0).looking_at(Vec3::ZERO, Vec3::Y));

commands.spawn(VelloTarget(image_handle));
}

Expand All @@ -131,7 +128,7 @@ fn render_texture(

let mut scene = VelloScene::default();
// Animate the scene
let sin_time = time.elapsed_seconds().sin().mul_add(0.5, 0.5);
let sin_time = time.elapsed_secs().sin().mul_add(0.5, 0.5);
let c = Vec3::lerp(
Vec3::new(-1.0, 0.0, 1.0),
Vec3::new(1.0, 0.0, 1.0),
Expand All @@ -140,7 +137,7 @@ fn render_texture(
scene.fill(
peniko::Fill::NonZero,
kurbo::Affine::translate((128.0, 128.0)),
peniko::Color::rgb(c.x as f64, c.y as f64, c.z as f64),
peniko::Color::new([c.x, c.y, c.z, 1.]),
None,
&kurbo::RoundedRect::new(0.0, 0.0, 256.0, 256.0, (sin_time as f64) * 128.0),
);
Expand Down Expand Up @@ -168,7 +165,7 @@ fn render_texture(
/// Rotates the outer cube (main pass)
fn cube_rotator_system(time: Res<Time>, mut query: Query<&mut Transform, With<MainPassCube>>) {
for mut transform in &mut query {
transform.rotate_x(1.0 * time.delta_seconds());
transform.rotate_y(0.7 * time.delta_seconds());
transform.rotate_x(1.0 * time.delta_secs());
transform.rotate_y(0.7 * time.delta_secs());
}
}
4 changes: 2 additions & 2 deletions examples/demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ publish = false
[dependencies]
bevy_vello = { path = "../../", features = ["experimental-dotLottie"] }
bevy = { workspace = true }
bevy_pancam = { version = "0.12.0", features = ["bevy_egui"] }
bevy_egui = "0.28.0"
bevy_pancam = { version = "0.16.0", features = ["bevy_egui"] }
bevy_egui = "0.31.0"
6 changes: 4 additions & 2 deletions examples/demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ fn main() {
}

fn setup_vector_graphics(mut commands: Commands, asset_server: ResMut<AssetServer>) {
commands.spawn((Camera2dBundle::default(), bevy_pancam::PanCam::default()));
commands.spawn((Camera2d, bevy_pancam::PanCam::default()));
commands
.spawn(VelloAssetBundle {
asset: asset_server.load::<VelloAsset>("embedded://demo/assets/calendar.json"),
asset: VelloAssetHandle(
asset_server.load::<VelloAsset>("embedded://demo/assets/calendar.json"),
),
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 0.0))
.with_scale(Vec3::splat(20.0)),
debug_visualizations: DebugVisualizations::Visible,
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn controls_ui(
&mut Playhead,
&mut PlaybackOptions,
&mut Theme,
&Handle<VelloAsset>,
&VelloAssetHandle,
)>,
assets: Res<Assets<VelloAsset>>,
) {
Expand Down
10 changes: 6 additions & 4 deletions examples/drag_n_drop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ fn main() {
}

fn setup_vector_graphics(mut commands: Commands, asset_server: ResMut<AssetServer>) {
commands.spawn(Camera2dBundle::default());
commands.spawn(Camera2d);
commands.spawn(VelloAssetBundle {
asset: asset_server.load::<VelloAsset>("embedded://drag_n_drop/assets/fountain.svg"),
asset: VelloAssetHandle(
asset_server.load::<VelloAsset>("embedded://drag_n_drop/assets/fountain.svg"),
),
debug_visualizations: DebugVisualizations::Visible,
transform: Transform::from_scale(Vec3::splat(5.0)),
..default()
Expand All @@ -30,7 +32,7 @@ fn setup_vector_graphics(mut commands: Commands, asset_server: ResMut<AssetServe
/// Drag and drop any SVG or Lottie JSON asset into the window and change the
/// displayed asset
fn drag_and_drop(
mut query: Query<&mut Handle<VelloAsset>>,
mut query: Query<&mut VelloAssetHandle>,
asset_server: ResMut<AssetServer>,
mut dnd_evr: EventReader<FileDragAndDrop>,
) {
Expand All @@ -41,7 +43,7 @@ fn drag_and_drop(
let FileDragAndDrop::DroppedFile { path_buf, .. } = ev else {
continue;
};
let new_handle = asset_server.load(path_buf.clone());
let new_handle = VelloAssetHandle(asset_server.load(path_buf.clone()));
*asset = new_handle;
}
}
4 changes: 2 additions & 2 deletions examples/lottie/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ fn main() {
}

fn load_lottie(mut commands: Commands, asset_server: ResMut<AssetServer>) {
commands.spawn(Camera2dBundle::default());
commands.spawn(Camera2d);

// Yes, it's this simple.
commands.spawn(VelloAssetBundle {
asset: asset_server.load("embedded://lottie/assets/Tiger.json"),
asset: VelloAssetHandle(asset_server.load("embedded://lottie/assets/Tiger.json")),
debug_visualizations: DebugVisualizations::Visible,
transform: Transform::from_scale(Vec3::splat(0.5)),
..default()
Expand Down
26 changes: 11 additions & 15 deletions examples/render_layers/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ struct BackgroundScene;
fn setup_gizmos(mut commands: Commands, mut config_store: ResMut<GizmoConfigStore>) {
// This camera can only see Gizmos.
commands.spawn((
Camera2dBundle {
camera: Camera {
// This camera will render LAST.
order: 1,
..default()
},
Camera2d,
Camera {
// This camera will render LAST.
order: 1,
..default()
},
RenderLayers::layer(3),
Expand All @@ -42,12 +40,10 @@ fn setup_gizmos(mut commands: Commands, mut config_store: ResMut<GizmoConfigStor

fn setup_scene(mut commands: Commands) {
commands.spawn((
Camera2dBundle {
camera: Camera {
// This camera will render first.
order: -1,
..default()
},
Camera2d,
Camera {
// This camera will render first.
order: -1,
..default()
},
RenderLayers::layer(1).with(2),
Expand All @@ -69,7 +65,7 @@ fn animation(
mut query_scene: Query<(&mut Transform, &mut VelloScene), With<AnimationScene>>,
time: Res<Time>,
) {
let sin_time = time.elapsed_seconds().sin().mul_add(0.5, 0.5);
let sin_time = time.elapsed_secs().sin().mul_add(0.5, 0.5);
let (mut transform, mut scene) = query_scene.single_mut();
// Reset scene every frame
*scene = VelloScene::default();
Expand All @@ -85,7 +81,7 @@ fn animation(
scene.fill(
peniko::Fill::NonZero,
kurbo::Affine::default(),
peniko::Color::rgb(c.x as f64, c.y as f64, c.z as f64),
peniko::Color::new([c.x, c.y, c.z, 1.]),
None,
&kurbo::RoundedRect::new(-50.0, -50.0, 50.0, 50.0, (sin_time as f64) * 50.0),
);
Expand All @@ -101,7 +97,7 @@ fn background(mut query_scene: Query<&mut VelloScene, With<BackgroundScene>>) {
scene.fill(
peniko::Fill::NonZero,
kurbo::Affine::default(),
peniko::Color::rgb(0.0, 0.0, 1.0),
peniko::Color::new([0.0, 0.0, 1.0, 1.0]),
None,
&kurbo::RoundedRect::new(-200.0, -200.0, 200.0, 200.0, 0.0),
);
Expand Down
Loading

0 comments on commit ae710fe

Please sign in to comment.