[Bf-blender-cvs] [148b39caec6] temp_bmesh_multires: Added some code to calculate principle curvature direction for uniform triangle tesselations (dyntopo). This will be used for a version of topological rake that aligns edge flows to lines of curvature automatically.
Joseph Eagar
noreply at git.blender.org
Mon Mar 1 10:10:57 CET 2021
Commit: 148b39caec6e5182179b2b6eee64f9c2c2fb92d9
Author: Joseph Eagar
Date: Mon Mar 1 01:09:27 2021 -0800
Branches: temp_bmesh_multires
https://developer.blender.org/rB148b39caec6e5182179b2b6eee64f9c2c2fb92d9
Added some code to calculate principle curvature direction for
uniform triangle tesselations (dyntopo). This will be used for
a version of topological rake that aligns edge flows to lines of curvature
automatically.
===================================================================
M source/blender/blenkernel/intern/pbvh_bmesh.c
M source/blender/editors/sculpt_paint/CMakeLists.txt
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/editors/sculpt_paint/sculpt_intern.h
===================================================================
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 746463dfc42..2be64d19fd1 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -893,9 +893,9 @@ BLI_INLINE float calc_weighted_edge_collapse(EdgeQueueContext *eq_ctx, BMVert *v
return l * (n*n*4.0f);
#elif 1 // penalize 4-valence verts
float l = len_squared_v3v3(v1->co, v2->co);
- if (BM_vert_edge_count(v1) == 4 || BM_vert_edge_count(v2) == 4) {
- l *= 0.25f;
- }
+ //if (BM_vert_edge_count(v1) == 4 || BM_vert_edge_count(v2) == 4) {
+ // l *= 0.25f;
+ //}
return l;
#else
@@ -3042,6 +3042,7 @@ bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh,
int sym_axis,
bool updatePBVH)
{
+ /*
if (sym_axis >= 0 &&
PIL_check_seconds_timer() - last_update_time[sym_axis] < DYNTOPO_RUN_INTERVAL) {
return false;
@@ -3049,7 +3050,7 @@ bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh,
if (sym_axis >= 0) {
last_update_time[sym_axis] = PIL_check_seconds_timer();
- }
+ }*/
/* 2 is enough for edge faces - manifold edge */
BLI_buffer_declare_static(BMLoop *, edge_loops, BLI_BUFFER_NOP, 2);
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index fff8d27ef5b..5b426e827e7 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -56,6 +56,7 @@ set(SRC
paint_vertex_weight_ops.c
paint_vertex_weight_utils.c
sculpt.c
+ sculpt_curvature.c
sculpt_automasking.c
sculpt_boundary.c
sculpt_cloth.c
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 2d9df99210f..b593b51c1e5 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3237,7 +3237,8 @@ typedef struct {
bool original;
} SculptFindNearestToRayData;
-static void do_topology_rake_bmesh_task_cb_ex(void *__restrict userdata,
+__attribute__((optnone)) static void do_topology_rake_bmesh_task_cb_ex(
+ void *__restrict userdata,
const int n,
const TaskParallelTLS *__restrict tls)
{
@@ -3273,6 +3274,8 @@ static void do_topology_rake_bmesh_task_cb_ex(void *__restrict userdata,
if (!sculpt_brush_test_sq_fn(&test, vd.co)) {
continue;
}
+
+ float direction2[3];
const float fade =
bstrength *
SCULPT_brush_strength_factor(
@@ -3281,7 +3284,12 @@ static void do_topology_rake_bmesh_task_cb_ex(void *__restrict userdata,
float avg[3], val[3];
- SCULPT_bmesh_four_neighbor_average(avg, direction, vd.bm_vert);
+ //SculptCurvatureData cdata;
+ //SCULPT_calc_principle_curvatures(ss, vd.vertex, &cdata);
+ //copy_v3_v3(direction2, cdata.principle[0]);
+ copy_v3_v3(direction2, direction);
+
+ SCULPT_bmesh_four_neighbor_average(avg, direction2, vd.bm_vert);
sub_v3_v3v3(val, avg, vd.co);
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 2c493876751..10433b90e16 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1233,3 +1233,14 @@ bool SCULPT_ensure_dyntopo_node_undo(struct Object *ob,
void SCULPT_update_flat_vcol_shading(struct Object *ob, struct Scene *scene);
float SCULPT_calc_concavity(SculptSession *ss, SculptVertRef vref);
+
+
+typedef struct SculptCurvatureData {
+ float ks[3];
+ float principle[3][3]; // normalized
+} SculptCurvatureData;
+
+bool SCULPT_calc_principle_curvatures(SculptSession *ss,
+ SculptVertRef vertex,
+ SculptCurvatureData *out);
+
More information about the Bf-blender-cvs
mailing list