Skip to content

Refactor MeshHelper #335

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

Merged
merged 4 commits into from
Aug 9, 2025
Merged

Refactor MeshHelper #335

merged 4 commits into from
Aug 9, 2025

Conversation

isHarryh
Copy link
Contributor

Summary

This PR does some improvements to MeshHelper.

  1. Making flat_list_to_tuples an inline function.
  2. Introduces the lists_to_tuples function to fix the type error that List[List] produced by the zeros function cannot be assigned to tuple-member-lists such as List[Tuple3f] List[Tuple4f].
  3. Refactors the get_triangles function.
    1. Changes the way to generate triangles lists.
    2. Adds a indexCount fix for TriangleStrip submeshes, see AssetStudio's code.
    3. Removes the TODOs in the get_triangles function (I have tested that using NumPy as_strided function cannot realize a speed-up).

Copy link
Owner

@K0lb3 K0lb3 left a comment

Choose a reason for hiding this comment

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

see comments

@isHarryh
Copy link
Contributor Author

isHarryh commented Aug 2, 2025

Quite good points! All resolved.

In order to solve type issues and make the code more readable, I had changed the triangle list-assign to list-append, but making it ~5% slower, very stupid haha. Now reverted to list-assign style.

@isHarryh isHarryh requested a review from K0lb3 August 2, 2025 02:10
K0lb3
K0lb3 previously approved these changes Aug 9, 2025
@K0lb3 K0lb3 merged commit 677cc6e into K0lb3:master Aug 9, 2025
5 checks passed
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