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

[BUG] find_best_vertex_spilt in tmf_exporter.rs panics if best_split_index is the last vertex #22

Open
dbartussek opened this issue Jun 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@dbartussek
Copy link

The find_best_vertex_split function iterates over all vertices:

for (index, vertex) in vertices.iter().enumerate() {

However, immediately after the loop, there is an assertion that best_split_index may not be the last vertex:

assert!(best_split_index < vertices.len() - 1);

While testing file sizes of different formats, I've encountered a model that apparently meets this edge case, resulting in an assertion error.

This is the mesh I am trying to export. It's the dragon sample model from the official glTF samples with computed tangents, run through meshopt: dragon.zip

@dbartussek dbartussek added the bug Something isn't working label Jun 17, 2024
@FractalFir
Copy link
Owner

FractalFir commented Jun 20, 2024

It was a stupid logic error. The assertion was supposed to check that the algo never returns Some(last_index). I moved the assertion to the Some-returning arm of the if statement.

Should be fixed in 0.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants