diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-11-29 19:49:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-11-29 19:49:38 +0300 |
commit | 1cb59394ae69148904de34a32d09319f02c86a09 (patch) | |
tree | 46938c37114753afda7dd9caa31a4943e7969ead /source | |
parent | 46d2b6cd0b11de899f13c1acf17d158eb8c192a6 (diff) |
Cleanup: use const, avoid float -> double in matrix invert
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 7 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 5 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_parametrizer.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 2 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_build.c | 5 |
6 files changed, 14 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index fb6f99b8325..3b6009872e4 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1425,7 +1425,7 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke static void sample_derivedmesh( SmokeFlowSettings *sfs, MVert *mvert, MTFace *tface, MFace *mface, - float *influence_map, float *velocity_map, int index, int base_res[3], float flow_center[3], + float *influence_map, float *velocity_map, int index, const int base_res[3], float flow_center[3], BVHTreeFromMesh *treeData, const float ray_start[3], const float *vert_vel, bool has_velocity, int defgrp_index, MDeformVert *dvert, float x, float y, float z) { diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 2da1f225034..8f9fcbc252c 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -848,9 +848,10 @@ bool invert_m4_m4(float inverse[4][4], float mat[4][4]) } } - temp = tempmat[i][i]; - if (temp == 0) - return 0; /* No non-zero pivot */ + if (UNLIKELY(tempmat[i][i] == 0.0f)) { + return false; /* No non-zero pivot */ + } + temp = (double)tempmat[i][i]; for (k = 0; k < 4; k++) { tempmat[i][k] = (float)((double)tempmat[i][k] / temp); inverse[i][k] = (float)((double)inverse[i][k] / temp); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index b08f7ef9613..5d60fcc2fc4 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1410,8 +1410,9 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) { /* Scale the epsilon by the zoom level * to compensate for projection imprecision, see T41164 */ - float zoom_xy[2] = {kcd->vc.rv3d->winmat[0][0], - kcd->vc.rv3d->winmat[1][1]}; + const float zoom_xy[2] = { + kcd->vc.rv3d->winmat[0][0], + kcd->vc.rv3d->winmat[1][1]}; eps_scale = len_v2(zoom_xy); } diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 39ddb19edb7..d054ccc1a85 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -4193,7 +4193,7 @@ void param_delete(ParamHandle *handle) static void p_add_ngon(ParamHandle *handle, ParamKey key, int nverts, ParamKey *vkeys, float **co, float **uv, - ParamBool *pin, ParamBool *select, float normal[3]) + ParamBool *pin, ParamBool *select, const float normal[3]) { int *boundary = BLI_array_alloca(boundary, nverts); int i; diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 985e04bcfbf..9a67e6d526f 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -2740,7 +2740,7 @@ void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers) /* debug function, draws the pbvh BB */ void GPU_draw_pbvh_BB(float min[3], float max[3], bool leaf) { - float quads[4][4][3] = { + const float quads[4][4][3] = { { {min[0], min[1], min[2]}, {max[0], min[1], min[2]}, diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index b9f5be46992..f30529bc40f 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -43,11 +43,14 @@ #include "DNA_meshdata_types.h" #include "BKE_cdderivedmesh.h" -#include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_particle.h" #include "BKE_scene.h" +#ifdef _OPENMP +# include "BKE_mesh.h" /* BKE_MESH_OMP_LIMIT */ +#endif + static void initData(ModifierData *md) { BuildModifierData *bmd = (BuildModifierData *) md; |