I just stumbled over a problem with FaceVertexCount, i get an invalid memory access.
A sample would be:
face0: 3 vertices
face1: 4 vertices
face2: 5 vertices
this results in a total IndexCount of 12
when adding that mesh declaration i get a invalid memory access (i use XAtlas in c# using swig).
After looking at the code i found this code:
|
polygon[i] = DecodeIndex(meshDecl.indexFormat, meshDecl.indexData, meshDecl.indexOffset, face * faceVertexCount + i); |
According to my understanding face * faceVertexCount + i seems to be a logic error. To explain:
This seems to calculate the offset/beginning of the indices of this face and add i. But the problem is that it assumes that all faces before also have the same faceVertexCount, which destroys the entire purpose of having faceVertexCount be an array in the first place.
Please correct me if i misunderstand the logik here, but i will provide a PR, which will change the logic here to a variable which will sum up the previous faceVertexCounts.
I just stumbled over a problem with FaceVertexCount, i get an invalid memory access.
A sample would be:
face0: 3 vertices
face1: 4 vertices
face2: 5 vertices
this results in a total IndexCount of 12
when adding that mesh declaration i get a invalid memory access (i use XAtlas in c# using swig).
After looking at the code i found this code:
xatlas/source/xatlas/xatlas.cpp
Line 9096 in f700c77
According to my understanding
face * faceVertexCount + iseems to be a logic error. To explain:This seems to calculate the offset/beginning of the indices of this face and add
i. But the problem is that it assumes that all faces before also have the same faceVertexCount, which destroys the entire purpose of having faceVertexCount be an array in the first place.Please correct me if i misunderstand the logik here, but i will provide a PR, which will change the logic here to a variable which will sum up the previous faceVertexCounts.