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

feat: Backdrop (static backgrounds) component for CameraComponent #2787

Merged
merged 8 commits into from
Oct 3, 2023

Conversation

spydon
Copy link
Member

@spydon spydon commented Oct 2, 2023

Description

This PR adds a backdrop component to the CameraComponent which renders behind the world.
With this change the rendering order looks like this:

backdrop
world
viewport
viewfinder

In the following example you can see a ParallaxComponent attached to the backdrop, a player and some other components attached to the world, and some texts attached to the viewfinder and viewport:
image

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change. (Very minor, because not many add components to the viewfinder)

Migration instructions

If you were previously adding your HUDs directly to the viewfinder, add them to the viewport instead.

Related Issues

@spydon spydon changed the title fix!: Viewfinder children statically on top of the world fix!: Viewfinder children statically behind the world Oct 2, 2023
@ufrshubham
Copy link
Collaborator

@spydon, just a thought, what if let viewfinder + viewport both render on top of the world and use a separate parent for the background? Something like a world background component?

Just thinking in terms of a real-life camera, where UI elements of viewfinder are always displayed on top of the image that is being captured.

@spydon
Copy link
Member Author

spydon commented Oct 3, 2023

@spydon, just a thought, what if let viewfinder + viewport both render on top of the world and use a separate parent for the background? Something like a world background component?

Just thinking in terms of a real-life camera, where UI elements of viewfinder are always displayed on top of the image that is being captured.

Yeah, that might make more sense. Do you think the viewfinder should be affected by the transformations or not then?

@ufrshubham
Copy link
Collaborator

Do you think the viewfinder should be affected by the transformations or not then?

Making it behave similar to viewport should be fine I think.

@spydon spydon changed the title fix!: Viewfinder children statically behind the world feat: Backdrop (static backgrounds) component for CameraComponent Oct 3, 2023
@spydon
Copy link
Member Author

spydon commented Oct 3, 2023

@ufrshubham what do you think about this solution? :)

@ufrshubham
Copy link
Collaborator

Looks perfect! (until someone says otherwise 😉)

@spydon spydon enabled auto-merge (squash) October 3, 2023 17:17
@spydon spydon merged commit ab329f7 into main Oct 3, 2023
8 checks passed
@spydon spydon deleted the spydon/viewfinder-on-top branch October 3, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants