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

Optimize mesh generation by preventing unneeded shape recalculations #99498

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

Conversation

carsonetb
Copy link

Currently whenever a value of a PrimitiveMesh is set in GDScript it will completely regenerate the entire mesh. This is fine in most cases, but in the case that the set variable is the same as the current variable (p_radius == radius), there's no need to regenerate the mesh. In some cases we could get a big performance boost by just returning the function if the set variable is the same as the current one.

This PR fixes #99414

@carsonetb carsonetb requested review from a team as code owners November 21, 2024 15:28
@Calinou Calinou added bug topic:rendering topic:3d performance cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release labels Nov 21, 2024
@Calinou Calinou added this to the 4.4 milestone Nov 21, 2024
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally, it works as expected with all primitive mesh types.

Code looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release performance topic:rendering topic:3d
Projects
None yet
2 participants