37 struct gpuSculptData {
53 for (const int face_index : range) {
54 const BMFace &face = *BM_face_at_index(&const_cast<BMesh &>(bm), face_index);
55 const IndexRange face_range(BM_elem_index_get(BM_FACE_FIRST_LOOP(&face)), face.len);
57 uchar4 face_set_color(UCHAR_MAX);
58 if (face_set_offset != -1) {
59 const int face_set_id = BM_ELEM_CD_GET_INT(&face, face_set_offset);
60 if (face_set_id != default_face_set) {
61 BKE_paint_face_set_overlay_color_get(face_set_id, face_set_seed, face_set_color);
64 vbo_data.slice(face_range).fill(gpuSculptData{face_set_color, 0.0f});
66 if (mask_offset != -1) {
67 const BMLoop *loop = BM_FACE_FIRST_LOOP(&face);
68 for ([[maybe_unused]] const int i : IndexRange(face.len)) {
69 const int index = BM_elem_index_get(loop);
70 vbo_data[index].mask = BM_ELEM_CD_GET_FLOAT(loop->v, mask_offset);
79 const Span<int> corner_verts = mr.corner_verts;
84 for (const int face_index : range) {
85 const IndexRange face = faces[face_index];
86 uchar4 face_set_color(UCHAR_MAX);
87 if (!face_set.is_empty()) {
88 const int face_set_id = face_set[face_index];
89 if (face_set_id != default_face_set) {
90 BKE_paint_face_set_overlay_color_get(face_set_id, face_set_seed, face_set_color);
93 vbo_data.slice(face).fill(gpuSculptData{face_set_color, 0.0f});
95 if (!mask.is_empty()) {
96 for (const int corner : face) {
97 vbo_data[corner].mask = mask[corner_verts[corner]];
121 const Span<int> corner_verts = coarse_mesh.corner_verts();
149 if (face_sets.is_empty()) {
158 for (
const int i : range) {
159 const int face_index = subdiv_loop_face_index[
i];
161 uchar4 face_set_color(UCHAR_MAX);
162 const int face_set_id = face_sets[face_index];
164 if (face_set_id != default_face_set) {
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
void BKE_paint_face_set_overlay_color_get(int face_set, int seed, uchar r_color[4])
MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3])
blender::gpu::VertBuf * GPU_vertbuf_create_on_device(const GPUVertFormat &format, uint v_len)
void GPU_vertbuf_init_build_on_device(blender::gpu::VertBuf &verts, const GPUVertFormat &format, uint v_len)
static blender::gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &format)
#define GPU_vertbuf_init_with_format(verts, format)
blender::gpu::VertBuf * GPU_vertbuf_calloc()
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_discard(blender::gpu::VertBuf *)
constexpr T * data() const
constexpr void fill(const T &value) const
constexpr int64_t size() const
GAttributeReader lookup(const StringRef attribute_id) const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, int64_t grain_size=4096)
void draw_subdiv_interp_custom_data(const DRWSubdivCache &cache, gpu::VertBuf &src_data, gpu::VertBuf &dst_data, GPUVertCompType comp_type, int dimensions, int dst_offset)
gpu::VertBufPtr extract_sculpt_data_subdiv(const MeshRenderData &mr, const DRWSubdivCache &subdiv_cache)
static const GPUVertFormat & get_sculpt_data_format()
void draw_subdiv_build_sculpt_data_buffer(const DRWSubdivCache &cache, gpu::VertBuf *mask_vbo, gpu::VertBuf *face_set_vbo, gpu::VertBuf *sculpt_data)
gpu::VertBufPtr extract_sculpt_data(const MeshRenderData &mr)
std::unique_ptr< gpu::VertBuf, gpu::VertBufDeleter > VertBufPtr
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
blender::VecBase< uint8_t, 4 > uchar4
int face_sets_color_default
int * subdiv_loop_face_index
MeshExtractType extract_type