I love the descriptive error of:
SU_ERROR_INVALID_INPUT
It helps very much. (This is assertion but nonetheless I checked the return value separately.)
Irony aside it’s a general trend I don’t like of having errors information being error. Unless I’m missing something and I can get actual description of why can’t I add my face.
I’m adding my indices and checking all return value - why it would crash when faces are added (pardon the obfuscated syntax):
b(SULoopInputCreate, &loop_input);
for (signed long z = i[groupData(*currentMesh)].StartIndex, count = 0;
amountfaces < i[groupData(*currentMesh)].NumFaces;) {
unsigned long currentindex = getindex(z);
assert(currentindex < currentMesh->AmountVertices),
printf("%d\n", currentindex),
(count)[mat_input.vertex_indices] = currentindex,
(count)[mat_input.uv_coords].x = currentindex[currentMesh->vertexData].U,
(count)[mat_input.uv_coords].y = currentindex[currentMesh->vertexData].V;
count += 1;
z += 1;
if (count >= 3) {
size_t face_index;
b(SUGeometryInputAddFace, geom_input, &loop_input, &face_index);
b(SUMaterialSetOpacity, mat_input.material, 1.0);
b(SUGeometryInputFaceSetFrontMaterial, geom_input, face_index, &mat_input);
b(SUMaterialSetOpacity, mat_input.material, 0.1);
b(SUGeometryInputFaceSetBackMaterial, geom_input, face_index, &mat_input);
b(SULoopInputCreate, &loop_input);
count = 0;
amountfaces += 1;
//amountfaces = face_index;
}
if (getindex(z - 1) == getindex(z) && getindex(z + 1) == getindex(z + 2)) {
loop_input = (SULoopInputRef){ SU_INVALID };
b(SULoopInputCreate, &loop_input);
count = 0;
amountfaces += 1;
z += 3;
}
}
}
//++amountfaces;
b(SUEntitiesFill, entities, geom_input, true);
It’s a triangle strip I’m adding the same as Triangle Strips - Win32 apps | Microsoft Learn
And also thanks for your time because it’s not your entitlement to help and also I think there is improvement in the SDK since last time I used it. However I do remember having the same issue.