Mesh: Avoid unnecessarily initializing corner topology arrays

This data should be initialized when building the mesh. If the arrays
aren't already initialized, there is already a bug. Theoretically this
could improve performance, since we can use `malloc` instead of
`calloc`. In practice I observed less than a 1% difference though.
This commit is contained in:
Hans Goudey
2023-04-12 15:49:09 -04:00
parent a04098ebba
commit e35f971da1

View File

@@ -992,11 +992,11 @@ static void mesh_ensure_cdlayers_primary(Mesh &mesh)
}
if (!CustomData_get_layer_named(&mesh.ldata, CD_PROP_INT32, ".corner_vert")) {
CustomData_add_layer_named(
&mesh.ldata, CD_PROP_INT32, CD_SET_DEFAULT, mesh.totloop, ".corner_vert");
&mesh.ldata, CD_PROP_INT32, CD_CONSTRUCT, mesh.totloop, ".corner_vert");
}
if (!CustomData_get_layer_named(&mesh.ldata, CD_PROP_INT32, ".corner_edge")) {
CustomData_add_layer_named(
&mesh.ldata, CD_PROP_INT32, CD_SET_DEFAULT, mesh.totloop, ".corner_edge");
&mesh.ldata, CD_PROP_INT32, CD_CONSTRUCT, mesh.totloop, ".corner_edge");
}
}