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:
Diffstat (limited to 'source/blender/blenkernel/intern/multires_reshape_smooth.c')
-rw-r--r--source/blender/blenkernel/intern/multires_reshape_smooth.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/multires_reshape_smooth.c b/source/blender/blenkernel/intern/multires_reshape_smooth.c
index 8246de12ebf..1463404069f 100644
--- a/source/blender/blenkernel/intern/multires_reshape_smooth.c
+++ b/source/blender/blenkernel/intern/multires_reshape_smooth.c
@@ -354,10 +354,9 @@ static GridCoord *vertex_grid_coord_with_grid_index(const Vertex *vertex, const
/* Get grid coordinates which correspond to corners of the given face.
* All the grid coordinates will be from the same grid index. */
-static void grid_coords_from_face_vertices(
- const MultiresReshapeSmoothContext *reshape_smooth_context,
- const Face *face,
- const GridCoord *grid_coords[])
+static void grid_coords_from_face_verts(const MultiresReshapeSmoothContext *reshape_smooth_context,
+ const Face *face,
+ const GridCoord *grid_coords[])
{
BLI_assert(face->num_corners == 4);
@@ -417,7 +416,7 @@ static void foreach_toplevel_grid_coord_task(void *__restrict userdata_v,
const Face *face = &reshape_smooth_context->geometry.faces[face_index];
const GridCoord *face_grid_coords[4];
- grid_coords_from_face_vertices(reshape_smooth_context, face, face_grid_coords);
+ grid_coords_from_face_verts(reshape_smooth_context, face, face_grid_coords);
for (int y = 0; y < inner_grid_size; ++y) {
const float ptex_v = (float)y * inner_grid_size_1_inv;
@@ -483,13 +482,14 @@ static bool is_crease_supported(const MultiresReshapeSmoothContext *reshape_smoo
/* Get crease which will be used for communication to OpenSubdiv topology.
* Note that simple subdivision treats all base edges as infinitely sharp. */
-static char get_effective_crease_char(const MultiresReshapeSmoothContext *reshape_smooth_context,
- const MEdge *base_edge)
+static float get_effective_crease(const MultiresReshapeSmoothContext *reshape_smooth_context,
+ const int base_edge_index)
{
if (!is_crease_supported(reshape_smooth_context)) {
return 255;
}
- return base_edge->crease;
+ const float *creases = reshape_smooth_context->reshape_context->cd_vertex_crease;
+ return creases ? creases[base_edge_index] : 0.0f;
}
static float get_effective_crease_float(const MultiresReshapeSmoothContext *reshape_smooth_context,
@@ -643,8 +643,7 @@ static void foreach_vertex(const SubdivForeachContext *foreach_context,
const int face_index = multires_reshape_grid_to_face_index(reshape_context,
grid_coord.grid_index);
- const Mesh *base_mesh = reshape_context->base_mesh;
- const MPoly *base_poly = &base_mesh->mpoly[face_index];
+ const MPoly *base_poly = &reshape_context->base_polys[face_index];
const int num_corners = base_poly->totloop;
const int start_grid_index = reshape_context->face_start_grid_index[face_index];
const int corner = grid_coord.grid_index - start_grid_index;
@@ -814,7 +813,6 @@ static void foreach_edge(const struct SubdivForeachContext *foreach_context,
const int subdiv_v2)
{
MultiresReshapeSmoothContext *reshape_smooth_context = foreach_context->user_data;
- const MultiresReshapeContext *reshape_context = reshape_smooth_context->reshape_context;
if (reshape_smooth_context->smoothing_type == MULTIRES_SUBDIVIDE_LINEAR) {
if (!is_loose) {
@@ -834,9 +832,7 @@ static void foreach_edge(const struct SubdivForeachContext *foreach_context,
return;
}
/* Edges without crease are to be ignored as well. */
- const Mesh *base_mesh = reshape_context->base_mesh;
- const MEdge *base_edge = &base_mesh->medge[coarse_edge_index];
- const char crease = get_effective_crease_char(reshape_smooth_context, base_edge);
+ const char crease = get_effective_crease(reshape_smooth_context, coarse_edge_index);
if (crease == 0) {
return;
}
@@ -847,9 +843,8 @@ static void geometry_init_loose_information(MultiresReshapeSmoothContext *reshap
{
const MultiresReshapeContext *reshape_context = reshape_smooth_context->reshape_context;
const Mesh *base_mesh = reshape_context->base_mesh;
- const MPoly *base_mpoly = base_mesh->mpoly;
- const MLoop *base_mloop = base_mesh->mloop;
- const MEdge *base_edge = base_mesh->medge;
+ const MPoly *base_mpoly = reshape_context->base_polys;
+ const MLoop *base_mloop = reshape_context->base_loops;
reshape_smooth_context->non_loose_base_edge_map = BLI_BITMAP_NEW(base_mesh->totedge,
"non_loose_base_edge_map");
@@ -862,8 +857,8 @@ static void geometry_init_loose_information(MultiresReshapeSmoothContext *reshap
if (!BLI_BITMAP_TEST_BOOL(reshape_smooth_context->non_loose_base_edge_map, loop->e)) {
BLI_BITMAP_ENABLE(reshape_smooth_context->non_loose_base_edge_map, loop->e);
- const char crease = get_effective_crease_char(reshape_smooth_context, &base_edge[loop->e]);
- if (crease != 0) {
+ const float crease = get_effective_crease(reshape_smooth_context, loop->e);
+ if (crease > 0.0f) {
++num_used_edges;
}
}