Replies: 5 comments 26 replies
-
|
Thank you! I know basically nothing about C, so would you mind answering a few noob questions? What high level languages are you looking to target? We already have bindings for JS and Python, and found no need for a C API. How does the C API make it easier? I do want this library to be as easily usable as possible, so a PR would be great; my main concern is that without the C knowledge I'm concerned I won't be able to test/maintain it well. Of course, open source is all about collaboration, so if you're interested in being involved longer-term that would make a huge difference. Also curious what @pca006132 thinks? Regarding Assimp - we're using the old version only because that's what's available on ubuntu 20.04 on our CI - we could probably just upgrade to 22 to solve this. |
Beta Was this translation helpful? Give feedback.
-
|
So I've got a project going on the OCaml side that I hope I'll be able to push along more soon. While that's coming along I should ask about whether something could be done about the biggest rough edge of the C bindings (as marked by a comment around the decompose functions). In order to know how many manifolds worth of memory must be allocated for the result of decompose, the entire method has to be run. Would you be open to breaking out a method that ends with providing the indices/number of independent meshes, and have another method that takes those as input so they don't need to be recalculated? I didn't end up doing anything myself yet since I wasn't sure of the cleanest way to go about it that wouldn't dirty up the API, but also make the methods readily available to the C bindings. |
Beta Was this translation helpful? Give feedback.
-
|
Another separate issue, I just tried to build with CUDA on for the first time, and I'm running into an issue building the C binding library (am able to build manifold itself with the python bindings fine). I think I've tracked it down to LevelSet and its function parameter that requires template arguments to work with CUDA. I tried replacing this: ManifoldMesh *manifold_level_set(void *mem, float (*sdf)(ManifoldVec3),
ManifoldBox *bounds, float edge_length,
float level) {
auto fun = [sdf](glm::vec3 v) { return (sdf(to_struct(v))); };
auto mesh = LevelSet(fun, *from_c(bounds), edge_length, level);
return to_c(new (mem) Mesh(mesh));
}
with this abomination to try and fool it: ManifoldMesh *manifold_level_set(void *mem, float (*sdf)(ManifoldVec3),
ManifoldBox *bounds, float edge_length,
float level) {
struct F {
float (*func)(ManifoldVec3);
__host__ __device__ float operator()(glm::vec3 v) const {
return (func(to_struct(v)));
}
F(float (*f)(ManifoldVec3)) : func(f){};
};
auto mesh = LevelSet(F(sdf), *from_c(bounds), edge_length, level);
return to_c(new (mem) Mesh(mesh));
}But of course it doesn't work, due to I guess what should have been obvious to me with the |
Beta Was this translation helpful? Give feedback.
-
|
I've run into a strange issue with build artifact linking in my OCaml bindings where Collider refused to be found. This is with bundling the archive in alongside all of the others generated in a build (none of the others gave me this issue). After trying what felt like everything, and making sure that the cmake setup for it was the same as utilities etc, I've given up and moved Not so much context I know, but any idea on why collider would be special? I don't think I missed anything obvious, but I'm tired of looking at it for now 😅. By the way, I've done the build with |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Out of a desire to be able to write OCaml bindings that will allow me to use Manifold as an alternative more "direct" backend for my mesh generation library OCADml (currently using OpenSCAD via OSCADml), I've begun work on some Manifold C bindings.
I've previously written OCaml bindings to the olm cryptographic library, which exposes a C API designed to facilitate binding from higher level languages, so I have tried to follow a similar pattern. Namely passing in memory allocated in the host language such that it can be managed appropriately.
I'm happy to open a PR as well, but I thought that I would link it here for some early feedback. It's been a while since I have written any C/C++!
Note:
I am using the export module, so the build should be run with:
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DMANIFOLD_EXPORT=ON .. && makeAlso, I was getting an error due to deprecation of
pbrmaterial.hso I made a couple small substitutions inmeshIO.cppto workaround it.Beta Was this translation helpful? Give feedback.
All reactions