cnr-isti-vclab / corto

Mesh compression library, designed for rendering and speed.
Other
196 stars 43 forks source link

ply files with quad faces #34

Closed Rabbid76 closed 2 years ago

Rabbid76 commented 2 years ago

The solution might be some kind of hack, however it solves the issue for me. PLY files with QUAD faces are not read correctly #32 It's up to you if you want to merge it, I'll use it anyway until you finally implement it.

ponchio commented 2 years ago

I used a slightly different approach: I tessellate the polygon (quad pentagon exagon etc) and just resize the index vector (instead of reserving twice the space required). whenever the listSize is > 3 This should also work with per wedge texture coordinates (even though didn't really tested it), and the number of triangle is recovered from the vector size anyway.

I added the u,v s,t coords following your code, and also vertex_index (seen in some .plys)

Could you test my code on your models?

P.S. there is some problem with the include folder to be fixed (sorry).

Rabbid76 commented 2 years ago

Hello, thank you for your quick reply. I tested the latest master, unfortunately it doesn't work for me. When I load the ASCII-ply from #32, I get a number of 70 faces (crt::MeshLoader::nface). However, the mesh only has 10 quad faces, so I'm expecting 20 triangular faces.

Here is the binary and ASCII version of the ply file:

plyfiles.zip

ponchio commented 2 years ago

The count for additional indexes was a bit off. Didn't notice because the extra indexes where all zeros and ignored by the encoder. Should be fixed now.

Rabbid76 commented 2 years ago

Thanks it works as intended now