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

Add manifold_import_meshgl #434

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bindings/c/include/manifoldc.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ void manifold_export_options_set_material(ManifoldExportOptions *options,
ManifoldMaterial *mat);
void manifold_export_meshgl(const char *filename, ManifoldMeshGL *mesh,
ManifoldExportOptions *options);
ManifoldMeshGL *manifold_import_meshgl(void *mem, const char *filename,
int force_cleanup);

// memory size
size_t manifold_manifold_size();
Expand Down
8 changes: 8 additions & 0 deletions bindings/c/meshio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <conv.h>

#include "include/types.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -46,6 +48,12 @@ void manifold_export_meshgl(const char *filename, ManifoldMeshGL *mesh,
manifold::ExportMesh(std::string(filename), *from_c(mesh), *from_c(options));
}

ManifoldMeshGL *manifold_import_meshgl(void *mem, const char *filename,
int force_cleanup) {
auto m = manifold::ImportMesh(std::string(filename), force_cleanup);
return to_c(new (mem) manifold::MeshGL(m));
}

// memory size
size_t manifold_material_size() { return sizeof(manifold::Material); }

Expand Down