Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_buffers.c
| Show First 20 Lines • Show All 310 Lines • ▼ Show 20 Lines | if (gpu_pbvh_vert_buf_data_set(buffers, totelem)) { | ||||
| if (show_mask && buffers->smooth) { | if (show_mask && buffers->smooth) { | ||||
| 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] = {1.0f, 1.0f, 1.0f, 1.0f}; | ushort scol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; | ||||
| if (vtcol) { | if (vtcol) { | ||||
| 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]; | ||||
| const MLoopCol *mcol = &vcol[loop_index]; | const MLoopCol *mcol = &vcol[loop_index]; | ||||
| scol[0] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[mcol->r]); | scol[0] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[mcol->r]); | ||||
| scol[1] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[mcol->g]); | scol[1] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[mcol->g]); | ||||
| scol[2] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[mcol->b]); | scol[2] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[mcol->b]); | ||||
| scol[3] = unit_float_to_ushort_clamp(mcol->a * (1.0f / 255.0f)); | scol[3] = unit_float_to_ushort_clamp(mcol->a * (1.0f / 255.0f)); | ||||
| memcpy(GPU_vertbuf_raw_step(&col_step), scol, sizeof(scol)); | memcpy(GPU_vertbuf_raw_step(&col_step), scol, sizeof(scol)); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| /* Face Sets. */ | /* Face Sets. */ | ||||
| memcpy(GPU_vertbuf_raw_step(&fset_step), face_set_color, sizeof(uchar) * 3); | memcpy(GPU_vertbuf_raw_step(&fset_step), face_set_color, sizeof(uchar) * 3); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| gpu_pbvh_batch_init(buffers, GPU_PRIM_TRIS); | gpu_pbvh_batch_init(buffers, GPU_PRIM_TRIS); | ||||
| } | } | ||||
| /* Get material index from the first face of this buffer. */ | /* Get material index from the first face of this buffer. */ | ||||
| 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; | ||||
| ▲ Show 20 Lines • Show All 785 Lines • Show Last 20 Lines | |||||