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.
This commit is contained in:
parent
e9f9217f75
commit
148b39caec
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue