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:
authorishbosamiya <ishbosamiya@gmail.com>2021-09-05 22:10:19 +0300
committerishbosamiya <ishbosamiya@gmail.com>2021-09-05 22:10:19 +0300
commit973bd8c480191e1c91e5f8e4e2b82b047108ce6f (patch)
tree51c2e16caed7c9837bb8dc8759f6e1114017e6b4
parent6748f5cfbbfa75303b114f3dfa0268eff14d338d (diff)
adaptive_cloth: AdaptiveMesh: use params for collapsible testsoc-2021-adaptive-cloth
Use the `aspect_ratio_min` available in the params for the edge collapsible test instead of the hard coded value.
-rw-r--r--source/blender/blenkernel/intern/cloth_remesh.cc20
-rw-r--r--source/blender/modifiers/intern/MOD_adaptive_remesh.cc1
2 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc b/source/blender/blenkernel/intern/cloth_remesh.cc
index 90c373ec11b..546729de1fc 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -594,7 +594,8 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, FaceData> {
* Here "size" is determined by `Sizing` stores in `Vert`s of the
* `Edge`, using the function `Sizing::get_edge_size_sq()`.
*/
- void collapse_edges()
+ template<typename ExtraData>
+ void collapse_edges(const AdaptiveRemeshParams<END, ExtraData> &params)
{
blender::Set<FaceIndex> active_faces;
for (const auto &face : this->get_faces()) {
@@ -625,10 +626,10 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, FaceData> {
const auto &edge = this->get_checked_edge(edge_index);
std::optional<AdaptiveMeshDiff<END>> op_mesh_diff = std::nullopt;
- if (this->is_edge_collapseable_adaptivemesh(edge, false)) {
+ if (this->is_edge_collapseable_adaptivemesh(params, edge, false)) {
op_mesh_diff = this->collapse_edge_triangulate(edge.get_self_index(), false, true);
}
- else if (this->is_edge_collapseable_adaptivemesh(edge, true)) {
+ else if (this->is_edge_collapseable_adaptivemesh(params, edge, true)) {
op_mesh_diff = this->collapse_edge_triangulate(edge.get_self_index(), true, true);
}
@@ -700,7 +701,7 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, FaceData> {
this->split_edges(sewing_enabled, force_split_for_sewing);
/* Collapse the edges */
- this->collapse_edges();
+ this->collapse_edges(params);
#if SHOULD_REMESH_DUMP_FILE
auto static_remesh_end_msgpack = this->serialize();
@@ -746,7 +747,7 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, FaceData> {
this->split_edges(sewing_enabled, force_split_for_sewing);
/* Collapse the edges */
- this->collapse_edges();
+ this->collapse_edges(params);
#if SHOULD_REMESH_DUMP_FILE
auto dynamic_remesh_end_msgpack = this->serialize();
@@ -1434,11 +1435,14 @@ class AdaptiveMesh : public Mesh<NodeData<END>, VertData, EdgeData, FaceData> {
face.get_verts()[0], face.get_verts()[1], face.get_verts()[2]);
}
- bool is_edge_collapseable_adaptivemesh(const AdaptiveEdge &edge, bool verts_swapped) const
+ template<typename ExtraData>
+ bool is_edge_collapseable_adaptivemesh(const AdaptiveRemeshParams<END, ExtraData> &params,
+ const AdaptiveEdge &edge,
+ bool verts_swapped) const
{
- /* TODO(ish): expose small_value, aspect_ratio_min to gui */
+ /* TODO(ish): expose small_value to gui */
const auto small_value = 0.2;
- const auto aspect_ratio_min = 0.1;
+ const auto aspect_ratio_min = params.aspect_ratio_min;
if (this->is_edge_collapseable(edge.get_self_index(), verts_swapped, true) == false) {
return false;
diff --git a/source/blender/modifiers/intern/MOD_adaptive_remesh.cc b/source/blender/modifiers/intern/MOD_adaptive_remesh.cc
index 1c34d2da3f0..abd1935d0c1 100644
--- a/source/blender/modifiers/intern/MOD_adaptive_remesh.cc
+++ b/source/blender/modifiers/intern/MOD_adaptive_remesh.cc
@@ -191,6 +191,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
}
else if (armd->mode == ADAPTIVE_REMESH_STATIC_REMESHING) {
uiItemR(layout, ptr, "edge_length_min", 0, nullptr, ICON_NONE);
+ uiItemR(layout, ptr, "aspect_ratio_min", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "enable_sewing", 0, nullptr, ICON_NONE);
uiItemR(layout, ptr, "force_split_for_sewing", 0, nullptr, ICON_NONE);
}