Skip to content

Commit 9c42932

Browse files
committed
Adding a delete step
1 parent e5c16eb commit 9c42932

1 file changed

Lines changed: 26 additions & 17 deletions

File tree

bindings/java/src/main/java/com/cadoodlecad/manifold/ManifoldBindings.java

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ private static void loadNativeLibrary(String libName, File cacheDirectory) throw
7777
needsCopy = devFile.lastModified() > libFile.lastModified();
7878

7979
if (needsCopy) {
80-
// if (devFile.exists()) {
81-
// java.nio.file.Files.copy(devFile.toPath(), libFile.toPath(),
82-
// java.nio.file.StandardCopyOption.REPLACE_EXISTING,
83-
// java.nio.file.StandardCopyOption.COPY_ATTRIBUTES);
84-
// libFile.setExecutable(true);
85-
// } else {
80+
// if (devFile.exists()) {
81+
// java.nio.file.Files.copy(devFile.toPath(), libFile.toPath(),
82+
// java.nio.file.StandardCopyOption.REPLACE_EXISTING,
83+
// java.nio.file.StandardCopyOption.COPY_ATTRIBUTES);
84+
// libFile.setExecutable(true);
85+
// } else {
8686
try (java.io.InputStream in = ManifoldBindings.class
8787
.getResourceAsStream("/manifold3d/natives/" + platform + "/" + fullName)) {
8888
if (in == null)
@@ -468,6 +468,15 @@ public ManifoldBindings(File cacheDirectory) throws Exception {
468468

469469
}
470470

471+
public void deleteMeshGL64(MemorySegment seg) {
472+
if (seg == null)
473+
return;
474+
try {
475+
functions.get("manifold_delete_meshgl64").invoke(seg);
476+
} catch (Throwable ignored) {
477+
}
478+
}
479+
471480
// Data structure
472481
public record MeshData64(double[] vertices, long[] triangles, int vertCount, int triCount) {
473482
}
@@ -594,7 +603,7 @@ private void loadVoid(String name, ValueLayout... argLayouts) {
594603
}
595604
}
596605

597-
// ===== Primitives =====
606+
// ===== Primitives =====
598607

599608
// ManifoldManifold* manifold_empty(void* mem);
600609
public MemorySegment empty() throws Throwable {
@@ -631,7 +640,7 @@ public MemorySegment cylinder(double height, double radiusLow, double radiusHigh
631640
center);
632641
}
633642

634-
// ===== Transformations =====
643+
// ===== Transformations =====
635644
// 4x4 matrix transform (12 doubles = 3x4 affine matrix, last row implied
636645
// 0,0,0,1)
637646
// Matrix layout: [x1 y1 z1]
@@ -689,7 +698,7 @@ public MemorySegment mirror(MemorySegment m, double nx, double ny, double nz) th
689698
return (MemorySegment) functions.get("manifold_mirror").invoke(mem, m, nx, ny, nz);
690699
}
691700

692-
// ===== Boolean operations =====
701+
// ===== Boolean operations =====
693702

694703
// ManifoldManifold* manifold_union(void* mem, ManifoldManifold* a,
695704
// ManifoldManifold* b);
@@ -741,7 +750,7 @@ public MemorySegment batchUnion(MemorySegment[] shapes) throws Throwable {
741750
}
742751
}
743752

744-
// ===== Info =====
753+
// ===== Info =====
745754

746755
// size_t manifold_manifold_size(); Should return 16 bytes
747756
public long manifoldSize() throws Throwable {
@@ -803,7 +812,7 @@ public long numProp(MemorySegment m) throws Throwable {
803812
return (long) functions.get("manifold_num_prop").invoke(m);
804813
}
805814

806-
// ===== Refine =====
815+
// ===== Refine =====
807816

808817
// ManifoldManifold* manifold_refine(void* mem, ManifoldManifold* m, int
809818
// refine); refine > 1
@@ -917,12 +926,12 @@ public MemorySegment[] split(MemorySegment a, MemorySegment b) throws Throwable
917926
}
918927

919928
// Placeholder
920-
// public MemorySegment[] decompose(MemorySegment m) throws Throwable {
921-
// MemorySegment mem = (MemorySegment) functions.get("manifold_alloc_manifold_vec").invoke();
922-
// MemorySegment vec = (MemorySegment) functions.get("manifold_decompose").invoke(mem, m);
923-
// TODO: Needs vector access functions to implement
924-
// return new MemorySegment[]{m};
925-
// }
929+
// public MemorySegment[] decompose(MemorySegment m) throws Throwable {
930+
// MemorySegment mem = (MemorySegment) functions.get("manifold_alloc_manifold_vec").invoke();
931+
// MemorySegment vec = (MemorySegment) functions.get("manifold_decompose").invoke(mem, m);
932+
// TODO: Needs vector access functions to implement
933+
// return new MemorySegment[]{m};
934+
// }
926935

927936
// Creates an independent copy (safe for boolean operations)
928937
// ManifoldManifold* manifold_copy(void* mem, ManifoldManifold* m);

0 commit comments

Comments
 (0)