Online3DViewer icon indicating copy to clipboard operation
Online3DViewer copied to clipboard

Is there a template to develop new importers?

Open jumpjack opened this issue 3 years ago • 5 comments

I am working to an importer/converter for the ancient format .VST for VISTA software; how could I add it to Online3dViewer, once ready? Is there a template to start from, or a tutorial?

I started with VisualBasic but now I am porting to JS.

jumpjack avatar Jun 20 '22 07:06 jumpjack

There are two components here:

  • Your importer in a separate repository.
    • You should make it available as a node.js package with a browser-ready bundle.
    • The best way is to make it able to generate a three.js compatible json file, so you can use the ConvertThreeGeometryToMesh function when implementing the importer in the viewer.
  • The importer in Online 3D Viewer:
    • See this document for details: https://github.com/kovacsv/Online3DViewer/wiki/Implement-a-New-Importer.
    • It should reference your importer with the LoadExternalLibrary call.
    • The result json can be easily converted to the internal model format.

Further readings:

  • Architectural documentation: https://github.com/kovacsv/Online3DViewer/wiki/Architectural-Documentation
  • Rhino importer for reference: https://github.com/kovacsv/Online3DViewer/blob/master/source/engine/import/importer3dm.js

kovacsv avatar Jun 20 '22 17:06 kovacsv

Unfortunately I am not a node.js programmer, isn't it possible to add a pure-javascript (browser-side) converter?

jumpjack avatar Jun 20 '22 17:06 jumpjack

You can implement your own importer as a pure js library, and if it's ready I'm happy to help with the integration.

kovacsv avatar Jun 20 '22 18:06 kovacsv

I am just at the beginning, I'll keep you informed. What should it return? An array of vertex? An object?

jumpjack avatar Jun 20 '22 20:06 jumpjack

The easiest is if you use this format: https://github.com/mrdoob/three.js/wiki/JSON-Geometry-format-4

kovacsv avatar Jun 24 '22 14:06 kovacsv