diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-11 12:50:09 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-09-11 12:50:22 +0300 |
commit | 7c64f8537f5c4766390cdca58568c07a74863c67 (patch) | |
tree | fb3538b4292d916d0d02f751c4eeb4bde98cfccf /source/blender/gpu | |
parent | 43abc5dabfb0ecc0a481e1f0597245fd5ff44af4 (diff) |
PBVH: Fix miossing normals for grids
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index cea2de77848..6584836d32d 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -398,6 +398,20 @@ void GPU_pbvh_grid_buffers_update( normal_float_to_short_v3(no_short, fno); GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.nor, vbo_index, no_short); + /* Copy normal to first row and last column. */ + if (k == key->grid_size - 2) { + const int next_vbo_index = vbo_index_offset + ((j + 1) * key->grid_size + k + 1); + GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.nor, next_vbo_index, no_short); + } + if (j == 0) { + int prev_vbo_index = vbo_index_offset + ((j) * key->grid_size + k); + GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.nor, prev_vbo_index, no_short); + } + if (j == 0 && k == key->grid_size - 2) { + int diag_vbo_index = vbo_index_offset + ((j) * key->grid_size + k + 1); + GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.nor, diag_vbo_index, no_short); + } + if (has_mask && show_mask) { float fmask = (*CCG_elem_mask(key, elems[0]) + *CCG_elem_mask(key, elems[1]) + |