Vertices order when adding triangles.

Started by iguatemi, January 06, 2017, 06:46:35 PM

Previous topic - Next topic

iguatemi

What is the order in which the vertices are sorted to the object3d when using addTriangles?

For example, if I addTriangle(vertex1, vertex2, vertex3), will the vertices be stored in the mesh in the order vertex1, vertex2, vertex3? Is there some logic to it or is it case-by-case?

EgonOlsen

They should, but only if vertex sharing is disabled or all the vertices are unique. Personally, I wouldn't rely on such an assumption though, if I don't have to.

AGP

But we have to start from somewhere to solve the skinning issue (see the problem visually illustrated on the SkinData thread in Bones).

EgonOlsen

If it helps to solve whatever that issue is, then go ahead.

iguatemi

Thanks!

It actually worked disabling vertex sharing.

AGP

The second model we tested broke in spite of disabling vertex sharing (and besides, that would have been a costly "solution").

EgonOlsen

#6
Honestly, I've no idea what you are taking about. If you add the vertices without sharing, they will be added in the order in which you add them. That's all, no further magic involved. If something "breaks" (whatever that means in this context), then this isn't the reason. If you want to be 150% sure, just use the bulk constructor instead: , float[], float[], int[], int)]http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#Object3D(float[], float[], float[], int[], int)

Edit: Crappy Simplemachines forum can't handle this link for whatever reason, but I'm sure you'll be able to find it anyway.

AGP

I'll post a screenshot of what it means to break tomorrow. But you said so yourself not to rely on it. And besides, it will be costly not to share vertices, right?

iguatemi


EgonOlsen

No idea what causes this. I can only repeat myself. If you disable sharing, the vertices will be added in order. If you use the bulk constructor, you have even full control about the order. Everything else depends on what you are doing with the data, and I've no clue what that is...