diff options
author | Hans Goudey <h.goudey@me.com> | 2022-10-05 21:44:02 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-10-05 21:48:01 +0300 |
commit | 548a2cbe06b23d90b0e09da49fc854178c270b8a (patch) | |
tree | 8706b5be97ace0ff0ca18d4109586ccb5cf0a666 /source/blender/blenkernel/intern/mball_tessellate.cc | |
parent | 6306d747b770685f38f95bc57f8681335ddfa506 (diff) |
Cleanup: Clang tidy
Also remove unnecessary struct keywords in C++ files.
Diffstat (limited to 'source/blender/blenkernel/intern/mball_tessellate.cc')
-rw-r--r-- | source/blender/blenkernel/intern/mball_tessellate.cc | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/source/blender/blenkernel/intern/mball_tessellate.cc b/source/blender/blenkernel/intern/mball_tessellate.cc index 9b32456c6c1..5e8d2bc6d76 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.cc +++ b/source/blender/blenkernel/intern/mball_tessellate.cc @@ -5,12 +5,12 @@ * \ingroup bke */ -#include <ctype.h> -#include <float.h> -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include <cctype> +#include <cfloat> +#include <cmath> +#include <cstdio> +#include <cstdlib> +#include <cstring> #include "MEM_guardedalloc.h" @@ -169,7 +169,7 @@ static uint partition_mainb(MetaElem **mainb, uint start, uint end, uint s, floa uint i = start, j = end - 1; div *= 2.0f; - while (1) { + while (true) { while (i < j && div > (mainb[i]->bb->vec[6][s] + mainb[i]->bb->vec[0][s])) { i++; } @@ -222,7 +222,7 @@ static void build_bvh_spatial( part = partition_mainb(process->mainb, start, end, s, div); make_box_from_metaelem(&node->bb[0], process->mainb[start]); - node->child[0] = NULL; + node->child[0] = nullptr; if (part > start + 1) { for (j = start; j < part; j++) { @@ -234,7 +234,7 @@ static void build_bvh_spatial( build_bvh_spatial(process, node->child[0], start, part, &node->bb[0]); } - node->child[1] = NULL; + node->child[1] = nullptr; if (part < end) { make_box_from_metaelem(&node->bb[1], process->mainb[part]); @@ -461,12 +461,12 @@ static void make_face(PROCESS *process, int i1, int i2, int i3, int i4) accumulate_vertex_normals_v3(process->no[i1], process->no[i2], process->no[i3], - NULL, + nullptr, n, process->co[i1], process->co[i2], process->co[i3], - NULL); + nullptr); } else { normal_quad_v3(n, process->co[i1], process->co[i2], process->co[i3], process->co[i4]); @@ -677,7 +677,7 @@ static CORNER *setcorner(PROCESS *process, int i, int j, int k) index = HASH(i, j, k); c = process->corners[index]; - for (; c != NULL; c = c->next) { + for (; c != nullptr; c = c->next) { if (c->i == i && c->j == j && c->k == k) { return c; } @@ -746,7 +746,7 @@ static int otherface(int edge, int face) /** * create the 256 entry table for cubical polygonization */ -static void makecubetable(void) +static void makecubetable() { static bool is_done = false; int i, e, c, done[12], pos[8]; @@ -765,14 +765,14 @@ static void makecubetable(void) } for (e = 0; e < 12; e++) { if (!done[e] && (pos[corner1[e]] != pos[corner2[e]])) { - INTLIST *ints = NULL; + INTLIST *ints = nullptr; INTLISTS *lists = static_cast<INTLISTS *>(MEM_callocN(sizeof(INTLISTS), "mball_intlist")); int start = e, edge = e; /* get face that is to right of edge from pos to neg corner: */ int face = pos[corner1[e]] ? rightface[e] : leftface[e]; - while (1) { + while (true) { edge = nextcwedge(edge, face); done[edge] = 1; if (pos[corner1[edge]] != pos[corner2[edge]]) { @@ -842,7 +842,7 @@ void BKE_mball_cubeTable_free(void) MEM_freeN(lists); lists = nlists; } - cubetable[i] = NULL; + cubetable[i] = nullptr; } } @@ -859,7 +859,7 @@ static int setcenter(PROCESS *process, CENTERLIST *table[], const int i, const i index = HASH(i, j, k); q = table[index]; - for (l = q; l != NULL; l = l->next) { + for (l = q; l != nullptr; l = l->next) { if (l->i == i && l->j == j && l->k == k) { return 1; } @@ -927,7 +927,7 @@ static int getedge(EDGELIST *table[], int i1, int j1, int k1, int i2, int j2, in k2 = t; } q = table[HASH(i1, j1, k1) + HASH(i2, j2, k2)]; - for (; q != NULL; q = q->next) { + for (; q != nullptr; q = q->next) { if (q->i1 == i1 && q->j1 == j1 && q->k1 == k1 && q->i2 == i2 && q->j2 == j2 && q->k2 == k2) { return q->vid; } @@ -1160,7 +1160,7 @@ static void polygonize(PROCESS *process) find_first_points(process, i); } - while (process->cubes != NULL) { + while (process->cubes != nullptr) { c = process->cubes->cube; process->cubes = process->cubes->next; @@ -1194,15 +1194,15 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); /* make main array */ - BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 0, NULL, NULL); + BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 0, nullptr, nullptr); while (BKE_scene_base_iter_next(depsgraph, &iter, &sce_iter, 1, &base, &bob)) { if (bob->type == OB_MBALL) { zero_size = 0; - ml = NULL; + ml = nullptr; /* If this metaball is the original that's used for duplication, only have it visible when * the instancer is visible too. */ - if ((base->flag_legacy & OB_FROMDUPLI) == 0 && ob->parent != NULL && + if ((base->flag_legacy & OB_FROMDUPLI) == 0 && ob->parent != nullptr && (ob->parent->transflag & parenting_dupli_transflag) != 0 && (BKE_object_visibility(ob->parent, deg_eval_mode) & OB_VISIBLE_SELF) == 0) { continue; @@ -1412,10 +1412,10 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob) } if (!is_render && (mb->flag == MB_UPDATE_NEVER)) { - return NULL; + return nullptr; } if ((G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_FAST) { - return NULL; + return nullptr; } if (is_render) { @@ -1436,7 +1436,7 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob) init_meta(depsgraph, &process, scene, ob); if (process.totelem == 0) { freepolygonize(&process); - return NULL; + return nullptr; } build_bvh_spatial(&process, &process.metaball_bvh, 0, process.totelem, &process.allbb); @@ -1448,13 +1448,13 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob) ob->scale[1] < 0.00001f * (process.allbb.max[1] - process.allbb.min[1]) || ob->scale[2] < 0.00001f * (process.allbb.max[2] - process.allbb.min[2])) { freepolygonize(&process); - return NULL; + return nullptr; } polygonize(&process); if (process.curindex == 0) { freepolygonize(&process); - return NULL; + return nullptr; } freepolygonize(&process); @@ -1463,7 +1463,7 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob) mesh->totvert = int(process.curvertex); MVert *mvert = static_cast<MVert *>( - CustomData_add_layer(&mesh->vdata, CD_MVERT, CD_CONSTRUCT, NULL, mesh->totvert)); + CustomData_add_layer(&mesh->vdata, CD_MVERT, CD_CONSTRUCT, nullptr, mesh->totvert)); for (int i = 0; i < mesh->totvert; i++) { copy_v3_v3(mvert[i].co, process.co[i]); } @@ -1471,9 +1471,9 @@ Mesh *BKE_mball_polygonize(Depsgraph *depsgraph, Scene *scene, Object *ob) mesh->totpoly = int(process.curindex); MPoly *mpoly = static_cast<MPoly *>( - CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_CONSTRUCT, NULL, mesh->totpoly)); + CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_CONSTRUCT, nullptr, mesh->totpoly)); MLoop *mloop = static_cast<MLoop *>( - CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_CONSTRUCT, NULL, mesh->totpoly * 4)); + CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_CONSTRUCT, nullptr, mesh->totpoly * 4)); int loop_offset = 0; for (int i = 0; i < mesh->totpoly; i++) { |