Cleanup: use const, avoid float -> double in matrix invert
authorCampbell Barton <ideasman42@gmail.com>
Sat, 29 Nov 2014 16:49:38 +0000 (17:49 +0100)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 29 Nov 2014 16:49:38 +0000 (17:49 +0100)
source/blender/blenkernel/intern/smoke.c
source/blender/blenlib/intern/math_matrix.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/uvedit/uvedit_parametrizer.c
source/blender/gpu/intern/gpu_buffers.c
source/blender/modifiers/intern/MOD_build.c

index fb6f99b83258c286dffc6593976cadceb1f2b5ff..3b6009872e4962ef811a1b67ade2779d9191d82a 100644 (file)
@@ -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)
 {
index 2da1f22503450509d757a00541709ed84dcbced4..8f9fcbc252c79da76f7fc0d1a3dccd278fcfcd34 100644 (file)
@@ -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);
index b08f7ef9613e3cea371075d4f0d449418d19fe0f..5d60fcc2fc4e3303ffafed60f54520367d2a11d9 100644 (file)
@@ -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);
        }
 
index 39ddb19edb7f38046d1932a8aa573a5cf8853bed..d054ccc1a851e442d85e8711ccdb03408c0723b8 100644 (file)
@@ -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;
index 985e04bcfbf0a9122b2a490ab7c56db71d79f18e..9a67e6d526ffd0fcfa60e19c2536e37fe8c879a2 100644 (file)
@@ -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]},
index b9f5be46992ec9b379ee55ee4963a93cb21ce64c..f30529bc40f0230939582aa28009a92f2a22f8e4 100644 (file)
 #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;