hansihe/voxel_worldgen

Add support for native C types so that other languages can use this project

Opened this issue · 2 comments

I'm interesting in writing bindings for voxel_worldgen inside Node, so that people can use this excellent and efficient worldgen inside of their JavaScript projects. However, the datatypes that you are using in this project are not compatible with and of the C types that node's ffi can handle. Do you have any ideas on how I could implement the Vec and Vec3 datatypes inside of Node so that I can use the generate_chunk function? Or, could this project add support for functions that return standard C types. That way, other projects that need Minecraft world generation can generate worlds easily, and quickly.

This project is just a library crate, and does not export any C functions by itself. I could, and probably will make a separate crate to export certain functions to make it easier for people to use this in their own projects.

If you want to write a binding to Node however, I would suggest using the excellent Neon project. This would enable you to write the bindings in Rust, without dropping down to C, thus making things easier and safer.

I am in the #mcdevs IRC channel if you want to discuss anything more informally.

A package is created and published on npm, https://www.npmjs.com/package/voxel-worldgen.

Leaving the issue open for C api.