Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-04 10:39:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-04 10:39:04 +0300
commit95011f6d484b369db92ae13c674a6522d664ea8f (patch)
tree91ba2719c9f3096fad0f1f768aa7b1c4d79aa32a /source/blender/editors/armature/meshlaplacian.c
parent0911acb5cf49c5ba05b1df045b41697704aa288a (diff)
parent44505b38df557a5711703613685a1dec9fc2c3d9 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/armature/meshlaplacian.c')
-rw-r--r--source/blender/editors/armature/meshlaplacian.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index ea4a12482d9..bc6d776911a 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -96,7 +96,7 @@ struct LaplacianSystem {
float *H; /* diagonal H matrix */
float *p; /* values from all p vectors */
float *mindist; /* minimum distance to a bone for all vertices */
-
+
BVHTree *bvhtree; /* ray tracing acceleration structure */
const MLoopTri **vltree; /* a looptri that the vertex belongs to */
} heat;
@@ -261,7 +261,7 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
if (sys->areaweights)
for (a = 0, face = sys->faces; a < sys->totface; a++, face++)
laplacian_triangle_area(sys, (*face)[0], (*face)[1], (*face)[2]);
-
+
for (a = 0; a < totvert; a++) {
if (sys->areaweights) {
if (sys->varea[a] != 0.0f)
@@ -277,7 +277,7 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
if (sys->storeweights)
sys->fweights = MEM_callocN(sizeof(float) * 3 * totface, "LaplacianFWeight");
-
+
for (a = 0, face = sys->faces; a < totface; a++, face++)
laplacian_triangle_weights(sys, a, (*face)[0], (*face)[1], (*face)[2]);
@@ -405,7 +405,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
const MLoopTri *lt = &looptri[a];
float bb[6];
int vtri[3];
-
+
vtri[0] = mloop[lt->tri[0]].v;
vtri[1] = mloop[lt->tri[1]].v;
vtri[2] = mloop[lt->tri[2]].v;
@@ -416,14 +416,14 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
minmax_v3v3_v3(bb, bb + 3, verts[vtri[2]]);
BLI_bvhtree_insert(sys->heat.bvhtree, a, bb, 2);
-
+
//Setup inverse pointers to use on isect.orig
sys->heat.vltree[vtri[0]] = lt;
sys->heat.vltree[vtri[1]] = lt;
sys->heat.vltree[vtri[2]] = lt;
}
- BLI_bvhtree_balance(sys->heat.bvhtree);
+ BLI_bvhtree_balance(sys->heat.bvhtree);
}
static int heat_ray_source_visible(LaplacianSystem *sys, int vertex, int source)
@@ -459,7 +459,7 @@ static int heat_ray_source_visible(LaplacianSystem *sys, int vertex, int source)
static float heat_source_distance(LaplacianSystem *sys, int vertex, int source)
{
float closest[3], d[3], dist, cosine;
-
+
/* compute euclidian distance */
closest_to_line_segment_v3(closest, sys->heat.verts[vertex], sys->heat.root[source], sys->heat.tip[source]);
@@ -481,7 +481,7 @@ static int heat_source_closest(LaplacianSystem *sys, int vertex, int source)
if (dist <= sys->heat.mindist[vertex] * (1.0f + DISTANCE_EPSILON))
if (heat_ray_source_visible(sys, vertex, source))
return 1;
-
+
return 0;
}
@@ -516,7 +516,7 @@ static void heat_set_H(LaplacianSystem *sys, int vertex)
}
else
h = 0.0f;
-
+
sys->heat.H[vertex] = h;
}
@@ -533,7 +533,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
v3 = (*face)[2];
normal_tri_v3(fnor, sys->verts[v1], sys->verts[v2], sys->verts[v3]);
-
+
add_v3_v3(sys->heat.vnors[v1], fnor);
add_v3_v3(sys->heat.vnors[v2], fnor);
add_v3_v3(sys->heat.vnors[v3], fnor);
@@ -680,7 +680,7 @@ void heat_bone_weighting(
for (a = 0; a < me->totvert; a++)
vertsflipped[a] = mesh_get_x_mirror_vert(ob, NULL, a, use_topology);
}
-
+
/* compute weights per bone */
for (j = 0; j < numsource; j++) {
if (!selected[j])
@@ -718,7 +718,7 @@ void heat_bone_weighting(
continue;
solution = laplacian_system_get_solution(sys, a);
-
+
if (bbone) {
if (solution > 0.0f)
ED_vgroup_vert_add(ob, dgrouplist[j], a, solution,
@@ -853,7 +853,7 @@ typedef struct MeshDeformBind {
/* direct solver */
int *varidx;
-
+
BVHTree *bvhtree;
BVHTreeFromMesh bvhdata;
@@ -874,7 +874,7 @@ typedef struct MeshDeformIsect {
bool isect;
float u, v;
-
+
} MeshDeformIsect;
/* ray intersection */
@@ -894,9 +894,9 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r
MeshDeformIsect *isec = data->isec;
float no[3], co[3], dist;
float *face[3];
-
+
lt = &looptri[index];
-
+
face[0] = mdb->cagecos[mloop[lt->tri[0]].v];
face[1] = mdb->cagecos[mloop[lt->tri[1]].v];
face[2] = mdb->cagecos[mloop[lt->tri[2]].v];
@@ -920,7 +920,7 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r
hit->index = index;
hit->dist = dist;
copy_v3_v3(hit->co, co);
-
+
isec->isect = (dot_v3v3(no, ray->direction) <= 0.0f);
isec->lambda = dist;
}
@@ -1003,7 +1003,7 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
copy_v3_v3(start, co);
sub_v3_v3v3(dir, outside, start);
normalize_v3(dir);
-
+
isect = meshdeform_ray_tree_intersect(mdb, start, outside);
if (isect && !isect->facing)
return 1;
@@ -1017,7 +1017,7 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
BLI_INLINE int meshdeform_index(MeshDeformBind *mdb, int x, int y, int z, int n)
{
int size = mdb->size;
-
+
x += MESHDEFORM_OFFSET[n][0];
y += MESHDEFORM_OFFSET[n][1];
z += MESHDEFORM_OFFSET[n][2];
@@ -1121,7 +1121,7 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
if (mdb->semibound[a])
ts++;
}
-
+
printf("interior %d exterior %d boundary %d semi-boundary %d\n", ti, te, tb, ts);
}
#endif
@@ -1230,7 +1230,7 @@ static void meshdeform_matrix_add_cell(MeshDeformBind *mdb, LinearSolver *contex
return;
EIG_linear_solver_matrix_add(context, mdb->varidx[acenter], mdb->varidx[acenter], 1.0f);
-
+
totweight = meshdeform_boundary_total_weight(mdb, x, y, z);
for (i = 1; i <= 6; i++) {
a = meshdeform_index(mdb, x, y, z, i);
@@ -1280,7 +1280,7 @@ static void meshdeform_matrix_add_semibound_phi(MeshDeformBind *mdb, int x, int
a = meshdeform_index(mdb, x, y, z, 0);
if (!mdb->semibound[a])
return;
-
+
mdb->phi[a] = 0.0f;
totweight = meshdeform_boundary_total_weight(mdb, x, y, z);
@@ -1418,7 +1418,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
printf("totalphi deficiency [%s|%d] %d: %.10f\n",
(mdb->tag[b] == MESHDEFORM_TAG_INTERIOR) ? "interior" : "boundary", mdb->semibound[b], mdb->varidx[b], mdb->totalphi[b]);
#endif
-
+
/* free */
MEM_freeN(mdb->varidx);
@@ -1504,7 +1504,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
/* start with all cells untyped */
for (a = 0; a < mdb->size3; a++)
mdb->tag[a] = MESHDEFORM_TAG_UNTYPED;
-
+
/* detect intersections and tag boundary cells */
for (z = 0; z < mdb->size; z++)
for (y = 0; y < mdb->size; y++)
@@ -1591,7 +1591,7 @@ void ED_mesh_deform_bind_callback(
/* get mesh and cage mesh */
mdb.vertexcos = MEM_callocN(sizeof(float) * 3 * totvert, "MeshDeformCos");
mdb.totvert = totvert;
-
+
mdb.cagemesh = cagemesh;
mdb.totcagevert = mdb.cagemesh->totvert;
mdb.cagecos = MEM_callocN(sizeof(*mdb.cagecos) * mdb.totcagevert, "MeshDeformBindCos");