-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Update xatlas to upstream 5571fc7, fixes #44017 #44023
Update xatlas to upstream 5571fc7, fixes #44017 #44023
Conversation
@Calinou I can change this to a .patch, but I'm not sure if this is the actual the answer. If anyone else has any knowledge of whats going on here I'd love some insight. In the 3.x branch this fix works, the output can be opened in Godot and it looks fine. But in 4.0 it looks broken, at least the textures aren't loading correctly. Which I don't know if that is related to the original bug or not. |
c1536c4
to
e1cd526
Compare
Ah okay, I think the real fix here is to take the latest from The static Vector3 normalize(const Vector3 &v)
{
const float l = length(v);
XA_DEBUG_ASSERT(l > 0.0f); // Never negative.
const Vector3 n = v * (1.0f / l);
XA_DEBUG_ASSERT(isNormalized(n));
return n;
} instead of: static Vector2 normalize(const Vector2 &v, float epsilon)
{
float l = length(v);
XA_DEBUG_ASSERT(!isZero(l, epsilon));
XA_UNUSED(epsilon);
Vector2 n = v * (1.0f / l);
XA_DEBUG_ASSERT(isNormalized(n));
return n;
} This PR updates xatlas to 5571fc7ef0d06832947c0a935ccdcf083f7a9264, which is the current head of their master. |
e1cd526
to
c431b19
Compare
There's a reasonable assumption that we don't have to go through a regression test suite to test if things broke for xatlas, but we probably should.. Would like to merge for wider testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fire if you wouldn't mind, there is one line of the change that I had to make that I didn't fully understand. I started a review of it. The function signature changed, and the ParameterizeOptions
type was removed from xatlas. So I took a crack at getting it to compile just test my theory. But I don't totally understand what it was supposed to be doing on this line.
|
||
printf("Generate..\n"); | ||
xatlas::Generate(atlas, chart_options, xatlas::ParameterizeOptions(), pack_options); | ||
xatlas::Generate(atlas, chart_options, xatlas::PackOptions()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someone who knows more than me, I don't fully understand this change. It made it build, but someone should check my work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using:
pack_options.maxChartSize = 4096;
pack_options.blockAlign = true;
pack_options.padding = 1;
pack_options.texelsPerUnit = 1.0 / p_texel_size;
You set it to the default. This is arguably a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want xatlas::Generate(atlas, chart_options, pack_options);
Could you amend the commit log to be more explicit about the change? It's true that your intent is to fix #44017, but what the commit does first and foremost is updating xatlas (which changes a lot of things, including a change that happens to fix #44017). So a better commit log would be:
Please also update the commit hash for xatlas in |
c431b19
to
0b3b2bb
Compare
Fixes godotengine#44017 by changing the `normalize()` function to check for non-negative rather than non-zero via an epsilon check.
0b3b2bb
to
23c7543
Compare
@akien-mga updated the commit log and the README |
Thanks! |
Cherry-picked for 3.2.4. |
Fixes a crash where the cross product's length is smaller than the epsilon value.
Fixes #44017.