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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-07-23 20:09:16 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-07-23 20:14:36 +0300
commitb466c09c305dfafbe3d15d6564c34f9f874ac0ad (patch)
tree1cbe58c8c8d67d91932aeb90fa1dc527202cd6e6 /source/blender/blenkernel
parentf6eccd367cf7ef504ebeef332b62a86d928f5542 (diff)
Subsurf: Fix wrong vertices index in vertex data interpolation
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/subdiv_mesh.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c
index eb47d9158d3..ad2e094fa48 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.c
+++ b/source/blender/blenkernel/intern/subdiv_mesh.c
@@ -355,7 +355,7 @@ static void vertex_interpolation_init(
int *indices = BLI_array_alloca(indices, coarse_poly->totloop);
for (int i = 0; i < coarse_poly->totloop; ++i) {
weights[i] = weight;
- indices[i] = coarse_poly->loopstart + i;
+ indices[i] = coarse_mloop[coarse_poly->loopstart + i].v;
}
CustomData_interp(&coarse_mesh->vdata,
&vertex_interpolation->vertex_data_storage,
@@ -395,13 +395,15 @@ static void vertex_interpolation_from_ptex(
* iteration.
*/
const float weights[2] = {0.5f, 0.5f};
+ const int first_loop_index = loops_of_ptex.first_loop - coarse_mloop;
+ const int last_loop_index = loops_of_ptex.last_loop - coarse_mloop;
const int first_indices[2] = {
- coarse_mloop[loops_of_ptex.first_loop - coarse_mloop].v,
- coarse_mloop[(loops_of_ptex.first_loop + 1 - coarse_mloop) %
- coarse_poly->totloop].v};
- const int last_indices[2] = {
- coarse_mloop[loops_of_ptex.last_loop - coarse_mloop].v,
- coarse_mloop[loops_of_ptex.first_loop - coarse_mloop].v};
+ coarse_mloop[first_loop_index].v,
+ coarse_mloop[coarse_poly->loopstart +
+ (first_loop_index - coarse_poly->loopstart + 1) %
+ coarse_poly->totloop].v};
+ const int last_indices[2] = {coarse_mloop[first_loop_index].v,
+ coarse_mloop[last_loop_index].v};
CustomData_interp(vertex_data,
&vertex_interpolation->vertex_data_storage,
first_indices,