Cleanup: replace 'unsigned in' with 'uint'

This commit is contained in:
Campbell Barton 2021-06-18 14:27:41 +10:00
parent 5f0d4fef91
commit 50a4b9d502
11 changed files with 108 additions and 120 deletions

View File

@ -1260,8 +1260,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
if (mface->v3 == 0) {
static int corner_indices[4] = {1, 2, 0, 3};
SWAP(unsigned int, mface->v1, mface->v2);
SWAP(unsigned int, mface->v2, mface->v3);
SWAP(uint, mface->v1, mface->v2);
SWAP(uint, mface->v2, mface->v3);
if (fdata) {
CustomData_swap_corners(fdata, mfindex, corner_indices);
@ -1272,8 +1272,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
if (mface->v3 == 0 || mface->v4 == 0) {
static int corner_indices[4] = {2, 3, 0, 1};
SWAP(unsigned int, mface->v1, mface->v3);
SWAP(unsigned int, mface->v2, mface->v4);
SWAP(uint, mface->v1, mface->v3);
SWAP(uint, mface->v2, mface->v4);
if (fdata) {
CustomData_swap_corners(fdata, mfindex, corner_indices);
@ -1375,7 +1375,7 @@ void BKE_mesh_material_index_clear(Mesh *me)
}
}
void BKE_mesh_material_remap(Mesh *me, const unsigned int *remap, unsigned int remap_len)
void BKE_mesh_material_remap(Mesh *me, const uint *remap, uint remap_len)
{
const short remap_len_short = (short)remap_len;
@ -1439,10 +1439,7 @@ int poly_find_loop_from_vert(const MPoly *poly, const MLoop *loopstart, uint ver
* vertex. Returns the index of the loop matching vertex, or -1 if the
* vertex is not in \a poly
*/
int poly_get_adj_loops_from_vert(const MPoly *poly,
const MLoop *mloop,
unsigned int vert,
unsigned int r_adj[2])
int poly_get_adj_loops_from_vert(const MPoly *poly, const MLoop *mloop, uint vert, uint r_adj[2])
{
int corner = poly_find_loop_from_vert(poly, &mloop[poly->loopstart], vert);

View File

@ -148,7 +148,7 @@ static void make_edges_mdata_extend(
int totedge = *r_totedge;
int totedge_new;
EdgeHash *eh;
unsigned int eh_reserve;
uint eh_reserve;
const MPoly *mp;
int i;
@ -174,7 +174,7 @@ static void make_edges_mdata_extend(
if (totedge_new) {
EdgeHashIterator *ehi;
MEdge *medge;
unsigned int e_index = totedge;
uint e_index = totedge;
*r_alledge = medge = (*r_alledge ?
MEM_reallocN(*r_alledge, sizeof(MEdge) * (totedge + totedge_new)) :
@ -719,17 +719,17 @@ typedef struct EdgeLink {
typedef struct VertLink {
Link *next, *prev;
unsigned int index;
uint index;
} VertLink;
static void prependPolyLineVert(ListBase *lb, unsigned int index)
static void prependPolyLineVert(ListBase *lb, uint index)
{
VertLink *vl = MEM_callocN(sizeof(VertLink), "VertLink");
vl->index = index;
BLI_addhead(lb, vl);
}
static void appendPolyLineVert(ListBase *lb, unsigned int index)
static void appendPolyLineVert(ListBase *lb, uint index)
{
VertLink *vl = MEM_callocN(sizeof(VertLink), "VertLink");
vl->index = index;
@ -784,8 +784,8 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
bool closed = false;
int totpoly = 0;
MEdge *med_current = ((EdgeLink *)edges.last)->edge;
unsigned int startVert = med_current->v1;
unsigned int endVert = med_current->v2;
uint startVert = med_current->v1;
uint endVert = med_current->v2;
bool ok = true;
appendPolyLineVert(&polyline, startVert);

View File

@ -478,7 +478,7 @@ void BKE_mesh_calc_normals_looptri(MVert *mverts,
for (int i = 0; i < looptri_num; i++) {
const MLoopTri *lt = &looptri[i];
float *f_no = fnors[i];
const unsigned int vtri[3] = {
const uint vtri[3] = {
mloop[lt->tri[0]].v,
mloop[lt->tri[1]].v,
mloop[lt->tri[2]].v,
@ -1058,7 +1058,7 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
if (lnors_spacearr) {
float vec_curr[3], vec_prev[3];
const unsigned int mv_pivot_index = ml_curr->v; /* The vertex we are "fanning" around! */
const uint mv_pivot_index = ml_curr->v; /* The vertex we are "fanning" around! */
const MVert *mv_pivot = &mverts[mv_pivot_index];
const MEdge *me_curr = &medges[ml_curr->e];
const MVert *mv_2 = (me_curr->v1 == mv_pivot_index) ? &mverts[me_curr->v2] :
@ -1117,7 +1117,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
* number of sharp edges per vertex, I doubt the additional memory usage would be worth it,
* especially as it should not be a common case in real-life meshes anyway).
*/
const unsigned int mv_pivot_index = ml_curr->v; /* The vertex we are "fanning" around! */
const uint mv_pivot_index = ml_curr->v; /* The vertex we are "fanning" around! */
const MVert *mv_pivot = &mverts[mv_pivot_index];
/* ml_curr would be mlfan_prev if we needed that one. */
@ -1361,7 +1361,7 @@ static bool loop_split_generator_check_cyclic_smooth_fan(const MLoop *mloops,
const int ml_prev_index,
const int mp_curr_index)
{
const unsigned int mv_pivot_index = ml_curr->v; /* The vertex we are "fanning" around! */
const uint mv_pivot_index = ml_curr->v; /* The vertex we are "fanning" around! */
const int *e2lfan_curr;
const MLoop *mlfan_curr;
/* mlfan_vert_index: the loop of our current edge might not be the loop of our current vertex! */
@ -2133,7 +2133,7 @@ void BKE_mesh_normals_loop_to_vertex(const int numVerts,
int i;
const MLoop *ml;
for (i = 0, ml = mloops; i < numLoops; i++, ml++) {
const unsigned int v = ml->v;
const uint v = ml->v;
add_v3_v3(r_vert_clnors[v], clnors[i]);
vert_loops_nbr[v]++;
@ -2315,7 +2315,7 @@ float BKE_mesh_calc_poly_area(const MPoly *mpoly, const MLoop *loopstart, const
}
/* finally calculate the area */
float area = area_poly_v3((const float(*)[3])vertexcos, (unsigned int)mpoly->totloop);
float area = area_poly_v3((const float(*)[3])vertexcos, (uint)mpoly->totloop);
return area;
}
@ -2518,9 +2518,7 @@ void BKE_mesh_poly_edgehash_insert(EdgeHash *ehash, const MPoly *mp, const MLoop
}
}
void BKE_mesh_poly_edgebitmap_insert(unsigned int *edge_bitmap,
const MPoly *mp,
const MLoop *mloop)
void BKE_mesh_poly_edgebitmap_insert(uint *edge_bitmap, const MPoly *mp, const MLoop *mloop)
{
const MLoop *ml;
int i = mp->totloop;
@ -2795,7 +2793,7 @@ void BKE_mesh_loops_to_mface_corners(
CustomData *fdata,
CustomData *ldata,
CustomData *UNUSED(pdata),
unsigned int lindex[4],
uint lindex[4],
int findex,
const int UNUSED(polyindex),
const int mf_len, /* 3 or 4 */
@ -2873,7 +2871,7 @@ void BKE_mesh_loops_to_tessdata(CustomData *fdata,
CustomData *ldata,
MFace *mface,
const int *polyindices,
unsigned int (*loopindices)[4],
uint (*loopindices)[4],
const int num_faces)
{
/* Note: performances are sub-optimal when we get a NULL mface,
@ -2889,7 +2887,7 @@ void BKE_mesh_loops_to_tessdata(CustomData *fdata,
const bool hasLoopTangent = CustomData_has_layer(ldata, CD_TANGENT);
int findex, i, j;
const int *pidx;
unsigned int(*lidx)[4];
uint(*lidx)[4];
for (i = 0; i < numUV; i++) {
MTFace *texface = CustomData_get_layer_n(fdata, CD_MTFACE, i);
@ -2966,7 +2964,7 @@ void BKE_mesh_tangent_loops_to_tessdata(CustomData *fdata,
CustomData *ldata,
MFace *mface,
const int *polyindices,
unsigned int (*loopindices)[4],
uint (*loopindices)[4],
const int num_faces,
const char *layer_name)
{
@ -2981,7 +2979,7 @@ void BKE_mesh_tangent_loops_to_tessdata(CustomData *fdata,
int findex, j;
const int *pidx;
unsigned int(*lidx)[4];
uint(*lidx)[4];
if (layer_name) {
ltangents = CustomData_get_layer_named(ldata, CD_TANGENT, layer_name);
@ -3043,9 +3041,9 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
MFace *mface, *mf;
MemArena *arena = NULL;
int *mface_to_poly_map;
unsigned int(*lindices)[4];
uint(*lindices)[4];
int poly_index, mface_index;
unsigned int j;
uint j;
mpoly = CustomData_get_layer(pdata, CD_MPOLY);
mloop = CustomData_get_layer(ldata, CD_MLOOP);
@ -3060,10 +3058,10 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
mface_index = 0;
mp = mpoly;
for (poly_index = 0; poly_index < totpoly; poly_index++, mp++) {
const unsigned int mp_loopstart = (unsigned int)mp->loopstart;
const unsigned int mp_totloop = (unsigned int)mp->totloop;
unsigned int l1, l2, l3, l4;
unsigned int *lidx;
const uint mp_loopstart = (uint)mp->loopstart;
const uint mp_totloop = (uint)mp->totloop;
uint l1, l2, l3, l4;
uint *lidx;
if (mp_totloop < 3) {
/* do nothing */
}
@ -3137,9 +3135,9 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
float axis_mat[3][3];
float(*projverts)[2];
unsigned int(*tris)[3];
uint(*tris)[3];
const unsigned int totfilltri = mp_totloop - 2;
const uint totfilltri = mp_totloop - 2;
if (UNLIKELY(arena == NULL)) {
arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
@ -3174,7 +3172,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
/* apply fill */
for (j = 0; j < totfilltri; j++) {
unsigned int *tri = tris[j];
uint *tri = tris[j];
lidx = lindices[mface_index];
mface_to_poly_map[mface_index] = poly_index;
@ -3298,14 +3296,14 @@ void BKE_mesh_recalc_looptri(const MLoop *mloop,
MLoopTri *mlt;
MemArena *arena = NULL;
int poly_index, mlooptri_index;
unsigned int j;
uint j;
mlooptri_index = 0;
mp = mpoly;
for (poly_index = 0; poly_index < totpoly; poly_index++, mp++) {
const unsigned int mp_loopstart = (unsigned int)mp->loopstart;
const unsigned int mp_totloop = (unsigned int)mp->totloop;
unsigned int l1, l2, l3;
const uint mp_loopstart = (uint)mp->loopstart;
const uint mp_totloop = (uint)mp->totloop;
uint l1, l2, l3;
if (mp_totloop < 3) {
/* do nothing */
}
@ -3319,7 +3317,7 @@ void BKE_mesh_recalc_looptri(const MLoop *mloop,
l2 = mp_loopstart + i2; \
l3 = mp_loopstart + i3; \
ARRAY_SET_ITEMS(mlt->tri, l1, l2, l3); \
mlt->poly = (unsigned int)poly_index; \
mlt->poly = (uint)poly_index; \
} \
((void)0)
@ -3352,9 +3350,9 @@ void BKE_mesh_recalc_looptri(const MLoop *mloop,
float axis_mat[3][3];
float(*projverts)[2];
unsigned int(*tris)[3];
uint(*tris)[3];
const unsigned int totfilltri = mp_totloop - 2;
const uint totfilltri = mp_totloop - 2;
if (UNLIKELY(arena == NULL)) {
arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
@ -3389,7 +3387,7 @@ void BKE_mesh_recalc_looptri(const MLoop *mloop,
/* apply fill */
for (j = 0; j < totfilltri; j++) {
unsigned int *tri = tris[j];
uint *tri = tris[j];
mlt = &mlooptri[mlooptri_index];
@ -3399,7 +3397,7 @@ void BKE_mesh_recalc_looptri(const MLoop *mloop,
l3 = mp_loopstart + tri[2];
ARRAY_SET_ITEMS(mlt->tri, l1, l2, l3);
mlt->poly = (unsigned int)poly_index;
mlt->poly = (uint)poly_index;
mlooptri_index++;
}
@ -3629,7 +3627,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id,
CustomData_external_read(fdata, id, CD_MASK_MDISPS, totface_i);
}
eh = BLI_edgehash_new_ex(__func__, (unsigned int)totedge_i);
eh = BLI_edgehash_new_ex(__func__, (uint)totedge_i);
/* build edge hash */
me = medge;
@ -3768,12 +3766,12 @@ void BKE_mesh_polygon_flip_ex(MPoly *mpoly,
/* We also have to update loops edge
* (they will get their original 'other edge', that is,
* the original edge of their original previous loop)... */
unsigned int prev_edge_index = mloop[loopstart].e;
uint prev_edge_index = mloop[loopstart].e;
mloop[loopstart].e = mloop[loopend].e;
for (loopstart++; loopend > loopstart; loopstart++, loopend--) {
mloop[loopend].e = mloop[loopend - 1].e;
SWAP(unsigned int, mloop[loopstart].e, prev_edge_index);
SWAP(uint, mloop[loopstart].e, prev_edge_index);
if (!loops_in_ldata) {
SWAP(MLoop, mloop[loopstart], mloop[loopend]);
@ -4026,9 +4024,9 @@ void BKE_mesh_calc_relative_deform(const MPoly *mpoly,
const MLoop *loopstart = mloop + mp->loopstart;
for (int j = 0; j < mp->totloop; j++) {
unsigned int v_prev = loopstart[(mp->totloop + (j - 1)) % mp->totloop].v;
unsigned int v_curr = loopstart[j].v;
unsigned int v_next = loopstart[(j + 1) % mp->totloop].v;
uint v_prev = loopstart[(mp->totloop + (j - 1)) % mp->totloop].v;
uint v_curr = loopstart[j].v;
uint v_next = loopstart[(j + 1) % mp->totloop].v;
float tvec[3];

View File

@ -65,7 +65,7 @@ class FairingContext {
float r_adj_prev[3]) = 0;
/* Get the other vertex index for a loop. */
virtual int other_vertex_index_from_loop(const int loop, const unsigned int v) = 0;
virtual int other_vertex_index_from_loop(const int loop, const uint v) = 0;
int vertex_count_get()
{
@ -257,7 +257,7 @@ class MeshFairingContext : public FairingContext {
copy_v3_v3(r_adj_prev, co_[ME_POLY_LOOP_PREV(mloop_, p, corner)->v]);
}
int other_vertex_index_from_loop(const int loop, const unsigned int v) override
int other_vertex_index_from_loop(const int loop, const uint v) override
{
MEdge *e = &medge_[mloop_[loop].e];
if (e->v1 == v) {
@ -332,7 +332,7 @@ class BMeshFairingContext : public FairingContext {
copy_v3_v3(r_adj_prev, bmloop_[loop]->prev->v->co);
}
int other_vertex_index_from_loop(const int loop, const unsigned int v) override
int other_vertex_index_from_loop(const int loop, const uint v) override
{
BMLoop *l = bmloop_[loop];
BMVert *bmvert = BM_vert_at_index(bm, v);

View File

@ -48,8 +48,8 @@
UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
const MLoop *mloop,
const MLoopUV *mloopuv,
unsigned int totpoly,
unsigned int totvert,
uint totpoly,
uint totvert,
const float limit[2],
const bool selected,
const bool use_winding)
@ -57,7 +57,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
UvVertMap *vmap;
UvMapVert *buf;
const MPoly *mp;
unsigned int a;
uint a;
int i, totuv, nverts;
bool *winding = NULL;
@ -115,7 +115,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
}
if (use_winding) {
winding[a] = cross_poly_v2(tf_uv, (unsigned int)nverts) > 0;
winding[a] = cross_poly_v2(tf_uv, (uint)nverts) > 0;
}
}
}
@ -176,7 +176,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const MPoly *mpoly,
return vmap;
}
UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v)
UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, uint v)
{
return vmap->vert[v];
}
@ -239,7 +239,7 @@ static void mesh_vert_poly_or_loop_map_create(MeshElemMap **r_map,
const MPoly *p = &mpoly[i];
for (j = 0; j < p->totloop; j++) {
unsigned int v = mloop[p->loopstart + j].v;
uint v = mloop[p->loopstart + j].v;
map[v].indices[map[v].count] = do_loops ? p->loopstart + j : i;
map[v].count++;
@ -362,7 +362,7 @@ void BKE_mesh_vert_edge_map_create(
/* Find the users */
for (i = 0; i < totedge; i++) {
const unsigned int v[2] = {medge[i].v1, medge[i].v2};
const uint v[2] = {medge[i].v1, medge[i].v2};
map[v[0]].indices[map[v[0]].count] = i;
map[v[1]].indices[map[v[1]].count] = i;
@ -405,7 +405,7 @@ void BKE_mesh_vert_edge_vert_map_create(
/* Find the users */
for (i = 0; i < totedge; i++) {
const unsigned int v[2] = {medge[i].v1, medge[i].v2};
const uint v[2] = {medge[i].v1, medge[i].v2};
map[v[0]].indices[map[v[0]].count] = (int)v[1];
map[v[1]].indices[map[v[1]].count] = (int)v[0];
@ -1025,8 +1025,8 @@ static bool mesh_check_island_boundary_uv(const MPoly *UNUSED(mp),
BLI_assert(edge_to_loops->count >= 2 && (edge_to_loops->count % 2) == 0);
const unsigned int v1 = loops[edge_to_loops->indices[0]].v;
const unsigned int v2 = loops[edge_to_loops->indices[1]].v;
const uint v1 = loops[edge_to_loops->indices[0]].v;
const uint v2 = loops[edge_to_loops->indices[1]].v;
const float *uvco_v1 = luvs[edge_to_loops->indices[0]].uv;
const float *uvco_v2 = luvs[edge_to_loops->indices[1]].uv;
for (int i = 2; i < edge_to_loops->count; i += 2) {

View File

@ -179,13 +179,13 @@ static int cddm_poly_compare(MLoop *mloop_array,
/* Utility stuff for using GHash with polys, used by vertex merging. */
typedef struct PolyKey {
int poly_index; /* index of the MPoly within the derived mesh */
int totloops; /* number of loops in the poly */
unsigned int hash_sum; /* Sum of all vertices indices */
unsigned int hash_xor; /* Xor of all vertices indices */
int poly_index; /* index of the MPoly within the derived mesh */
int totloops; /* number of loops in the poly */
uint hash_sum; /* Sum of all vertices indices */
uint hash_xor; /* Xor of all vertices indices */
} PolyKey;
static unsigned int poly_gset_hash_fn(const void *key)
static uint poly_gset_hash_fn(const void *key)
{
const PolyKey *pk = key;
return pk->hash_sum;
@ -331,8 +331,8 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
med = mesh->medge;
c = 0;
for (i = 0; i < totedge; i++, med++) {
const unsigned int v1 = (vtargetmap[med->v1] != -1) ? vtargetmap[med->v1] : med->v1;
const unsigned int v2 = (vtargetmap[med->v2] != -1) ? vtargetmap[med->v2] : med->v2;
const uint v1 = (vtargetmap[med->v1] != -1) ? vtargetmap[med->v1] : med->v1;
const uint v2 = (vtargetmap[med->v2] != -1) ? vtargetmap[med->v2] : med->v2;
if (LIKELY(v1 != v2)) {
void **val_p;

View File

@ -787,7 +787,7 @@ void BKE_mesh_remap_calc_edges_from_mesh(const int mode,
int j = 2;
while (j--) {
const unsigned int vidx_dst = j ? e_dst->v1 : e_dst->v2;
const uint vidx_dst = j ? e_dst->v1 : e_dst->v2;
/* Compute closest verts only once! */
if (v_dst_to_src_map[vidx_dst].hit_dist == -1.0f) {
@ -813,7 +813,7 @@ void BKE_mesh_remap_calc_edges_from_mesh(const int mode,
/* Now, check all source edges of closest sources vertices,
* and select the one giving the smallest total verts-to-verts distance. */
for (j = 2; j--;) {
const unsigned int vidx_dst = j ? e_dst->v1 : e_dst->v2;
const uint vidx_dst = j ? e_dst->v1 : e_dst->v2;
const float first_dist = v_dst_to_src_map[vidx_dst].hit_dist;
const int vidx_src = v_dst_to_src_map[vidx_dst].index;
int *eidx_src, k;
@ -1542,7 +1542,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
mp_src = &polys_src[isld->indices[i]];
for (lidx_src = mp_src->loopstart; lidx_src < mp_src->loopstart + mp_src->totloop;
lidx_src++) {
const unsigned int vidx_src = loops_src[lidx_src].v;
const uint vidx_src = loops_src[lidx_src].v;
if (!BLI_BITMAP_TEST(verts_active, vidx_src)) {
BLI_BITMAP_ENABLE(verts_active, loops_src[lidx_src].v);
num_verts_active++;
@ -2418,8 +2418,7 @@ void BKE_mesh_remap_calc_polys_from_mesh(const int mode,
tri_vidx_2d[1][2] = 3;
}
else {
BLI_polyfill_calc(
poly_vcos_2d, (unsigned int)mp->totloop, -1, (unsigned int(*)[3])tri_vidx_2d);
BLI_polyfill_calc(poly_vcos_2d, (uint)mp->totloop, -1, (uint(*)[3])tri_vidx_2d);
}
for (j = 0; j < tris_num; j++) {

View File

@ -67,20 +67,19 @@ struct OpenVDBLevelSet *BKE_mesh_remesh_voxel_ovdb_mesh_to_level_set_create(
BKE_mesh_runtime_verttri_from_looptri(
verttri, mesh->mloop, looptri, BKE_mesh_runtime_looptri_len(mesh));
unsigned int totfaces = BKE_mesh_runtime_looptri_len(mesh);
unsigned int totverts = mesh->totvert;
uint totfaces = BKE_mesh_runtime_looptri_len(mesh);
uint totverts = mesh->totvert;
float *verts = (float *)MEM_malloc_arrayN(totverts * 3, sizeof(float), "remesh_input_verts");
unsigned int *faces = (unsigned int *)MEM_malloc_arrayN(
totfaces * 3, sizeof(unsigned int), "remesh_input_faces");
uint *faces = (uint *)MEM_malloc_arrayN(totfaces * 3, sizeof(uint), "remesh_input_faces");
for (unsigned int i = 0; i < totverts; i++) {
for (uint i = 0; i < totverts; i++) {
MVert *mvert = &mesh->mvert[i];
verts[i * 3] = mvert->co[0];
verts[i * 3 + 1] = mvert->co[1];
verts[i * 3 + 2] = mvert->co[2];
}
for (unsigned int i = 0; i < totfaces; i++) {
for (uint i = 0; i < totfaces; i++) {
MVertTri *vt = &verttri[i];
faces[i * 3] = vt->tri[0];
faces[i * 3 + 1] = vt->tri[1];
@ -171,20 +170,19 @@ static Mesh *BKE_mesh_remesh_quadriflow(Mesh *input_mesh,
BKE_mesh_runtime_verttri_from_looptri(
verttri, input_mesh->mloop, looptri, BKE_mesh_runtime_looptri_len(input_mesh));
unsigned int totfaces = BKE_mesh_runtime_looptri_len(input_mesh);
unsigned int totverts = input_mesh->totvert;
uint totfaces = BKE_mesh_runtime_looptri_len(input_mesh);
uint totverts = input_mesh->totvert;
float *verts = (float *)MEM_malloc_arrayN(totverts * 3, sizeof(float), "remesh_input_verts");
unsigned int *faces = (unsigned int *)MEM_malloc_arrayN(
totfaces * 3, sizeof(unsigned int), "remesh_input_faces");
uint *faces = (uint *)MEM_malloc_arrayN(totfaces * 3, sizeof(uint), "remesh_input_faces");
for (unsigned int i = 0; i < totverts; i++) {
for (uint i = 0; i < totverts; i++) {
MVert *mvert = &input_mesh->mvert[i];
verts[i * 3] = mvert->co[0];
verts[i * 3 + 1] = mvert->co[1];
verts[i * 3 + 2] = mvert->co[2];
}
for (unsigned int i = 0; i < totfaces; i++) {
for (uint i = 0; i < totfaces; i++) {
MVertTri *vt = &verttri[i];
faces[i * 3] = vt->tri[0];
faces[i * 3 + 1] = vt->tri[1];

View File

@ -98,7 +98,7 @@ void BKE_mesh_runtime_clear_cache(Mesh *mesh)
*/
static void mesh_ensure_looptri_data(Mesh *mesh)
{
const unsigned int totpoly = mesh->totpoly;
const uint totpoly = mesh->totpoly;
const int looptris_len = poly_to_tri_count(totpoly, mesh->totloop);
BLI_assert(mesh->runtime.looptris.array_wip == NULL);

View File

@ -157,8 +157,8 @@ void sample_face_attribute(const Mesh &mesh,
}
MeshAttributeInterpolator::MeshAttributeInterpolator(const Mesh *mesh,
const Span<float3> positions,
const Span<int> looptri_indices)
const Span<float3> positions,
const Span<int> looptri_indices)
: mesh_(mesh), positions_(positions), looptri_indices_(looptri_indices)
{
BLI_assert(positions.size() == looptri_indices.size());
@ -219,8 +219,8 @@ Span<float3> MeshAttributeInterpolator::ensure_nearest_weights()
}
void MeshAttributeInterpolator::sample_attribute(const ReadAttributeLookup &src_attribute,
OutputAttribute &dst_attribute,
eAttributeMapMode mode)
OutputAttribute &dst_attribute,
eAttributeMapMode mode)
{
if (!src_attribute || !dst_attribute) {
return;
@ -247,18 +247,15 @@ void MeshAttributeInterpolator::sample_attribute(const ReadAttributeLookup &src_
/* Interpolate the source attributes on the surface. */
switch (src_attribute.domain) {
case ATTR_DOMAIN_POINT: {
sample_point_attribute(
*mesh_, looptri_indices_, weights, src_varray, dst_span);
sample_point_attribute(*mesh_, looptri_indices_, weights, src_varray, dst_span);
break;
}
case ATTR_DOMAIN_FACE: {
sample_face_attribute(
*mesh_, looptri_indices_, src_varray, dst_span);
sample_face_attribute(*mesh_, looptri_indices_, src_varray, dst_span);
break;
}
case ATTR_DOMAIN_CORNER: {
sample_corner_attribute(
*mesh_, looptri_indices_, weights, src_varray, dst_span);
sample_corner_attribute(*mesh_, looptri_indices_, weights, src_varray, dst_span);
break;
}
case ATTR_DOMAIN_EDGE: {

View File

@ -63,7 +63,7 @@ typedef union {
typedef struct SortFace {
EdgeUUID es[4];
unsigned int index;
uint index;
} SortFace;
/* Used to detect polys (faces) using exactly the same vertices. */
@ -72,7 +72,7 @@ typedef struct SortPoly {
int *verts;
int numverts;
int loopstart;
unsigned int index;
uint index;
bool invalid; /* Poly index. */
} SortPoly;
@ -221,15 +221,15 @@ static int search_polyloop_cmp(const void *v1, const void *v2)
/* NOLINTNEXTLINE: readability-function-size */
bool BKE_mesh_validate_arrays(Mesh *mesh,
MVert *mverts,
unsigned int totvert,
uint totvert,
MEdge *medges,
unsigned int totedge,
uint totedge,
MFace *mfaces,
unsigned int totface,
uint totface,
MLoop *mloops,
unsigned int totloop,
uint totloop,
MPoly *mpolys,
unsigned int totpoly,
uint totpoly,
MDeformVert *dverts, /* assume totvert length */
const bool do_verbose,
const bool do_fixes,
@ -260,7 +260,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
MEdge *me;
MLoop *ml;
MPoly *mp;
unsigned int i, j;
uint i, j;
int *v;
bool is_valid = true;
@ -398,14 +398,14 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
SortFace *sort_faces = MEM_callocN(sizeof(SortFace) * totface, "search faces");
SortFace *sf;
SortFace *sf_prev;
unsigned int totsortface = 0;
uint totsortface = 0;
PRINT_ERR("No Polys, only tessellated Faces");
for (i = 0, mf = mfaces, sf = sort_faces; i < totface; i++, mf++) {
bool remove = false;
int fidx;
unsigned int fv[4];
uint fv[4];
fidx = mf->v4 ? 3 : 2;
do {
@ -815,7 +815,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
}
/* Not technically incorrect since this is unsigned, however,
* a value over INT_MAX is almost certainly caused by wrapping an unsigned int. */
* a value over INT_MAX is almost certainly caused by wrapping an uint. */
if (dw->def_nr >= INT_MAX) {
PRINT_ERR("\tVertex deform %u, has invalid group %u", i, dw->def_nr);
if (do_fixes) {
@ -1279,7 +1279,7 @@ void BKE_mesh_strip_loose_edges(Mesh *me)
MEdge *e;
MLoop *l;
int a, b;
unsigned int *new_idx = MEM_mallocN(sizeof(int) * me->totedge, __func__);
uint *new_idx = MEM_mallocN(sizeof(int) * me->totedge, __func__);
for (a = b = 0, e = me->medge; a < me->totedge; a++, e++) {
if (e->v1 != e->v2) {
@ -1317,13 +1317,12 @@ void BKE_mesh_strip_loose_edges(Mesh *me)
/* make edges in a Mesh, for outside of editmode */
struct EdgeSort {
unsigned int v1, v2;
uint v1, v2;
char is_loose, is_draw;
};
/* edges have to be added with lowest index first for sorting */
static void to_edgesort(
struct EdgeSort *ed, unsigned int v1, unsigned int v2, char is_loose, short is_draw)
static void to_edgesort(struct EdgeSort *ed, uint v1, uint v2, char is_loose, short is_draw)
{
if (v1 < v2) {
ed->v1 = v1;
@ -1378,8 +1377,8 @@ static void mesh_calc_edges_mdata(MVert *UNUSED(allvert),
EdgeHash *hash;
struct EdgeSort *edsort, *ed;
int a, totedge = 0;
unsigned int totedge_final = 0;
unsigned int edge_index;
uint totedge_final = 0;
uint edge_index;
/* we put all edges in array, sort them, and detect doubles that way */
@ -1445,7 +1444,7 @@ static void mesh_calc_edges_mdata(MVert *UNUSED(allvert),
/* order is swapped so extruding this edge as a surface wont flip face normals
* with cyclic curves */
if (ed->v1 + 1 != ed->v2) {
SWAP(unsigned int, med->v1, med->v2);
SWAP(uint, med->v1, med->v2);
}
med++;
}