Writing gltf in Java

Hello. New to three.js and all that. I have become the maintainer of 20 year old Java code which includes 3D drawing originally done in Java3D which I am now converting to three.js. A typical drawing comprises ~30,000+ triangles, all defined in Java. I need to send these triangle vertices and normals over to a three.js application, which I assume means writing in Java and reading in JavaScript. Plain ASCII is doable but onerous and time consuming. Is there any way to write gltf format in Java? Better yet, binary gltf. Any examples? Thank you.

I haven’t used these myself, but JglTF is probably the place to start: GitHub - javagl/JglTF: Java libraries related to glTF.

If it’s just triangle vertices and normals, and not materials or a scene graph or much else, it’s probably also easy to put wrote into two buffers or JSON arrays and then load them both with the JavaScript fetch() API, constructing a THREE.BufferGeometry from that.