Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bevy v0.15.0 #87

Merged
merged 28 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
89fbbed
Upgrade bevy to v0.15.0 and fix build
egenard Dec 10, 2024
6ca6446
Fix examples with default features build
egenard Dec 10, 2024
a93689c
build: remove unused file
simbleau Dec 11, 2024
a6fc8d6
fix: lint
simbleau Dec 11, 2024
c00e61f
build: add common API derives
simbleau Dec 11, 2024
f9ef95f
fix: lints
simbleau Dec 11, 2024
9745cea
fix: use .id()
simbleau Dec 11, 2024
01a82e2
fix: dotLottie features
simbleau Dec 11, 2024
24edfaa
fix: unnecessary mut
simbleau Dec 11, 2024
47ec0f0
refactor: style on setup_ss_rendertarget
simbleau Dec 11, 2024
cbc7c9b
fix: lint
simbleau Dec 11, 2024
512de03
refactor: remove required components from bundles
simbleau Dec 11, 2024
4f5fbf2
Implement Deref for VelloAssetHandle
egenard Dec 11, 2024
838c968
Fix lottie theme color setting
egenard Dec 11, 2024
e5f48bb
Fix redundant Deref impl
egenard Dec 11, 2024
140060b
build: update closer with velato fork
simbleau Jan 28, 2025
30dc935
fix: more examples, clippy lints
simbleau Jan 28, 2025
987aa93
fix: transparency
simbleau Jan 28, 2025
bfe188f
fix: add back whitespace
simbleau Jan 28, 2025
8742d6e
fix: use alpha blending
simbleau Jan 28, 2025
f6546ca
fix: add `TemporaryRenderEntity` marker
simbleau Jan 29, 2025
d9f170a
fix: resizing the window
simbleau Jan 29, 2025
90469e9
fix: pixel scale
simbleau Jan 29, 2025
f783857
build: use velato 0.5.0
simbleau Feb 2, 2025
16dddce
fix: color remapping
simbleau Feb 2, 2025
7f2e8d1
docs: update README, changelog
simbleau Feb 2, 2025
5ab5c10
fix(ci): install deps
simbleau Feb 2, 2025
f9504eb
ci: update apt-get
simbleau Feb 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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