Sculpt: Fix draw artifacts when drawing multires mask

This commit is contained in:
Joseph Eagar 2022-10-14 22:51:45 -07:00
parent 010c10febe
commit c207571d44
1 changed files with 11 additions and 5 deletions

View File

@ -389,12 +389,18 @@ struct PBVHBatches {
break;
case CD_PBVH_MASK_TYPE:
foreach_grids([&](int /*x*/, int /*y*/, int /*grid_index*/, CCGElem *elems[4], int i) {
float *mask = CCG_elem_mask(&args->ccg_key, elems[i]);
if (args->ccg_key.has_mask) {
foreach_grids([&](int /*x*/, int /*y*/, int /*grid_index*/, CCGElem *elems[4], int i) {
float *mask = CCG_elem_mask(&args->ccg_key, elems[i]);
*static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = mask ? uchar(*mask * 255.0f) :
255;
});
*static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = uchar(*mask * 255.0f);
});
}
else {
foreach_grids([&](int /*x*/, int /*y*/, int /*grid_index*/, CCGElem *elems[4], int i) {
*static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = 0;
});
}
break;
case CD_PBVH_FSET_TYPE: {