mrk-its / bevy_webgl2

WebGL2 renderer plugin for Bevy game engine
MIT License
172 stars 46 forks source link

Update for bevy ecs v2 #31

Closed rparrett closed 3 years ago

rparrett commented 3 years ago

A work in progress.

Things seem to work, but I ran out of time and only fixed one of the examples for now.

Should be able to finish this up later tonight.

This should be good to go.

rparrett commented 3 years ago

Unfortunately, there seems to be an issue and some of the examples aren't working properly at the moment. I tested all the others and they seem fine.

sprite - not ok, nothing displayed breakout - not ok, only score displayed font_atlas_debug - panics

rparrett commented 3 years ago

Won't be able to work on this today, but I tried rebasing against the dev branch (locally) and this didn't seem to help the situation.

But the rebase was very painless.

Should this be pointed at that branch?

rparrett commented 3 years ago

Didn't get anywhere this morning, but observed that the reflected layout info! isn't happening in this PR (but that's true in the examples that do work as well)

rparrett commented 3 years ago

It looks like I had just falsely remembered the sprite flipping PR getting merged after ecs v2. Ignoring that would certainly cause issues with sprites showing up. Investigating.

edit: yup, that's the issue. Will fully implement sprite flipping in a bit.

rparrett commented 3 years ago

This is now rebased against/pointing at the dev branch.

rparrett commented 3 years ago

@mrk-its

Pinging you to let you know that I will likely need to abandon this work for now due to time constraints.

I've pushed my current efforts to get this working with bevy's new PBR stuff.

This puts this PR in a state where 2d stuff seems to work, but basically everything 3d is broken. It's broken in a way that shaders compile, there are no error messages or warnings, but we just get a grey screen.

I suspect that there's something flying over my head related to texture samplers, or perhaps the camera bindings.

rparrett commented 3 years ago

The issue seems related to camera bindings, or bindings in general.

I accidentally found that a simple change in utils.rs / reflect_layout seems to at least make some stuff show up in 3d_scene. I discovered this while attempting to add a BindingDescriptor to the CameraViewProj BindGroupDescriptor in the same function. (Which got me nothing but webgl errors)

if name == "CameraPosition" {
    continue;
}
rparrett commented 3 years ago

This is now working (thanks mockersf) but relies on https://github.com/bevyengine/bevy/pull/1798

rparrett commented 3 years ago

There are some lingering questions about whether the manual BindingDescriptor overrides in utils.rs are actually needed, and a few comments about a couple specific changes here: https://github.com/rparrett/bevy_webgl2/pull/1