Cleanup: use const, avoid float -> double in matrix invert

This commit is contained in:
2014-11-29 17:49:38 +01:00
parent 46d2b6cd0b
commit 1cb59394ae
6 changed files with 14 additions and 9 deletions

View 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)
{

View 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);

View 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);
}

View 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;

View 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]},

View File

@@ -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;