vagran / dxf-viewer

DXF 2D viewer written in JavaScript
Mozilla Public License 2.0
290 stars 86 forks source link

How to preserve / depict depth-information #101

Open MartinPyka opened 6 months ago

MartinPyka commented 6 months ago

With a couple of modifications in DxfViewer (https://github.com/vagran/dxf-viewer/issues/99) I got perspective rendering and 3d rotation working. Now I am wondering where the depth information are omitted in the parsing process.

When I look at line.js and ParseHelper.js I get the impression that everything should work just fine. I cannot really figure out where exactly the information get lost. Can you give me an advice?

vagran commented 6 months ago

For example, 3DFace vertices, x/y stored only: https://github.com/vagran/dxf-viewer/blob/b7c14a68a78aac9e116b3f6762c026c63392148f/src/DxfScene.js#L785

Vertices accumulation: https://github.com/vagran/dxf-viewer/blob/b7c14a68a78aac9e116b3f6762c026c63392148f/src/DxfScene.js#L2151

Also see all 2D transforms in this file.

Shader code assumes 2D coordinates and transforms in buffers: https://github.com/vagran/dxf-viewer/blob/b7c14a68a78aac9e116b3f6762c026c63392148f/src/DxfViewer.js#L564