diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-28 12:29:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-28 12:29:20 +0400 |
commit | 950ed6929792952044a57cad00833bddc8d39f45 (patch) | |
tree | 1211bb92a10b00812512f3613d98fa7f649a120b /source/blender/editors/mesh | |
parent | 0281ff408d7cda003b086169ae66a61b4cf9a02c (diff) |
code cleanup:
- replace inline face UV center calc.
- use const float[3] for mesh and uv functions.
- remove unused define
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 8 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_bvh.c | 18 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_bvh.h | 5 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_rip.c | 3 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 10 |
7 files changed, 24 insertions, 24 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 294a39eddf8..cfc9e11879e 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -400,14 +400,14 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags) } } -int paintface_minmax(Object *ob, float *min, float *max) +int paintface_minmax(Object *ob, float r_min[3], float r_max[3]) { Mesh *me; MPoly *mp; MTexPoly *tf; MLoop *ml; MVert *mvert; - int a, b, ok = 0; + int a, b, ok = FALSE; float vec[3], bmat[3][3]; me = get_mesh(ob); @@ -427,10 +427,10 @@ int paintface_minmax(Object *ob, float *min, float *max) copy_v3_v3(vec, (mvert[ml->v].co)); mul_m3_v3(bmat, vec); add_v3_v3v3(vec, vec, ob->obmat[3]); - DO_MINMAX(vec, min, max); + DO_MINMAX(vec, r_min, r_max); } - ok = 1; + ok = TRUE; } return ok; diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c index 6155ad1be1c..6d740812f27 100644 --- a/source/blender/editors/mesh/editmesh_bvh.c +++ b/source/blender/editors/mesh/editmesh_bvh.c @@ -239,7 +239,8 @@ static void raycallback(void *userdata, int index, const BVHTreeRay *ray, BVHTre } } -BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit) +BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3], + float r_hitout[3], float r_cagehit[3]) { BVHTreeRayHit hit; @@ -250,10 +251,9 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo BLI_bvhtree_ray_cast(tree->tree, co, dir, 0.0f, &hit, raycallback, tree); if (hit.dist != FLT_MAX && hit.index != -1) { - if (hitout) { + if (r_hitout) { if (tree->flag & BMBVH_RETURN_ORIG) { BMVert *v1, *v2, *v3; - float co[3]; int i; v1 = tree->em->looptris[hit.index][0]->v; @@ -261,17 +261,17 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo v3 = tree->em->looptris[hit.index][2]->v; for (i = 0; i < 3; i++) { - co[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) + - ((v3->co[i] - v1->co[i]) * tree->uv[1]); + r_hitout[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) + + ((v3->co[i] - v1->co[i]) * tree->uv[1]); } - copy_v3_v3(hitout, co); } else { - copy_v3_v3(hitout, hit.co); + copy_v3_v3(r_hitout, hit.co); } - if (cagehit) - copy_v3_v3(cagehit, hit.co); + if (r_cagehit) { + copy_v3_v3(r_cagehit, hit.co); + } } return tree->em->looptris[hit.index][0]->f; diff --git a/source/blender/editors/mesh/editmesh_bvh.h b/source/blender/editors/mesh/editmesh_bvh.h index e2b45062e41..6512f054c1b 100644 --- a/source/blender/editors/mesh/editmesh_bvh.h +++ b/source/blender/editors/mesh/editmesh_bvh.h @@ -50,13 +50,12 @@ struct BMBVHTree *BMBVH_NewBVH(struct BMEditMesh *em, int flag, struct Scene *sc void BMBVH_FreeBVH(struct BMBVHTree *tree); struct BVHTree *BMBVH_BVHTree(struct BMBVHTree *tree); -struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit); +struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, const float co[3], const float dir[3], + float r_hitout[3], float r_cagehit[3]); int BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e, struct ARegion *ar, struct View3D *v3d, struct Object *obedit); -#define BM_SEARCH_MAXDIST 0.4f - /*find a vert closest to co in a sphere of radius maxdist*/ struct BMVert *BMBVH_FindClosestVert(struct BMBVHTree *tree, float *co, float maxdist); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index b3bc0a1ffa9..6f33fcd05b7 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -277,7 +277,7 @@ static void knife_add_to_vert_edges(KnifeTool_OpData *kcd, KnifeEdge *kfe) knife_append_list(kcd, &kfe->v2->edges, kfe); } -static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, float *co, float *cageco) +static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, const float co[3], float *cageco) { KnifeVert *kfv = BLI_mempool_calloc(kcd->kverts); diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index e755df1f076..b5f486947b4 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -56,7 +56,8 @@ #include "mesh_intern.h" /* helper to find edge for edge_rip */ -static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const float mvalf[2]) +static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], + const float co1[3], const float co2[2], const float mvalf[2]) { float vec1[3], vec2[3]; diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 4ec3c22d1df..2ebeb9ca224 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -567,7 +567,7 @@ void undo_push_mesh(bContext *C, const char *name) } /* write comment here */ -UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, float *limit) +UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, const float limit[2]) { BMVert *ev; BMFace *efa; diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 0a6368daf74..b3ac3069cd9 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -641,7 +641,7 @@ typedef struct MocNode { intptr_t index[MOC_NODE_RES]; } MocNode; -static int mesh_octree_get_base_offs(float *co, float *offs, float *div) +static int mesh_octree_get_base_offs(const float co[3], const float offs[3], const float div[3]) { int vx, vy, vz; @@ -736,7 +736,7 @@ static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, f } -static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co) +static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, const float co[3]) { float *vec; int a; @@ -773,7 +773,7 @@ static struct { /* mode is 's' start, or 'e' end, or 'u' use */ /* if end, ob can be NULL */ -intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode) +intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char mode) { MocNode **bt; @@ -920,7 +920,7 @@ int mesh_get_x_mirror_vert(Object *ob, int index) return 0; } -static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, float *co) +static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, const float co[3]) { float vec[3]; intptr_t poinval; @@ -972,7 +972,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e return NULL; } -BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, float *co, int index) +BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, const float co[3], int index) { if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) { return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index); |