Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_buffers.c
| Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | hsv_to_rgb(random_mod_hue, | ||||
| 0.6f + (random_mod_sat * 0.25f), | 0.6f + (random_mod_sat * 0.25f), | ||||
| 1.0f - (random_mod_val * 0.35f), | 1.0f - (random_mod_val * 0.35f), | ||||
| &rgba[0], | &rgba[0], | ||||
| &rgba[1], | &rgba[1], | ||||
| &rgba[2]); | &rgba[2]); | ||||
| rgba_float_to_uchar(r_color, rgba); | rgba_float_to_uchar(r_color, rgba); | ||||
| } | } | ||||
| static bool gpu_pbvh_is_looptri_visible(const MLoopTri *lt, | |||||
| const MVert *mvert, | |||||
| const MLoop *mloop, | |||||
| const int *sculpt_face_sets) | |||||
| { | |||||
| return (!paint_is_face_hidden(lt, mvert, mloop) && sculpt_face_sets && | |||||
| sculpt_face_sets[lt->poly] > SCULPT_FACE_SET_NONE); | |||||
| } | |||||
| /* Threaded - do not call any functions that use OpenGL calls! */ | /* Threaded - do not call any functions that use OpenGL calls! */ | ||||
| void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, | void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, | ||||
| const MVert *mvert, | const MVert *mvert, | ||||
| const int *vert_indices, | const int *vert_indices, | ||||
| int totvert, | int totvert, | ||||
| const float *vmask, | const float *vmask, | ||||
| const MLoopCol *vcol, | const MLoopCol *vcol, | ||||
| const int *sculpt_face_sets, | const int *sculpt_face_sets, | ||||
| ▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | if (gpu_pbvh_vert_buf_data_set(buffers, totelem)) { | ||||
| for (uint i = 0; i < buffers->face_indices_len; i++) { | for (uint i = 0; i < buffers->face_indices_len; i++) { | ||||
| const MLoopTri *lt = &buffers->looptri[buffers->face_indices[i]]; | const MLoopTri *lt = &buffers->looptri[buffers->face_indices[i]]; | ||||
| const uint vtri[3] = { | const uint vtri[3] = { | ||||
| buffers->mloop[lt->tri[0]].v, | buffers->mloop[lt->tri[0]].v, | ||||
| buffers->mloop[lt->tri[1]].v, | buffers->mloop[lt->tri[1]].v, | ||||
| buffers->mloop[lt->tri[2]].v, | buffers->mloop[lt->tri[2]].v, | ||||
| }; | }; | ||||
| if (paint_is_face_hidden(lt, mvert, buffers->mloop)) { | if (!gpu_pbvh_is_looptri_visible(lt, mvert, buffers->mloop, sculpt_face_sets)) { | ||||
| continue; | |||||
| } | |||||
| if (sculpt_face_sets[lt->poly] <= 0) { | |||||
| continue; | continue; | ||||
| } | } | ||||
| /* Face normal and mask */ | /* Face normal and mask */ | ||||
| if (lt->poly != mpoly_prev) { | if (lt->poly != mpoly_prev) { | ||||
| const MPoly *mp = &buffers->mpoly[lt->poly]; | const MPoly *mp = &buffers->mpoly[lt->poly]; | ||||
| float fno[3]; | float fno[3]; | ||||
| BKE_mesh_calc_poly_normal(mp, &buffers->mloop[mp->loopstart], mvert, fno); | BKE_mesh_calc_poly_normal(mp, &buffers->mloop[mp->loopstart], mvert, fno); | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, | ||||
| const MLoopTri *lt = &buffers->looptri[buffers->face_indices[0]]; | const MLoopTri *lt = &buffers->looptri[buffers->face_indices[0]]; | ||||
| const MPoly *mp = &buffers->mpoly[lt->poly]; | const MPoly *mp = &buffers->mpoly[lt->poly]; | ||||
| buffers->material_index = mp->mat_nr; | buffers->material_index = mp->mat_nr; | ||||
| buffers->show_mask = !empty_mask; | buffers->show_mask = !empty_mask; | ||||
| buffers->mvert = mvert; | buffers->mvert = mvert; | ||||
| } | } | ||||
| static bool gpu_pbvh_is_looptri_visible(const MLoopTri *lt, | |||||
| const MVert *mvert, | |||||
| const MLoop *mloop, | |||||
| const int *sculpt_face_sets) | |||||
| { | |||||
| return (!paint_is_face_hidden(lt, mvert, mloop) && sculpt_face_sets && | |||||
| sculpt_face_sets[lt->poly] > 0); | |||||
| } | |||||
| /* Threaded - do not call any functions that use OpenGL calls! */ | /* Threaded - do not call any functions that use OpenGL calls! */ | ||||
| GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const int (*face_vert_indices)[3], | GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const int (*face_vert_indices)[3], | ||||
| const MPoly *mpoly, | const MPoly *mpoly, | ||||
| const MLoop *mloop, | const MLoop *mloop, | ||||
| const MLoopTri *looptri, | const MLoopTri *looptri, | ||||
| const MVert *mvert, | const MVert *mvert, | ||||
| const int *face_indices, | const int *face_indices, | ||||
| const int *sculpt_face_sets, | const int *sculpt_face_sets, | ||||
| ▲ Show 20 Lines • Show All 775 Lines • Show Last 20 Lines | |||||