pattern-x / gemini-viewer-examples

Examples and demos for gemini-viewer sdk, which is a WebGL based BIM model viewer, built on three.js. It is used to view dwg/dxf, gltf, obj, ifc models, etc.
205 stars 43 forks source link

can you give me the gemini-viewer.esm.min.js orginal code? #119

Closed dotoritos-kim closed 2 months ago

dotoritos-kim commented 1 year ago

How did you implement SolidHatch in DxfViewer?

I am amazed at the incredible performance.

I'm curious as to whether you did the triangulation separately or used another method.

I want to see the entire dxfviewer part. I am also a vargan/dxf-viewer contributor.

yanzexuan1 commented 1 year ago

Oh, thank you in the first place, because this project rely on dxf-viewer.

A solid hatch is a THREE.Mesh with color.

Performance is a big topic, we did much work to increase it, including merging objects/materials, instancing, bvh, simplify polygons, etc.

dotoritos-kim commented 1 year ago

When I gave you an example file, can you tell me what algorithms spline, solid hatch, and hatch work and how they work? Sorry if I was so rude.

yanzexuan1 commented 1 year ago

Np. Are you gonna share a example file, please go ahead. I'll try my best to tell everything you interested, I may not be able to share lots of code at this time.

For spline, we tried to generate a line that is no really accurate, otherwise, there are too many points. And we'll try to merge splines with the same color, layer, etc.

We also merge hatches if they have the same color, layer, etc.

dotoritos-kim commented 1 year ago

spline, hatch extream size example

I am curious about how a file containing splines and hatches of this large size is rendered. I want to know the overall flow and algorithm used.

yanzexuan1 commented 1 year ago

Ok, I opened the example filess, as we can see, there are about 715 entities, mostly are splines and hatches (and of course, some of them are in inserts). This is not a big number, but it contains complex splines and hatches. image

We defined a function drawSpline(), for spline entity, we can get these:

For hatch, there is drawHatch() function. we get:

Hope it help.