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

modifiers: support nesting #698

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

NoTalkOnlyProx
Copy link

This PR improves/adds support for nested modifier structures in the voxel lod terrain tree.

These changes are not of particular importance to me (other than the ability to filter out terrain translation). I just happened to be in the area and noticed your TODO comment, and I thought this might be a good place to cut my teeth.

Slightly reformat the NOTIFICATION_LOCAL_TRANSFORM_CHANGED
handler inside voxel_modifier_gd. This will allow for my
next commit to be slightly cleaner.

Signed-off-by: NTOP <[email protected]>
Ignore transform update notifications that do
not actually alter the modifier's position in
terrain-local space.

Support modifiers as indirect children.

Switch to ENTER/EXIT_TREE notifications to
detect when intermediate ancestors are added
or removed from the terrain node.

Switch to NOTIFICATION_TRANSFORM_CHANGED to
detect when intermediate ancestor transforms
change.

Signed-off-by: NTOP <[email protected]>
Multiply modifier bounds transforms by the
terrain parent_transform so that modifier are
correctly rendered when the voxel terrain has
non-identity transform.

Signed-off-by: NTOP <[email protected]>
@NoTalkOnlyProx
Copy link
Author

oops. Sorry. I just noticed #555 and #558.

Time to review the other approach and make sure I didn't miss anything, I guess!

@NoTalkOnlyProx
Copy link
Author

NoTalkOnlyProx commented Sep 5, 2024

One thing I notice off the bat is that I did not implement this in my version:

void VoxelModifier::mark_as_immediate_child(bool v) {
		} break;
	_is_immediate_child = v;
	if (_is_immediate_child) {
		set_notify_local_transform(true);
		set_notify_transform(false);
	} else {
		set_notify_local_transform(false);
		set_notify_transform(true);
	}
}

I considered doing something essentially identical, but I decided that the performance gains (which if I am not mistaken aren't much?) were not worth cluttering the solution.

Please let me know if you disagree with that judgement, though!

@NoTalkOnlyProx
Copy link
Author

NoTalkOnlyProx commented Sep 5, 2024

That also appears to be the only substantive difference between our two PRs, other than a totally different approach to event handling

@Zylann
Copy link
Owner

Zylann commented Sep 10, 2024

I'm still not happy with the workarounds that Godot requires to make this work, it always makes it more expensive too. Just like the other PR, I'm not sure about merging this.
See also godotengine/godot#77937

@Zylann Zylann force-pushed the master branch 2 times, most recently from 8fdf450 to a393969 Compare October 5, 2024 04:12
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.

2 participants