Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_buffers.c
| Show All 32 Lines | |||||
| #include "BLI_ghash.h" | #include "BLI_ghash.h" | ||||
| #include "BLI_hash.h" | #include "BLI_hash.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_math_color.h" | #include "BLI_math_color.h" | ||||
| #include "BLI_math_color_blend.h" | #include "BLI_math_color_blend.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_userdef_types.h" | |||||
| #include "BKE_DerivedMesh.h" | #include "BKE_DerivedMesh.h" | ||||
| #include "BKE_ccg.h" | #include "BKE_ccg.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "BKE_pbvh.h" | #include "BKE_pbvh.h" | ||||
| #include "BKE_subdiv_ccg.h" | #include "BKE_subdiv_ccg.h" | ||||
| ▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, | ||||
| const int face_sets_color_seed, | const int face_sets_color_seed, | ||||
| const int face_sets_color_default, | const int face_sets_color_default, | ||||
| const MPropCol *vtcol, | const MPropCol *vtcol, | ||||
| const int update_flags) | const int update_flags) | ||||
| { | { | ||||
| const bool show_mask = vmask && (update_flags & GPU_PBVH_BUFFERS_SHOW_MASK) != 0; | const bool show_mask = vmask && (update_flags & GPU_PBVH_BUFFERS_SHOW_MASK) != 0; | ||||
| const bool show_face_sets = sculpt_face_sets && | const bool show_face_sets = sculpt_face_sets && | ||||
| (update_flags & GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS) != 0; | (update_flags & GPU_PBVH_BUFFERS_SHOW_SCULPT_FACE_SETS) != 0; | ||||
| const bool show_vcol = (vcol || vtcol) && (update_flags & GPU_PBVH_BUFFERS_SHOW_VCOL) != 0; | const bool show_vcol = (vcol || (vtcol && U.experimental.use_sculpt_vertex_colors)) && | ||||
| (update_flags & GPU_PBVH_BUFFERS_SHOW_VCOL) != 0; | |||||
| bool empty_mask = true; | bool empty_mask = true; | ||||
| bool default_face_set = true; | bool default_face_set = true; | ||||
| { | { | ||||
| const int totelem = buffers->tot_tri * 3; | const int totelem = buffers->tot_tri * 3; | ||||
| /* Build VBO */ | /* Build VBO */ | ||||
| if (gpu_pbvh_vert_buf_data_set(buffers, totelem)) { | if (gpu_pbvh_vert_buf_data_set(buffers, totelem)) { | ||||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | if (gpu_pbvh_vert_buf_data_set(buffers, totelem)) { | ||||
| cmask = (uchar)(vmask[vtri[j]] * 255); | cmask = (uchar)(vmask[vtri[j]] * 255); | ||||
| } | } | ||||
| *(uchar *)GPU_vertbuf_raw_step(&msk_step) = cmask; | *(uchar *)GPU_vertbuf_raw_step(&msk_step) = cmask; | ||||
| empty_mask = empty_mask && (cmask == 0); | empty_mask = empty_mask && (cmask == 0); | ||||
| /* Vertex Colors. */ | /* Vertex Colors. */ | ||||
| if (show_vcol) { | if (show_vcol) { | ||||
| ushort scol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; | ushort scol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; | ||||
| if (vtcol) { | if (vtcol && U.experimental.use_sculpt_vertex_colors) { | ||||
| scol[0] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[0]); | scol[0] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[0]); | ||||
| scol[1] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[1]); | scol[1] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[1]); | ||||
| scol[2] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[2]); | scol[2] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[2]); | ||||
| scol[3] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[3]); | scol[3] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[3]); | ||||
| memcpy(GPU_vertbuf_raw_step(&col_step), scol, sizeof(scol)); | memcpy(GPU_vertbuf_raw_step(&col_step), scol, sizeof(scol)); | ||||
| } | } | ||||
| else { | else { | ||||
| const uint loop_index = lt->tri[j]; | const uint loop_index = lt->tri[j]; | ||||
| ▲ Show 20 Lines • Show All 806 Lines • Show Last 20 Lines | |||||