[Bf-blender-cvs] [3436ed8df7d] fracture_modifier: use voro particle order now correctly, fixes brick fracture problems.
Martin Felke
noreply at git.blender.org
Thu Aug 2 13:42:59 CEST 2018
Commit: 3436ed8df7d5f4a3e11050f718f44da623f0542b
Author: Martin Felke
Date: Thu Aug 2 13:42:32 2018 +0200
Branches: fracture_modifier
https://developer.blender.org/rB3436ed8df7d5f4a3e11050f718f44da623f0542b
use voro particle order now correctly, fixes brick fracture problems.
===================================================================
M extern/voro++/src/c_interface.cc
M extern/voro++/src/c_interface.hh
M source/blender/blenkernel/intern/fracture.c
M source/blender/modifiers/intern/MOD_fracture.c
===================================================================
diff --git a/extern/voro++/src/c_interface.cc b/extern/voro++/src/c_interface.cc
index 541deb8ac1f..7344850dd87 100644
--- a/extern/voro++/src/c_interface.cc
+++ b/extern/voro++/src/c_interface.cc
@@ -25,19 +25,20 @@ void container_put(container* con, particle_order* p_order, int n,double x,doubl
{
c->put(*po, n, x, y, z);
}
- else
+ /*else
{
c->put(n, x, y, z);
- }
+ }*/
}
-void container_compute_cells(container* con, cell* cells)
+void container_compute_cells(container* con, particle_order* p_order, cell* cells)
{
int i = 0, v = 0, fo = 0, fv = 0, n = 0;
voro::container* cn = (voro::container*)con;
+ voro::particle_order* po = (voro::particle_order*)p_order;
voro::voronoicell_neighbor vc;
- voro::c_loop_all vl(*cn);
+ voro::c_loop_order vl(*cn, *po);
cell c;
if(vl.start()) {
do {
diff --git a/extern/voro++/src/c_interface.hh b/extern/voro++/src/c_interface.hh
index c63fb32ba01..46a1fa9f418 100644
--- a/extern/voro++/src/c_interface.hh
+++ b/extern/voro++/src/c_interface.hh
@@ -56,7 +56,7 @@ void particle_order_free(particle_order* po);
// cell array for direct access
cell* cells_new(int totcell);
void cells_free(cell* cells, int totcells);
-void container_compute_cells(container* con, cell* cells);
+void container_compute_cells(container* con, particle_order *p_order, cell* cells);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index 824f8ab8c71..c37e04e576f 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -2010,18 +2010,12 @@ void BKE_fracture_shard_by_points(FracMesh *fmesh, ShardID id, FracPointCloud *p
if (off[0] > 0 || off[1] > 0 || off[2] > 0)
{
sub_v3_v3(min, off);
-
- //special treatment for grid pointsource... with offsets
- voro_container = container_new(min[0], max[0], min[1], max[1], min[2], max[2],
- resolution[0] * 2, resolution[1] * 2, resolution[2] * 2, false, false, false,
- pointcloud->totpoints);
-
- }
- else {
- voro_container = container_new(min[0], max[0], min[1], max[1], min[2], max[2],
- n_size, n_size, n_size, false, false, false,
- pointcloud->totpoints);
}
+
+ //special treatment for grid pointsource... with offsets
+ voro_container = container_new(min[0], max[0], min[1], max[1], min[2], max[2],
+ n_size, n_size, n_size, false, false, false,
+ pointcloud->totpoints);
}
else {
voro_container = container_new(min[0], max[0], min[1], max[1], min[2], max[2],
@@ -2043,7 +2037,7 @@ void BKE_fracture_shard_by_points(FracMesh *fmesh, ShardID id, FracPointCloud *p
voro_cells = cells_new(pointcloud->totpoints);
/*Compute directly...*/
- container_compute_cells(voro_container, voro_cells);
+ container_compute_cells(voro_container, voro_particle_order, voro_cells);
/*Apply offsets (if any, grid only */
if (point_source & MOD_FRACTURE_GRID)
@@ -2054,6 +2048,7 @@ void BKE_fracture_shard_by_points(FracMesh *fmesh, ShardID id, FracPointCloud *p
{
//adjust centroid and...
float off[3], cent[3];
+
copy_v3_v3(off, pointcloud->points[p].offset);
add_v3_v3(voro_cells[p].centroid, off);
copy_v3_v3(cent, voro_cells[p].centroid);
@@ -2063,6 +2058,7 @@ void BKE_fracture_shard_by_points(FracMesh *fmesh, ShardID id, FracPointCloud *p
for (v = 0; v < voro_cells[p].totvert; v++)
{
add_v3_v3(voro_cells[p].verts[v], off);
+
//print_v3("Vert", voro_cells[p].verts[v]);
sub_v3_v3(voro_cells[p].verts[v], cent);
add_v3_v3(voro_cells[p].verts[v], voro_cells[p].centroid);
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 866ac702389..1ee201a98c3 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -1385,7 +1385,7 @@ static FracPointCloud get_points_global(FractureModifierData *emd, Object *ob, D
off[1] = emd->grid_offset[1] * ((max[1] - min[1]) / (float)emd->grid_resolution[1]);
}
- print_v3("offset", off);
+ //print_v3("offset", off);
if (id > 0 && emd->cutter_group == NULL)
{
More information about the Bf-blender-cvs
mailing list