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

refactor/simplify_empty_chunks_usage #53

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

piellardj
Copy link
Member

refactor: allow simplied input object for empty chunks

The VoxelmapViewer.enqueuePatch method now takes as input as VoxelsChunkData which is:

type VoxelsChunkDataEmpty = {
    readonly size: THREE.Vector3;
    readonly isEmpty: true;
};
type VoxelsChunkDataNotEmpty = {
    readonly size: THREE.Vector3;
    readonly data: Uint16Array;
    readonly dataOrdering: VoxelsChunkOrdering;
    readonly isEmpty: false;
};
type VoxelsChunkData = VoxelsChunkDataEmpty | VoxelsChunkDataNotEmpty;

which means if a chunk is empty, there is no need to send a big Uint16Array full of zeroes.

Also improve performance when processing those empty chunks.

@piellardj piellardj requested a review from Sceat November 4, 2024 21:00
@piellardj piellardj self-assigned this Nov 4, 2024
@Sceat
Copy link
Member

Sceat commented Nov 5, 2024

/merge

Copy link

github-actions bot commented Nov 5, 2024

Success! Fast forwarded master to refactor/simplify_empty_chunks_usage! git checkout master && git merge refactor/simplify_empty_chunks_usage --ff-only

@github-actions github-actions bot merged commit 0a8f719 into master Nov 5, 2024
2 checks passed
@piellardj piellardj deleted the refactor/simplify_empty_chunks_usage branch November 17, 2024 18:50
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