xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
728 stars 287 forks source link

GLTF loaders do not accept lines nor points, breaks XKT conversion #364

Closed Francois-Thierry closed 2 years ago

Francois-Thierry commented 4 years ago

Hello Lindsay, First of all thanks again for the amazing work on xeokit !

SUMMARY

I tried to use GLTF models that are composed (or partially composed) of lines objects and they don't show in the viewer. Also the XKT conversion doesn't work on those files.

INVESTIGATION

I saw that in ReadableGeometry.js, all kind of geometry primitives are considered ('points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan' - defaulting to 'triangles') https://github.com/xeokit/xeokit-sdk/blob/master/src/viewer/scene/geometry/ReadableGeometry.js#L155 But then I looked into the GLTF loaders and saw that only triangles (meshes primitives mode 4) are supported. https://github.com/xeokit/xeokit-sdk/blob/master/src/plugins/GLTFLoaderPlugin/GLTFPerformanceLoader.js#L468 https://github.com/xeokit/xeokit-sdk/blob/master/src/plugins/GLTFLoaderPlugin/GLTFQualityLoader.js#L598

ILLUSTRATION

bitmap

It would be awesome for us to be able to use all kinds of GLTF geometry primitives in xeokit (and of course be able to convert them to XKT). Below you will find the GLTF file to reproduce the problem, I could also provide you with a GLTF with points primitives if needed.

gridtest-1.txt

Amoki commented 4 years ago

IFC 4x2 starts using lines a lot more for rails, bridges or tunnels and their support in IfcOpenShell is on the way. It could be awesome to xeokit to support IFC 4x2