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

Water body auto clip-include #912

Merged
merged 7 commits into from
Dec 15, 2021
Merged

Water body auto clip-include #912

merged 7 commits into from
Dec 15, 2021

Conversation

huwb
Copy link
Contributor

@huwb huwb commented Sep 19, 2021

Make waterbody automatically clip-include

If clipping is enabled and clipping set to remove everything by default, then the waterbody ensures its area is clip-included.

This seems good to me, but needs the ocean lifetime stuff to ensure OnEnable is called after the OceanRenderer.

No urgency on this so ill just park it here.

NOTE: Just realised i created it against master instead of local-water-body. I'm guessing the life cycle stuff won't merge soon so this is probably fine, but review-by-commit is necessary, just the last one is relevant.

@huwb huwb requested a review from daleeidd September 19, 2021 12:39
@huwb huwb mentioned this pull request Sep 19, 2021
8 tasks
@daleeidd
Copy link
Collaborator

Nice! An option to disable auto clipping will be useful. Currently if I want to create a sphere, I will have to clip it with a box and then unclip it again with a sphere.

@huwb
Copy link
Contributor Author

huwb commented Oct 14, 2021

You mean you are setting to clip everything by default, then adding a box to include, then a sphere to cut out again?

@daleeidd
Copy link
Collaborator

You mean you are setting to clip everything by default, then adding a box to include, then a sphere to cut out again?

Image below will help. I want to clip by default, and then use a sphere to include water. And use the water body too. I would have to undo the clipping the water body adds to accomplish this.

1231313

@huwb
Copy link
Contributor Author

huwb commented Oct 14, 2021

Yeah fair point added now

Also merged master so that diff is not horrendous

Copy link
Collaborator

@daleeidd daleeidd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a couple of things.

crest/Assets/Crest/Crest/Scripts/WaterBody.cs Show resolved Hide resolved
crest/Assets/Crest/Crest/Scripts/WaterBody.cs Outdated Show resolved Hide resolved
@huwb huwb requested a review from daleeidd October 31, 2021 13:38
Copy link
Collaborator

@daleeidd daleeidd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work.

Copy link
Collaborator

@daleeidd daleeidd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this but the execution order will need to be after the ocean for it to work in builds. And release notes if you want. Can merge after that is done.

@daleeidd daleeidd force-pushed the feature/water-body-auto-clip branch from 88eb113 to c2dfdf7 Compare November 13, 2021 08:07
Copy link
Collaborator

@daleeidd daleeidd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did the last review items. Ready to merge when you're ready.

@daleeidd daleeidd added this to the 4.14 milestone Nov 13, 2021
@daleeidd daleeidd modified the milestones: 4.14, 4.15 Nov 18, 2021
@daleeidd
Copy link
Collaborator

@huwb happy to resolve release note conflict and merge if you're fine with everything.

@huwb
Copy link
Contributor Author

huwb commented Dec 11, 2021

thanks for bumping

what is the requirement for the update order? i'm not super against it but just curious if we can avoid it. the update order adds implicit dependencies between parts of the code which are not documented and can break, so previously i did a push to minimise the use of update orders.

perhaps an alternative is to call our own update function on all waterbodies from the OceanRenderer component. however im aware this is editor code and maybe not worth it. but it might be good to record what the update order dependence is in a comment.

@daleeidd
Copy link
Collaborator

what is the requirement for the update order?

The Update method is stripped from builds. So this feature will only get triggered from OnEnable in builds which is execution order dependent on OR.

but it might be good to record what the update order dependence is in a comment.

Done.

perhaps an alternative is to call our own update function on all waterbodies from the OceanRenderer component.

Agreed. Going to look at doing that next. I am considering using C# delegates or would you prefer we maintain our own registry and call directly?

@huwb
Copy link
Contributor Author

huwb commented Dec 12, 2021

Ohh it's OnEnable. I guess this is part of the same update issue we're discussing oh the other pr that ensures events get called at the right times when OR enabled/disabled. Do you know which PR I mean? I'll see if I can find it after posting this.

@huwb
Copy link
Contributor Author

huwb commented Dec 12, 2021

Ok yeah #629 . ideally we could converge that rather than workaround it here. I'll try to reply there shortly.

I'd be fine with the changes as is in the meantime - using update order - but would be good to revert once #629 merges. or we could try to get #629 done first.

huwb and others added 7 commits December 15, 2021 05:43
If clipping is enabled and clipping set to remove everything
by default, then the waterbody ensures its area is clip-included.

This seems good to me, but needs the ocean lifetime stuff
to ensure OnEnable is called after the OceanRenderer
@daleeidd daleeidd force-pushed the feature/water-body-auto-clip branch from fd1c7f8 to 701656c Compare December 15, 2021 13:46
@daleeidd daleeidd merged commit 50cdfa8 into master Dec 15, 2021
@daleeidd daleeidd deleted the feature/water-body-auto-clip branch May 19, 2022 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants