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

Allow iterating over VoxelPalletes #667

Closed
RiscadoA opened this issue Oct 4, 2023 · 0 comments · Fixed by #723
Closed

Allow iterating over VoxelPalletes #667

RiscadoA opened this issue Oct 4, 2023 · 0 comments · Fixed by #723

Comments

@RiscadoA
Copy link
Member

RiscadoA commented Oct 4, 2023

Problem

Currently iterating over palettes is very error prone considering that uint16_t are used as indices, and that its possible that a palette has a material on the last uint16_t value. Thus, VoxelPalette::size() returns the number of materials excluding the empty material (0). We end up having multiple places implementing a weird looking iteration.

Solution

Implement a VoxelPalette::Iterator and use it everywhere which iterates over it, in order to write the cursed logic only once.

@RiscadoA RiscadoA added A-Engine B-Voxels S-Triage Issues whose priority still has to be figured out labels Oct 4, 2023
@RiscadoA RiscadoA removed the S-Triage Issues whose priority still has to be figured out label Oct 15, 2023
@RiscadoA RiscadoA added this to the 0.1 Jammable Engine milestone Oct 15, 2023
@roby2014 roby2014 linked a pull request Oct 16, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants