FractalFir / FractalFir/tmf

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

Open
#22 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
118
Forks
8
PR merge metrics
No merged PRs in 30d

Description

The find_best_vertex_split function iterates over all vertices:
https://github.com/FractalFir/tmf/blob/9c5f61ba037fa65a1edba7ffcb7e615e14831ca8/src/tmf_exporter.rs#L319

However, immediately after the loop, there is an assertion that best_split_index may _not_ be the last vertex:
https://github.com/FractalFir/tmf/blob/9c5f61ba037fa65a1edba7ffcb7e615e14831ca8/src/tmf_exporter.rs#L339

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](https://github.com/KhronosGroup/glTF-Sample-Models/blob/main/2.0/DragonAttenuation/glTF-Binary/DragonAttenuation.glb) with computed tangents, run through meshopt: [dragon.zip](https://github.com/user-attachments/files/15876914/dragon.zip)

Contributor guide

Open the contributing guide

Research direction

Start in src/tmf_exporter.rs at find_best_vertex_split, especially the vertex loop and the assertion after it. Reproduce with the supplied dragon.zip model and verify that exporting it no longer panics when best_split_index is the last vertex.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.