Entire scene is not rendered if the origin is not visible
question
Since upgrading my project to Bevy 0.18 my VelloScene2d disappears as soon as I pan the camera enough so that the origin is out of view. I made a minimal example that demonstrates this:
```rust
use bevy::input::keyboard::KeyCode;
use bevy::prelude::*;
use bevy_vello::{VelloPlugin, prelude::*};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(VelloPlugin::default())
.add_systems(Startup, setup)
.add_systems(Update, (draw_scene, update_camera))
.run();
}
fn setup(mut commands: Commands) {
commands.spawn((Camera2d, VelloView));
commands.spawn(VelloScene2d::new());
}
fn draw_scene(scene: Single<&mut VelloScene2d>) {
let mut scene = scene.into_inner();
scene.reset();
scene.fill(
peniko::Fill::NonZero,
kurbo::Affine::default(),
peniko::Color::new([1.0, 0.0, 0.0, 1.0]),
None,
&kurbo::RoundedRect::new(-100.0, -100.0, 100.0, 100.0, 30.0),
);
}
fn update_camera(
time: Res<Time>,
keyboard_input: Res<ButtonInput<KeyCode>>,
mut camera_transform: Single<&mut Transform, With<Camera2d>>,
) {
let move_x = keyboard_input.pressed(KeyCode::KeyA) as i32 * -1
+ keyboard_input.pressed(KeyCode::KeyD) as i32;
let move_y = keyboard_input.pressed(KeyCode::KeyS) as i32 * -1
+ keyboard_input.pressed(KeyCode::KeyW) as i32;
camera_transform.translation.x += move_x as f32 * time.delta_secs() * 500.0;
camera_transform.translation.y += move_y as f32 * time.delta_secs() * 500.0;
}
```
And here is a video of it:
https://github.com/user-attachments/assets/8c6c86ca-ef03-4b32-be88-3b4b7ca0e8fa
2 条评论