Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 16 Jan 2018 13:52:43 +0000 (14:52 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 16 Jan 2018 13:52:43 +0000 (14:52 +0100)
1  2 
source/blender/gpu/intern/gpu_buffers.c

index 095021c12d8d768cbd9d39d07789ec9fd4a2b701,d6e01b6765ad6de228edffd7568d277759345400..8779bd71b81eb720fb6dc42d6a6e381b2fcc6b58
@@@ -1311,21 -1283,22 +1311,26 @@@ void GPU_pbvh_grid_buffers_update
                                for (y = 0; y < key->grid_size; y++) {
                                        for (x = 0; x < key->grid_size; x++) {
                                                CCGElem *elem = CCG_grid_elem(key, grid, x, y);
 -                                              
 -                                              copy_v3_v3(vd->co, CCG_elem_co(key, elem));
 +                                              GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.pos, vbo_index, CCG_elem_co(key, elem));
 +
                                                if (buffers->smooth) {
 -                                                      normal_float_to_short_v3(vd->no, CCG_elem_no(key, elem));
 +                                                      short no_short[3];
 +                                                      normal_float_to_short_v3(no_short, CCG_elem_no(key, elem));
 +                                                      GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.nor, vbo_index, no_short);
  
-                                                       if (has_mask && show_mask) {
+                                                       if (has_mask) {
 +                                                              uchar color_ub[3];
-                                                               gpu_color_from_mask_copy(*CCG_elem_mask(key, elem),
-                                                                                            diffuse_color, color_ub);
+                                                               if (show_mask) {
+                                                                       gpu_color_from_mask_copy(*CCG_elem_mask(key, elem),
 -                                                                                               diffuse_color, vd->color);
++                                                                                               diffuse_color, color_ub);
+                                                               }
+                                                               else {
 -                                                                      F3TOCHAR3(diffuse_color, vd->color);
++                                                                      F3TOCHAR3(diffuse_color, color_ub);
+                                                               }
 +                                                              GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.col, vbo_index, color_ub);
                                                        }
                                                }
 -                                              vd++;
 +                                              vbo_index += 1;
                                        }
                                }
                                
                                                                       CCG_elem_co(key, elems[2]),
                                                                       CCG_elem_co(key, elems[3]));
  
 -                                                      vd = vert_data + (j + 1) * key->grid_size + k;
 -                                                      normal_float_to_short_v3(vd->no, fno);
 +                                                      vbo_index = vbo_index_offset + ((j + 1) * key->grid_size + k);
 +                                                      short no_short[3];
 +                                                      normal_float_to_short_v3(no_short, fno);
 +                                                      GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.nor, vbo_index, no_short);
  
                                                        if (has_mask) {
-                                                               gpu_color_from_mask_quad_copy(key,
-                                                                                             elems[0],
-                                                                                             elems[1],
-                                                                                             elems[2],
-                                                                                             elems[3],
-                                                                                             diffuse_color,
-                                                                                             color_ub);
 +                                                              uchar color_ub[3];
 -                                                                                                    vd->color);
+                                                               if (show_mask) {
+                                                                       gpu_color_from_mask_quad_copy(key,
+                                                                                                     elems[0],
+                                                                                                     elems[1],
+                                                                                                     elems[2],
+                                                                                                     elems[3],
+                                                                                                     diffuse_color,
 -                                                                      F3TOCHAR3(diffuse_color, vd->color);
++                                                                                                    color_ub);
+                                                               }
+                                                               else {
++                                                                      F3TOCHAR3(diffuse_color, color_ub);
+                                                               }
 +                                                              GWN_vertbuf_attr_set(buffers->vert_buf, vbo_id.col, vbo_index, color_ub);
                                                        }
                                                }
                                        }