|
5 | 5 | import org.junit.jupiter.api.io.TempDir; |
6 | 6 |
|
7 | 7 | import com.cadoodlecad.manifold.ManifoldBindings; |
| 8 | +import com.cadoodlecad.manifold.ManifoldBindings.MeshData64; |
8 | 9 |
|
9 | 10 | import java.io.File; |
10 | 11 | import java.lang.foreign.MemorySegment; |
@@ -130,6 +131,32 @@ private java.lang.foreign.MemorySegment assertStlRoundTrip(java.lang.foreign.Mem |
130 | 131 |
|
131 | 132 | return reimported; |
132 | 133 | } |
| 134 | + |
| 135 | + @Test |
| 136 | + public void testMeshGL64() throws Throwable{ |
| 137 | + java.lang.foreign.MemorySegment cube = makeCube(); |
| 138 | + MemorySegment loaded=null; |
| 139 | + try { |
| 140 | + assertMeshValid(cube, "Cube"); |
| 141 | + // A cube has 8 vertices and 12 triangles (6 faces × 2) |
| 142 | + assertEquals(8, mb.numVert(cube), "Cube should have 8 vertices"); |
| 143 | + assertEquals(12, mb.numTri(cube), "Cube should have 12 triangles"); |
| 144 | + |
| 145 | + MeshData64 meshgl = mb.exportMeshGL64(cube); |
| 146 | + double[] verts = meshgl.vertices(); // flat [x0,y0,z0, x1,y1,z1, ...] |
| 147 | + long[] tris = meshgl.triangles(); // flat [i0,i1,i2, i3,i4,i5, ...] |
| 148 | + int triCount = meshgl.triCount(); |
| 149 | + loaded = mb.importMeshGL64(verts, tris, triCount, triCount); |
| 150 | + |
| 151 | + MeshData64 meshglLoaded = mb.exportMeshGL64(loaded); |
| 152 | + double[] vertsl = meshglLoaded.vertices(); // flat [x0,y0,z0, x1,y1,z1, ...] |
| 153 | + long[] trisl = meshglLoaded.triangles(); // flat [i0,i1,i2, i3,i4,i5, ...] |
| 154 | + int triCountl = meshglLoaded.triCount(); |
| 155 | + } finally { |
| 156 | + mb.safeDelete(cube); |
| 157 | + mb.safeDelete(loaded); |
| 158 | + } |
| 159 | + } |
133 | 160 |
|
134 | 161 | /** |
135 | 162 | * Round-trip a manifold through 3MF: |
|
0 commit comments