james-j-obrien / bevy_vector_shapes

A library for rendering vector shapes using the Bevy game engine
Other
338 stars 23 forks source link

Bevy 0.15 support #49

Open rendaoer opened 3 days ago

musjj commented 2 days ago

Tried to migrate the codebase to 0.15, but I'm getting:

  In RenderPass::end
    In a set_pipeline command
      Render pipeline targets are incompatible with render pass
        Incompatible depth-stencil attachment format: the RenderPass uses a texture with format Some(Depth32Float) but the RenderPipeline with 'alpha_blend_shape_pipeline' label uses an attachment with format None

Not sure how to fix this.

james-j-obrien commented 2 days ago

I have a branch that compiles here, but is currently hitting a panic due to WindowCreated events not being registered, not sure exactly why that's happening.

I will try and find some time to work on it when I can, if anyone wants to pick it up where I left off feel free.

musjj commented 2 days ago

Thank you!

but is currently hitting a panic due to WindowCreated

I had the same problem and I fixed it by adding the bevy_window feature to the bevy dependency.

james-j-obrien commented 2 days ago

Ok great, I fixed that and the depth stencil issue, just checking examples.

james-j-obrien commented 2 days ago

Only canvases appear to be broken now.

james-j-obrien commented 2 days ago

Ah, it's because of the retained render world changes, I need a way to get the view's entity from it's MainEntity.

james-j-obrien commented 2 days ago

I'm releasing a compatibility patch for 0.15 in #50.

Still needs a refactor to switch to required components, should be pretty straightforward if anyone wants to take a pass at it, otherwise I'll get it to once my schedule is more open.

musjj commented 2 days ago

Thank you for the fast patch!

About required components, I'm also trying to figure out how to re-design ShapeBundle with required components, but I'm not quite sure how it should look like.

Because we have this ShapeConfig, whose data will then flow into the ShapeMaterial, ShapeFill and Transform components (using the bundle constructor). I wonder how this should be re-designed around required components while keeping things ergonomic.

james-j-obrien commented 2 days ago

The ShapePainter and ShapeCommands API surface should be able to stay the same, internally any entities that ShapeCommands create will just have all of the expected components set even if they aren't technically a bundle.

Components like Transform that are currently set via SpatialBundle can be marked as required instead, ShapePainter/Commands will still set them automatically but if you were to spawn a shape from it's components directly it should become much more ergonomic. For example, theoretically, I should be able to do:

 commands.spawn(RectangleComponent { size: Vec2::new(10.0, 10.0) , ..default() });

and get a rectangle rendering. (although to be fair since the API currently doesn't expect you to interact with the components at all they don't have particularly good constructors or names, a good step is just getting rid of deprecation warnings)

Most of the deprecation warnings are about internal usage of bundles which can easily be refactored into setting the correct components, or use of bundles in examples which are also trivial refactors.