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

Expose chunk #21

Closed
wants to merge 2 commits into from
Closed

Expose chunk #21

wants to merge 2 commits into from

Conversation

aligator
Copy link
Contributor

Exposes the chunk information and also the generate_chunk_mesh function, useful for collider generation.
As I am not sure yet how to expose this the best way, it is a WIP for now...

This function can be used to generate custom meshes out of the chunk voxels.
@splashdust
Copy link
Owner

Like you mentioned in the discussions thread, the full bevy mesh is most likely overkill when you only want to generate colliders. You may also be better off using greedy meshing to reduce the number of vertices in the collider.

Another use-case I can imagine, would be custom meshing. Let's say you want to generate AO differently, or add your own vertex attributes, or even use a different algorithm altogether, such as marching cubes.

So, I think it would be better to let generate_chunk_mesh remain private and instead provide a way to override it.

For the use-case of generating colliders, though, it should be enough to simply expose the ChunkData struct and let the mesh building happen entirely on the consuming side. But since ChunkData was originally intended to be private, it would be a good idea to sanitise it a bit first. For example, all the fields should probably not be pub. Marking them as pub(crate) and then provide accessor methods in the impl would be better for API stability I think.

Then, to generate the collider mesh you would instead use block_mesh_rs the same way as bevy_voxel_world, but without all the extra stuff related to textures and ambient occlusion.

@splashdust
Copy link
Owner

Closing this PR, as ChunkData is now public since https://github.com/splashdust/bevy_voxel_world/releases/tag/0.10.2

@splashdust splashdust closed this Dec 22, 2024
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