floooh / oryol-samples

Oryol extension module samples
MIT License
82 stars 16 forks source link

Conversion of STEP (.STP) cad file to .omsh or .orb #9

Open ivandrodri opened 6 years ago

ivandrodri commented 6 years ago

Hi, I am trying to write a 3D rendering application with oryol following the MeshViewer and the OrbViewer examples, but as my input surfaces are .STP (CAD files) files I would like to know if it is better to work with the MeshViewer or with the OrbViewer formats, i.e. should I use the oryol-conv3D.exe or the oryol-export.exe programs? Also, is there some documentation about how to write a converter for oryol from scratch?

Thanks in advance for any help/suggestions !!

floooh commented 6 years ago

The .orb file format (https://github.com/floooh/oryol-fileformats/blob/master/OrbFileFormat.h) and oryol-conv3d tool (https://github.com/floooh/oryol-tools/tree/master/src/oryol-conv3d) are the 'new' and recommended way to get 3D data into Oryol.

The .orb file format not only supports geometry data (like the old omsh format), but also node hierarchy, materials, animation and character skeleton data. It's also very easy and fast to load.

The idea of the oryol-conv3d tool is that new input formats only require a loader which loads a file format into an "IRep" object (https://github.com/floooh/oryol-tools/blob/master/src/oryol-conv3d/IRep.h), and the 'rest' of the tool can then process this IRep object further (for instance remove certain types of data), and finally save it to an .orb file.

Unfortunately there's currently only one example loader, to load data from a proprietary .n3 file format. I have started but not finished an assimp loader. The interesting part is the N3Loader::ToIRep function here: https://github.com/floooh/oryol-tools/blob/master/src/oryol-conv3d/N3Loader.cc#L468

Hope this helps as a start :)