Closed wahn closed 5 years ago
On the C++ side we can set a breakpoint here (in src/shapes/plymesh.cpp
):
B+ │285 return CreateTriangleMesh(o2w, w2o, reverseOrientation,
│286 context.indexCtr / 3, context.indices,
│287 vertexCount, context.p, nullptr, context.n,
│288 context.uv, alphaTex, shadowAlphaTex,
>│289 context.faceIndices);
At that point we have read 3970 vertices and 23808 indices (divided by 3, means 7936 triangles):
(gdb) p context.indexCtr
$3 = 23808
(gdb) p vertexCount
$7 = 3970
Debugging the Rust side (in shapes/plymesh.rs
):
let mesh = Arc::new(TriangleMesh::new(
*o2w,
*w2o,
reverse_orientation,
tm_vertex_indices.len() / 3, // n_triangles
tm_vertex_indices,
n_vertices,
p_ws, // in world space
s_ws, // in world space
n_ws, // in world space
uvs,
));
We find the same amount of read vertices:
(gdb) p n_vertices
$15 = 3970
But the vertex indices are missing!!!
(gdb) p tm_vertex_indices
$16 = Vec<usize>(len: 0, cap: 0)
Commit 056f2e43ef71a985d4a8666fee9cae3e76bfd3b5 fixes the issue and also fixes a bug in create_ply_mesh(...)
regarding quads.