45 if (
const CustomRequest *request_type = std::get_if<CustomRequest>(&value)) {
48 const GenericRequest &attr = std::get<GenericRequest>(value);
92 struct AttributeData {
107 void tag_dirty(
const IndexMask &node_mask);
162 const IndexMask &nodes_to_update)
override;
166 const IndexMask &nodes_to_update)
override;
195void DrawCacheImpl::AttributeData::tag_dirty(
const IndexMask &node_mask)
198 node_mask.
set_bits(this->dirty_nodes);
204 data->tag_dirty(node_mask);
207 data->tag_dirty(node_mask);
213 dirty_topology_.resize(std::max(dirty_topology_.size(), node_mask.
min_array_size()),
false);
214 node_mask.
set_bits(dirty_topology_);
227 data->tag_dirty(node_mask);
234 data->tag_dirty(node_mask);
240 for (
const auto &[data_request,
data] : attribute_vbos_.items()) {
241 if (
const GenericRequest *request = std::get_if<GenericRequest>(&data_request)) {
242 if (*request == attribute_name) {
243 data.tag_dirty(node_mask);
252 ptr = std::make_unique<DrawCacheImpl>();
262 mask.foreach_index([&](
const int i) { ibos[
i].reset(); });
270 mask.foreach_index([&](
const int i) { vbos[
i].reset(); });
315 bool is_render, is_active;
316 const char *prefix =
"a";
348 using VBOType =
typename Converter::VBOType;
350 for (
const int face : face_indices) {
351 for (
const int vert : corner_verts.
slice(
faces[face])) {
352 *
data = Converter::convert(attribute[vert]);
365 using VBOType =
typename Converter::VBOType;
368 for (
const int face : face_indices) {
369 const int face_size =
faces[face].size();
370 std::fill_n(
data, face_size, Converter::convert(attribute[face]));
382 using VBOType =
typename Converter::VBOType;
385 for (
const int face : face_indices) {
386 for (
const int corner :
faces[face]) {
387 *
data = Converter::convert(attribute[corner]);
412 using VBOType =
typename Converter::VBOType;
419 const BMLoop *
l = face->l_first;
433 using VBOType =
typename Converter::VBOType;
451 using VBOType =
typename Converter::VBOType;
458 const BMLoop *
l = face->l_first;
471 return !BM_elem_flag_test_bool(face, BM_ELEM_HIDDEN);
477 free_batches(lines_batches_, lines_batches_.index_range());
478 free_batches(lines_batches_coarse_, lines_batches_coarse_.index_range());
498 free_ibos(lines_ibos_coarse_, nodes_to_free);
500 free_ibos(tris_ibos_coarse_, nodes_to_free);
506 for (AttributeData &
data : attribute_vbos_.
values()) {
541 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
546 const int verts_per_grid = use_flat_layout[
i] ?
square_i(subdiv_ccg.grid_size - 1) * 4 :
548 const int verts_num =
nodes[
i].grids().size() * verts_per_grid;
579 const Span<int> corner_verts = mesh.corner_verts();
596 const Span<int> corner_verts = mesh.corner_verts();
606 if (!sharp_faces.
is_empty() && sharp_faces[face]) {
607 const int face_size =
faces[face].size();
612 for (
const int vert : corner_verts.
slice(
faces[face])) {
630 const Span<int> corner_verts = mesh.corner_verts();
634 if (!
mask.is_empty()) {
638 for (
const int vert : corner_verts.
slice(
faces[face])) {
647 [&](
const int i) { vbos[
i]->
data<
float>().fill(0.0f); });
669 const int id = face_sets[face];
671 uchar4 fset_color(UCHAR_MAX);
672 if (
id != color_default) {
677 fset_color[0] = fset_color[1] = fset_color[2] = UCHAR_MAX;
680 const int face_size =
faces[face].size();
681 std::fill_n(
data, face_size, fset_color);
702 const Span<int> corner_verts = mesh.corner_verts();
710 object,
attribute_format(orig_mesh_data, name, data_type), node_mask, vbos);
713 using T = decltype(dummy);
714 if constexpr (!std::is_void_v<typename AttributeConverter<T>::VBOType>) {
715 const VArraySpan<T> src = attr.varray.typed<T>();
716 switch (attr.domain) {
717 case bke::AttrDomain::Point:
718 extract_data_vert_mesh<T>(faces, corner_verts, src, nodes[i].faces(), *vbos[i]);
720 case bke::AttrDomain::Face:
721 extract_data_face_mesh<T>(faces, src, nodes[i].faces(), *vbos[i]);
723 case bke::AttrDomain::Corner:
724 extract_data_corner_mesh<T>(faces, src, nodes[i].faces(), *vbos[i]);
727 BLI_assert_unreachable();
741 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
747 if (use_flat_layout[
i]) {
748 const int grid_size_1 = key.
grid_size - 1;
749 for (
const int grid :
nodes[
i].grids()) {
751 for (
int y = 0;
y < grid_size_1;
y++) {
752 for (
int x = 0;
x < grid_size_1;
x++) {
766 for (
const int grid :
nodes[
i].grids()) {
768 std::copy_n(grid_positions.
data(), grid_positions.
size(),
data);
783 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
787 const Span<int> grid_to_face_map = subdiv_ccg.grid_to_face_map;
794 if (use_flat_layout[
i]) {
795 const int grid_size_1 = key.
grid_size - 1;
796 for (
const int grid :
nodes[
i].grids()) {
799 if (!sharp_faces.
is_empty() && sharp_faces[grid_to_face_map[grid]]) {
800 for (
int y = 0;
y < grid_size_1;
y++) {
801 for (
int x = 0;
x < grid_size_1;
x++) {
814 for (
int y = 0;
y < grid_size_1;
y++) {
815 for (
int x = 0;
x < grid_size_1;
x++) {
828 for (
const int grid :
nodes[
i].grids()) {
845 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
852 if (use_flat_layout[
i]) {
853 const int grid_size_1 = key.
grid_size - 1;
854 for (
const int grid :
nodes[
i].grids()) {
856 for (
int y = 0;
y < grid_size_1;
y++) {
857 for (
int x = 0;
x < grid_size_1;
x++) {
871 for (
const int grid :
nodes[
i].grids()) {
873 std::copy_n(grid_masks.
data(), grid_masks.
size(),
data);
881 [&](
const int i) { vbos[
i]->
data<
float>().fill(0.0f); });
893 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
897 const Span<int> grid_to_face_map = subdiv_ccg.grid_to_face_map;
911 const int fset = face_sets[grid_to_face_map[grids[
i]]];
912 if (fset != color_default) {
916 std::fill_n(
data, verts_per_grid,
color);
917 data += verts_per_grid;
942 const BMLoop *
l = face->l_first;
943 *
data =
l->prev->v->co;
947 *
data =
l->next->v->co;
969 const BMLoop *
l = face->l_first;
991 const BMesh &
bm = *
object.sculpt->bm;
994 if (cd_offset != -1) {
1003 const BMLoop *
l = face->l_first;
1015 [&](
const int i) { vbos[
i]->
data<
float>().fill(0.0f); });
1026 const BMesh &
bm = *
object.sculpt->bm;
1034 for (
const BMFace *face :
1042 if (fset != color_default) {
1060 operator bool()
const
1069 if (layer.name == name) {
1074 if (layer.name == name) {
1079 if (layer.name == name) {
1084 if (layer.name == name) {
1099 const BMesh &
bm = *
object.sculpt->bm;
1117 using T = decltype(dummy);
1118 const auto &faces = BKE_pbvh_bmesh_node_faces(&const_cast<bke::pbvh::BMeshNode &>(nodes[i]));
1119 if constexpr (!std::is_void_v<typename AttributeConverter<T>::VBOType>) {
1120 switch (attr.domain) {
1121 case bke::AttrDomain::Point:
1122 extract_data_vert_bmesh<T>(faces, attr.offset, *vbos[i]);
1124 case bke::AttrDomain::Face:
1125 extract_data_face_bmesh<T>(faces, attr.offset, *vbos[i]);
1127 case bke::AttrDomain::Corner:
1128 extract_data_corner_bmesh<T>(faces, attr.offset, *vbos[i]);
1131 BLI_assert_unreachable();
1142 int corners_count = 0;
1143 for (
const int face : face_indices) {
1144 if (!hide_poly.
is_empty() && hide_poly[face]) {
1147 corners_count +=
faces[face].size();
1154 int node_corner_offset = 0;
1156 for (
const int face_index : face_indices) {
1157 const int face_size =
faces[face_index].size();
1158 if (!hide_poly.
is_empty() && hide_poly[face_index]) {
1159 node_corner_offset += face_size;
1163 const int next = (
i == face_size - 1) ? 0 :
i + 1;
1168 node_corner_offset += face_size;
1175 const int visible_faces_num)
1190 data[line_index] =
uint2(vert_index, vert_index + 1);
1192 data[line_index] =
uint2(vert_index + 1, vert_index + 2);
1194 data[line_index] =
uint2(vert_index + 2, vert_index);
1212 const int grid_vert_len = gridsize * gridsize;
1213 for (
int i = 0;
i < totgrid;
i++, offset += grid_vert_len) {
1217 grid_hidden[grid_indices[
i]];
1219 for (
int y = 0;
y < gridsize - skip;
y += skip) {
1220 for (
int x = 0;
x < gridsize - skip;
x += skip) {
1249 const int grid_vert_len =
square_uint(gridsize - 1) * 4;
1250 for (
int i = 0;
i < totgrid;
i++, offset += grid_vert_len) {
1252 grid_hidden[grid_indices[
i]];
1255 for (
int y = 0;
y < gridsize - skip;
y += skip) {
1256 for (
int x = 0;
x < gridsize - skip;
x += skip) {
1262 v0 = (
y * (gridsize - 1) +
x) * 4;
1265 v1 = (
y * (gridsize - 1) +
x + skip - 1) * 4;
1266 v2 = ((
y + skip - 1) * (gridsize - 1) +
x + skip - 1) * 4;
1267 v3 = ((
y + skip - 1) * (gridsize - 1) +
x) * 4;
1292 int display_gridsize,
1301 const int grid_vert_len = gridsize * gridsize;
1302 for (
int i = 0;
i < totgrid;
i++, offset += grid_vert_len) {
1304 bool grid_visible =
false;
1307 grid_hidden[grid_indices[
i]];
1309 for (
int y = 0;
y < gridsize - skip;
y += skip) {
1310 for (
int x = 0;
x < gridsize - skip;
x += skip) {
1326 if (
y / skip + 2 == display_gridsize) {
1330 grid_visible =
true;
1342 int display_gridsize,
1351 const int grid_vert_len =
square_uint(gridsize - 1) * 4;
1352 for (
int i = 0;
i < totgrid;
i++, offset += grid_vert_len) {
1353 bool grid_visible =
false;
1355 grid_hidden[grid_indices[
i]];
1358 for (
int y = 0;
y < gridsize - skip;
y += skip) {
1359 for (
int x = 0;
x < gridsize - skip;
x += skip) {
1365 v0 = (
y * (gridsize - 1) +
x) * 4;
1368 v1 = (
y * (gridsize - 1) +
x + skip - 1) * 4;
1369 v2 = ((
y + skip - 1) * (gridsize - 1) +
x + skip - 1) * 4;
1370 v3 = ((
y + skip - 1) * (gridsize - 1) +
x) * 4;
1390 if (
y / skip + 2 == display_gridsize) {
1394 grid_visible =
true;
1409 switch (
pbvh.type()) {
1414 const VArray material_indices = *attributes.
lookup<
int>(
"material_index",
1416 if (!material_indices) {
1421 for (const int i : range) {
1422 const Span<int> face_indices = nodes[i].faces();
1423 if (face_indices.is_empty()) {
1426 node_materials[i] = material_indices[face_indices.first()];
1429 return node_materials;
1435 const VArray material_indices = *attributes.lookup<
int>(
"material_index",
1437 if (!material_indices) {
1444 for (const int i : range) {
1445 const Span<int> grids = nodes[i].grids();
1446 if (grids.is_empty()) {
1449 node_materials[i] = material_indices[grid_faces[grids.first()]];
1452 return node_materials;
1464 switch (
pbvh.type()) {
1477 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
1483 for (const int i : range) {
1484 const Span<int> grids = nodes[i].grids();
1485 if (grids.is_empty()) {
1488 use_flat_layout[i] = std::any_of(grids.begin(), grids.end(), [&](const int grid) {
1489 return sharp_faces[grid_to_face_map[grid]];
1513 for (
const int face : face_indices) {
1514 if (hide_poly[face]) {
1526 int node_corner_offset = 0;
1527 for (
const int face_index : face_indices) {
1529 if (!hide_poly.
is_empty() && hide_poly[face_index]) {
1530 node_corner_offset += face.
size();
1535 const int corner = tri[
i];
1536 const int index_in_face = corner - face.
first();
1537 data[tri_index][
i] = node_corner_offset + index_in_face;
1541 node_corner_offset += face.
size();
1549 const bool do_coarse,
1551 const bool use_flat_layout)
1554 int display_gridsize = gridsize;
1555 int totgrid = grid_indices.
size();
1558 const int display_level = do_coarse ? 0 : key.
level;
1560 if (display_level < key.
level) {
1561 display_gridsize = (1 << display_level) + 1;
1562 skip = 1 << (key.
level - display_level - 1);
1566 grid_hidden, grid_indices, key.
grid_size, display_gridsize);
1573 if (use_flat_layout) {
1585 const bool do_coarse,
1587 const bool use_flat_layout)
1590 int display_gridsize = gridsize;
1591 int totgrid = grid_indices.
size();
1594 const int display_level = do_coarse ? 0 : key.
level;
1596 if (display_level < key.
level) {
1597 display_gridsize = (1 << display_level) + 1;
1598 skip = 1 << (key.
level - display_level - 1);
1603 &builder,
GPU_PRIM_LINES, 2 * totgrid * display_gridsize * (display_gridsize - 1), INT_MAX);
1607 if (use_flat_layout) {
1609 grid_indices, display_gridsize, grid_hidden, gridsize, skip, totgrid,
data);
1613 grid_indices, display_gridsize, grid_hidden, gridsize, skip, totgrid,
data);
1617 &builder, 0, 2 * totgrid * display_gridsize * (display_gridsize - 1),
false));
1621 const OrigMeshData &orig_mesh_data,
1631 node_mask,
GrainSize(8196), memory, [&](
const int i) {
return !ibos[
i]; });
1633 switch (pbvh.
type()) {
1646 const Span<bke::pbvh::GridsNode> nodes = pbvh.
nodes<bke::pbvh::GridsNode>();
1647 nodes_to_calculate.
foreach_index(GrainSize(1), [&](
const int i) {
1648 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
1651 key, subdiv_ccg.
grid_hidden, coarse, nodes[
i].grids(), use_flat_layout_[
i]);
1656 const Span<bke::pbvh::BMeshNode> nodes = pbvh.
nodes<bke::pbvh::BMeshNode>();
1657 nodes_to_calculate.
foreach_index(GrainSize(1), [&](
const int i) {
1659 &
const_cast<bke::pbvh::BMeshNode &
>(nodes[
i]));
1670BitSpan DrawCacheImpl::ensure_use_flat_layout(
const Object &
object,
1674 if (use_flat_layout_.size() != pbvh.nodes_num()) {
1677 return use_flat_layout_;
1687 const OrigMeshData &orig_mesh_data,
1704 node_mask,
GrainSize(8196), memory, [&](
const int i) {
return !vbos[
i]; });
1709 switch (pbvh.
type()) {
1711 if (
const CustomRequest *request_type = std::get_if<CustomRequest>(&attr)) {
1712 switch (*request_type) {
1729 object, orig_mesh_data,
mask, std::get<GenericRequest>(attr), vbos);
1734 if (
const CustomRequest *request_type = std::get_if<CustomRequest>(&attr)) {
1735 switch (*request_type) {
1756 mask.foreach_index(GrainSize(1),
1762 if (
const CustomRequest *request_type = std::get_if<CustomRequest>(&attr)) {
1763 switch (*request_type) {
1780 object, orig_mesh_data,
mask, std::get<GenericRequest>(attr), vbos);
1788 dirty_mask.foreach_index_optimized<
int>([&](
const int i) {
data.dirty_nodes[
i].reset(); });
1795Span<gpu::IndexBufPtr> DrawCacheImpl::ensure_tri_indices(
const Object &
object,
1797 const IndexMask &node_mask,
1801 switch (pbvh.type()) {
1803 const Span<bke::pbvh::MeshNode> nodes = pbvh.nodes<bke::pbvh::MeshNode>();
1805 Vector<gpu::IndexBufPtr> &ibos = tris_ibos_;
1811 IndexMaskMemory memory;
1813 node_mask, GrainSize(8196), memory, [&](
const int i) {
return !ibos[
i]; });
1816 const OffsetIndices<int>
faces = mesh.faces();
1817 const Span<int3> corner_tris = mesh.corner_tris();
1818 const bke::AttributeAccessor attributes = orig_mesh_data.attributes;
1820 nodes_to_calculate.
foreach_index(GrainSize(1), [&](
const int i) {
1833 const Span<bke::pbvh::GridsNode> nodes = pbvh.nodes<bke::pbvh::GridsNode>();
1835 Vector<gpu::IndexBufPtr> &ibos = coarse ? tris_ibos_coarse_ : tris_ibos_;
1836 ibos.resize(nodes.
size());
1841 IndexMaskMemory memory;
1843 node_mask, GrainSize(8196), memory, [&](
const int i) {
return !ibos[
i]; });
1845 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
1848 nodes_to_calculate.
foreach_index(GrainSize(1), [&](
const int i) {
1850 key, subdiv_ccg.grid_hidden, coarse, nodes[
i].grids(), use_flat_layout_[
i]);
1869 this->ensure_use_flat_layout(
object, orig_mesh_data);
1870 this->free_nodes_with_changed_topology(
pbvh);
1876 this->ensure_attribute_data(
object, orig_mesh_data, attr, nodes_to_update);
1883 if (
const AttributeData *attr_data = attribute_vbos_.lookup_ptr(attr)) {
1884 attr_vbos.
append(attr_data->vbos);
1913 this->ensure_use_flat_layout(
object, orig_mesh_data);
1914 this->free_nodes_with_changed_topology(
pbvh);
1939 if (material_indices_.size() !=
pbvh.nodes_num()) {
1944 return material_indices_;
int CCG_grid_xy_to_index(const int grid_size, const int x, const int y)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
const char * CustomData_get_render_layer_name(const CustomData *data, eCustomDataType type)
const char * CustomData_get_active_layer_name(const CustomData *data, eCustomDataType type)
#define CD_TYPE_AS_MASK(_type)
void BKE_paint_face_set_overlay_color_get(int face_set, int seed, uchar r_color[4])
bool paint_is_grid_face_hidden(blender::BoundedBitSpan grid_hidden, int gridsize, int x, int y)
A BVH for high poly meshes.
const blender::Set< BMFace *, 0 > & BKE_pbvh_bmesh_node_faces(blender::bke::pbvh::BMeshNode *node)
CCGKey BKE_subdiv_ccg_key_top_level(const SubdivCCG &subdiv_ccg)
#define BLI_assert_unreachable()
MINLINE int square_i(int a)
MINLINE unsigned int square_uint(unsigned int a)
float normal_quad_v3(float n[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
MINLINE void normal_float_to_short_v3(short out[3], const float in[3])
#define POINTER_OFFSET(v, ofs)
T * DEG_get_original(T *id)
Object is a sort of wrapper for general info.
#define GPU_batch_create(primitive_type, vertex_buf, index_buf)
int GPU_batch_vertbuf_add(blender::gpu::Batch *batch, blender::gpu::VertBuf *vertex_buf, bool own_vbo)
#define GPU_BATCH_DISCARD_SAFE(batch)
blender::MutableSpan< uint32_t > GPU_indexbuf_get_data(GPUIndexBufBuilder *)
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
blender::gpu::IndexBuf * GPU_indexbuf_build_ex(GPUIndexBufBuilder *builder, uint index_min, uint index_max, bool uses_restart_indices)
#define GPU_vertbuf_create_with_format(format)
void GPU_vertbuf_use(blender::gpu::VertBuf *)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
#define BM_elem_flag_test(ele, hflag)
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
unsigned long long int uint64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void foreach_index(Fn &&fn) const
Value & lookup_or_add_default(const Key &key)
ValueIterator values() const &
constexpr int64_t size() const
const CPPType & type() const
static IndexMask from_predicate(const IndexMask &universe, GrainSize grain_size, IndexMaskMemory &memory, Fn &&predicate)
static IndexMask from_bits(BitSpan bits, IndexMaskMemory &memory)
static IndexMask from_union(const IndexMask &mask_a, const IndexMask &mask_b, IndexMaskMemory &memory)
static IndexMask from_intersection(const IndexMask &mask_a, const IndexMask &mask_b, IndexMaskMemory &memory)
constexpr int64_t first() const
constexpr int64_t size() const
constexpr T * data() const
constexpr IndexRange index_range() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr const T * data() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
void append(const T &value)
void resize(const int64_t new_size)
void resize(const int64_t new_size_in_bits, const bool value=false)
GAttributeReader lookup(const StringRef attribute_id) const
Span< NodeT > nodes() const
void tag_visibility_changed(const IndexMask &node_mask) override
void tag_positions_changed(const IndexMask &node_mask) override
~DrawCacheImpl() override
Span< int > ensure_material_indices(const Object &object) override
void tag_attribute_changed(const IndexMask &node_mask, StringRef attribute_name) override
Span< gpu::Batch * > ensure_tris_batches(const Object &object, const ViewportRequest &request, const IndexMask &nodes_to_update) override
void tag_masks_changed(const IndexMask &node_mask) override
void tag_topology_changed(const IndexMask &node_mask) override
void tag_face_sets_changed(const IndexMask &node_mask) override
Span< gpu::Batch * > ensure_lines_batches(const Object &object, const ViewportRequest &request, const IndexMask &nodes_to_update) override
IndexMask slice_content(IndexRange range) const
int64_t min_array_size() const
void set_bits(MutableBitSpan r_bits, int64_t offset=0) const
void foreach_index(Fn &&fn) const
Mesh & DRW_object_get_data_for_drawing(const Object &object)
static float normals[][3]
#define CD_MASK_COLOR_ALL
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
IndexRange grid_range(const int grid_area, const int grid)
int face_triangles_num(const int face_size)
IndexRange face_triangles_range(OffsetIndices< int > faces, int face_i)
pbvh::Tree * pbvh_get(Object &object)
Span< float3 > vert_normals_eval_from_eval(const Object &object_eval)
int count_grid_quads(const BitGroupVector<> &grid_hidden, Span< int > grid_indices, int gridsize, int display_gridsize)
Span< float3 > vert_positions_eval_from_eval(const Object &object_eval)
Span< float3 > face_normals_eval_from_eval(const Object &object_eval)
eCustomDataType cpp_type_to_custom_data_type(const CPPType &type)
void extract_data_vert_mesh(const OffsetIndices< int > faces, const Span< int > corner_verts, const Span< T > attribute, const Span< int > face_indices, gpu::VertBuf &vbo)
static BLI_NOINLINE void flush_vbo_data(const Span< gpu::VertBufPtr > vbos, const IndexMask &node_mask)
static BLI_NOINLINE void update_face_sets_bmesh(const Object &object, const OrigMeshData &orig_mesh_data, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
static BLI_NOINLINE void fill_masks_grids(const Object &object, const BitSpan use_flat_layout, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
static BLI_NOINLINE void ensure_vbos_allocated_bmesh(const Object &object, const GPUVertFormat &format, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
static BLI_NOINLINE void update_positions_bmesh(const Object &object, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
void extract_data_corner_mesh(const OffsetIndices< int > faces, const Span< T > attribute, const Span< int > face_indices, gpu::VertBuf &vbo)
static BMeshAttributeLookup lookup_bmesh_attribute(const BMesh &bm, const StringRef name)
static void update_normals_mesh(const Object &object, const IndexMask &node_mask, MutableSpan< gpu::VertBufPtr > vbos)
static int count_visible_tris_bmesh(const Set< BMFace *, 0 > &faces)
const T & bmesh_cd_loop_get(const BMLoop &loop, const int offset)
static gpu::IndexBufPtr create_lines_index_faces(const OffsetIndices< int > faces, const Span< bool > hide_poly, const Span< int > face_indices)
static BitVector calc_use_flat_layout(const Object &object, const OrigMeshData &orig_mesh_data)
static const GPUVertFormat & normal_format()
static const GPUVertFormat & face_set_format()
DrawCache & ensure_draw_data(std::unique_ptr< bke::pbvh::DrawCache > &ptr)
static const GPUVertFormat & position_format()
static BLI_NOINLINE void update_generic_attribute_mesh(const Object &object, const OrigMeshData &orig_mesh_data, const IndexMask &node_mask, const StringRef name, MutableSpan< gpu::VertBufPtr > vbos)
static BLI_NOINLINE void update_masks_bmesh(const Object &object, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
static void create_lines_index_grids_flat_layout(const Span< int > grid_indices, int display_gridsize, const BitGroupVector<> &grid_hidden, const int gridsize, const int skip, const int totgrid, MutableSpan< uint2 > data)
const T & bmesh_cd_face_get(const BMFace &face, const int offset)
static void create_lines_index_grids(const Span< int > grid_indices, int display_gridsize, const BitGroupVector<> &grid_hidden, const int gridsize, const int skip, const int totgrid, MutableSpan< uint2 > data)
static BLI_NOINLINE void update_generic_attribute_bmesh(const Object &object, const OrigMeshData &orig_mesh_data, const IndexMask &node_mask, const StringRef name, const MutableSpan< gpu::VertBufPtr > vbos)
static GPUVertFormat attribute_format(const OrigMeshData &orig_mesh_data, const StringRef name, const eCustomDataType data_type)
void extract_data_face_bmesh(const Set< BMFace *, 0 > &faces, const int cd_offset, gpu::VertBuf &vbo)
static Array< int > calc_material_indices(const Object &object, const OrigMeshData &orig_mesh_data)
short4 normal_float_to_short(const float3 &value)
static BLI_NOINLINE void free_vbos(const MutableSpan< gpu::VertBufPtr > vbos, const IndexMask &node_mask)
static BLI_NOINLINE void fill_face_sets_grids(const Object &object, const OrigMeshData &orig_mesh_data, const BitSpan use_flat_layout, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
static gpu::IndexBufPtr create_tri_index_mesh(const OffsetIndices< int > faces, const Span< int3 > corner_tris, const Span< bool > hide_poly, const bke::pbvh::MeshNode &node)
static BLI_NOINLINE void free_batches(const MutableSpan< gpu::Batch * > batches, const IndexMask &node_mask)
void extract_data_vert_bmesh(const Set< BMFace *, 0 > &faces, const int cd_offset, gpu::VertBuf &vbo)
void extract_data_face_mesh(const OffsetIndices< int > faces, const Span< T > attribute, const Span< int > face_indices, gpu::VertBuf &vbo)
static BLI_NOINLINE void update_masks_mesh(const Object &object, const OrigMeshData &orig_mesh_data, const IndexMask &node_mask, MutableSpan< gpu::VertBufPtr > vbos)
static void create_tri_index_grids(const Span< int > grid_indices, const BitGroupVector<> &grid_hidden, const int gridsize, const int skip, const int totgrid, MutableSpan< uint3 > data)
static void update_positions_mesh(const Object &object, const IndexMask &node_mask, MutableSpan< gpu::VertBufPtr > vbos)
static BLI_NOINLINE void update_normals_bmesh(const Object &object, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
void extract_data_corner_bmesh(const Set< BMFace *, 0 > &faces, const int cd_offset, gpu::VertBuf &vbo)
static void create_tri_index_grids_flat_layout(const Span< int > grid_indices, const BitGroupVector<> &grid_hidden, const int gridsize, const int skip, const int totgrid, MutableSpan< uint3 > data)
static BLI_NOINLINE void ensure_vbos_allocated_mesh(const Object &object, const GPUVertFormat &format, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
static BLI_NOINLINE void fill_normals_grids(const Object &object, const OrigMeshData &orig_mesh_data, const BitSpan use_flat_layout, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
static BLI_NOINLINE void ensure_vbos_allocated_grids(const Object &object, const GPUVertFormat &format, const BitSpan use_flat_layout, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
static BLI_NOINLINE void fill_positions_grids(const Object &object, const BitSpan use_flat_layout, const IndexMask &node_mask, const MutableSpan< gpu::VertBufPtr > vbos)
static gpu::IndexBufPtr create_lines_index_bmesh(const Set< BMFace *, 0 > &faces, const int visible_faces_num)
static BLI_NOINLINE void free_ibos(const MutableSpan< gpu::IndexBufPtr > ibos, const IndexMask &node_mask)
const T & bmesh_cd_vert_get(const BMVert &vert, const int offset)
static const GPUVertFormat & mask_format()
std::string GenericRequest
static BLI_NOINLINE void update_face_sets_mesh(const Object &object, const OrigMeshData &orig_mesh_data, const IndexMask &node_mask, MutableSpan< gpu::VertBufPtr > vbos)
std::variant< CustomRequest, GenericRequest > AttributeRequest
GPUVertFormat init_format_for_attribute(const eCustomDataType data_type, const StringRef vbo_name)
void DRW_cdlayer_attr_aliases_add(GPUVertFormat *format, const char *base_name, int data_type, blender::StringRef layer_name, bool is_active_render, bool is_active_layer)
std::unique_ptr< IndexBuf, IndexBufDeleter > IndexBufPtr
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))
VecBase< uint32_t, 2 > uint2
blender::VecBase< int16_t, 3 > short3
VecBase< uint32_t, 3 > uint3
blender::VecBase< int16_t, 4 > short4
blender::VecBase< uint8_t, 4 > uchar4
uint64_t get_default_hash(const T &v, const Args &...args)
VecBase< int32_t, 3 > int3
VecBase< float, 3 > float3
blender::BitGroupVector grid_hidden
blender::Span< int > grid_to_face_map
uint64_t operator()(const draw::pbvh::AttributeRequest &value) const
Span< int > faces() const
OrigMeshData(const Mesh &mesh)
bke::AttributeAccessor attributes
Vector< AttributeRequest > attributes