46 if (
const CustomRequest *request_type = std::get_if<CustomRequest>(&value)) {
49 const GenericRequest &attr = std::get<GenericRequest>(value);
93 struct AttributeData {
108 void tag_dirty(
const IndexMask &node_mask);
163 const IndexMask &nodes_to_update)
override;
167 const IndexMask &nodes_to_update)
override;
196void DrawCacheImpl::AttributeData::tag_dirty(
const IndexMask &node_mask)
199 node_mask.
set_bits(this->dirty_nodes);
205 data->tag_dirty(node_mask);
208 data->tag_dirty(node_mask);
214 dirty_topology_.resize(std::max(dirty_topology_.size(), node_mask.
min_array_size()),
false);
215 node_mask.
set_bits(dirty_topology_);
228 data->tag_dirty(node_mask);
235 data->tag_dirty(node_mask);
241 for (
const auto &[data_request,
data] : attribute_vbos_.items()) {
242 if (
const GenericRequest *request = std::get_if<GenericRequest>(&data_request)) {
243 if (*request == attribute_name) {
244 data.tag_dirty(node_mask);
253 ptr = std::make_unique<DrawCacheImpl>();
263 mask.foreach_index([&](
const int i) { ibos[
i].reset(); });
271 mask.foreach_index([&](
const int i) { vbos[
i].reset(); });
285 "pos", gpu::VertAttrType::SFLOAT_32_32_32);
292 "nor", gpu::VertAttrType::SNORM_16_16_16_16);
299 gpu::VertAttrType::SFLOAT_32);
306 "fset", gpu::VertAttrType::UNORM_8_8_8_8);
316 bool is_render, is_active;
317 const char *prefix =
"a";
349 using VBOType =
typename Converter::VBOType;
351 for (
const int face : face_indices) {
352 for (
const int vert : corner_verts.
slice(
faces[face])) {
353 *
data = Converter::convert(attribute[vert]);
366 using VBOType =
typename Converter::VBOType;
369 for (
const int face : face_indices) {
370 const int face_size =
faces[face].size();
371 std::fill_n(
data, face_size, Converter::convert(attribute[face]));
383 using VBOType =
typename Converter::VBOType;
386 for (
const int face : face_indices) {
387 for (
const int corner :
faces[face]) {
388 *
data = Converter::convert(attribute[corner]);
413 using VBOType =
typename Converter::VBOType;
420 const BMLoop *
l = face->l_first;
434 using VBOType =
typename Converter::VBOType;
452 using VBOType =
typename Converter::VBOType;
459 const BMLoop *
l = face->l_first;
472 return !BM_elem_flag_test_bool(face, BM_ELEM_HIDDEN);
478 free_batches(lines_batches_, lines_batches_.index_range());
479 free_batches(lines_batches_coarse_, lines_batches_coarse_.index_range());
499 free_ibos(lines_ibos_coarse_, nodes_to_free);
501 free_ibos(tris_ibos_coarse_, nodes_to_free);
507 for (AttributeData &
data : attribute_vbos_.
values()) {
542 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
547 const int verts_per_grid = use_flat_layout[
i] ?
square_i(subdiv_ccg.grid_size - 1) * 4 :
549 const int verts_num =
nodes[
i].grids().size() * verts_per_grid;
580 const Span<int> corner_verts = mesh.corner_verts();
597 const Span<int> corner_verts = mesh.corner_verts();
607 if (!sharp_faces.
is_empty() && sharp_faces[face]) {
608 const int face_size =
faces[face].size();
613 for (
const int vert : corner_verts.
slice(
faces[face])) {
631 const Span<int> corner_verts = mesh.corner_verts();
635 if (!
mask.is_empty()) {
639 for (
const int vert : corner_verts.
slice(
faces[face])) {
648 [&](
const int i) { vbos[
i]->
data<
float>().fill(0.0f); });
670 const int id = face_sets[face];
672 uchar4 fset_color(UCHAR_MAX);
673 if (
id != color_default) {
678 fset_color[0] = fset_color[1] = fset_color[2] = UCHAR_MAX;
681 const int face_size =
faces[face].size();
682 std::fill_n(
data, face_size, fset_color);
703 const Span<int> corner_verts = mesh.corner_verts();
714 using T = decltype(dummy);
715 if constexpr (!std::is_void_v<typename AttributeConverter<T>::VBOType>) {
716 const VArraySpan<T> src = attr.varray.typed<T>();
717 switch (attr.domain) {
718 case bke::AttrDomain::Point:
719 extract_data_vert_mesh<T>(faces, corner_verts, src, nodes[i].faces(), *vbos[i]);
721 case bke::AttrDomain::Face:
722 extract_data_face_mesh<T>(faces, src, nodes[i].faces(), *vbos[i]);
724 case bke::AttrDomain::Corner:
725 extract_data_corner_mesh<T>(faces, src, nodes[i].faces(), *vbos[i]);
728 BLI_assert_unreachable();
742 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
748 if (use_flat_layout[
i]) {
749 const int grid_size_1 = key.
grid_size - 1;
750 for (
const int grid :
nodes[
i].grids()) {
752 for (
int y = 0;
y < grid_size_1;
y++) {
753 for (
int x = 0;
x < grid_size_1;
x++) {
767 for (
const int grid :
nodes[
i].grids()) {
769 std::copy_n(grid_positions.
data(), grid_positions.
size(),
data);
784 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
788 const Span<int> grid_to_face_map = subdiv_ccg.grid_to_face_map;
795 if (use_flat_layout[
i]) {
796 const int grid_size_1 = key.
grid_size - 1;
797 for (
const int grid :
nodes[
i].grids()) {
800 if (!sharp_faces.
is_empty() && sharp_faces[grid_to_face_map[grid]]) {
801 for (
int y = 0;
y < grid_size_1;
y++) {
802 for (
int x = 0;
x < grid_size_1;
x++) {
815 for (
int y = 0;
y < grid_size_1;
y++) {
816 for (
int x = 0;
x < grid_size_1;
x++) {
829 for (
const int grid :
nodes[
i].grids()) {
846 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
853 if (use_flat_layout[
i]) {
854 const int grid_size_1 = key.
grid_size - 1;
855 for (
const int grid :
nodes[
i].grids()) {
857 for (
int y = 0;
y < grid_size_1;
y++) {
858 for (
int x = 0;
x < grid_size_1;
x++) {
872 for (
const int grid :
nodes[
i].grids()) {
874 std::copy_n(grid_masks.
data(), grid_masks.
size(),
data);
882 [&](
const int i) { vbos[
i]->
data<
float>().fill(0.0f); });
894 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
898 const Span<int> grid_to_face_map = subdiv_ccg.grid_to_face_map;
912 const int fset = face_sets[grid_to_face_map[grids[
i]]];
913 if (fset != color_default) {
917 std::fill_n(
data, verts_per_grid,
color);
918 data += verts_per_grid;
943 const BMLoop *
l = face->l_first;
944 *
data =
l->prev->v->co;
948 *
data =
l->next->v->co;
970 const BMLoop *
l = face->l_first;
992 const BMesh &
bm = *
object.sculpt->bm;
995 if (cd_offset != -1) {
1004 const BMLoop *
l = face->l_first;
1016 [&](
const int i) { vbos[
i]->
data<
float>().fill(0.0f); });
1027 const BMesh &
bm = *
object.sculpt->bm;
1035 for (
const BMFace *face :
1043 if (fset != color_default) {
1065 const BMesh &
bm = *
object.sculpt->bm;
1074 using T = decltype(dummy);
1075 const auto &faces = BKE_pbvh_bmesh_node_faces(&const_cast<bke::pbvh::BMeshNode &>(nodes[i]));
1076 if constexpr (!std::is_void_v<typename AttributeConverter<T>::VBOType>) {
1077 switch (attr.domain) {
1078 case bke::AttrDomain::Point:
1079 extract_data_vert_bmesh<T>(faces, attr.offset, *vbos[i]);
1081 case bke::AttrDomain::Face:
1082 extract_data_face_bmesh<T>(faces, attr.offset, *vbos[i]);
1084 case bke::AttrDomain::Corner:
1085 extract_data_corner_bmesh<T>(faces, attr.offset, *vbos[i]);
1088 BLI_assert_unreachable();
1099 int corners_count = 0;
1100 for (
const int face : face_indices) {
1101 if (!hide_poly.
is_empty() && hide_poly[face]) {
1104 corners_count +=
faces[face].size();
1111 int node_corner_offset = 0;
1113 for (
const int face_index : face_indices) {
1114 const int face_size =
faces[face_index].size();
1115 if (!hide_poly.
is_empty() && hide_poly[face_index]) {
1116 node_corner_offset += face_size;
1120 const int next = (
i == face_size - 1) ? 0 :
i + 1;
1125 node_corner_offset += face_size;
1132 const int visible_faces_num)
1147 data[line_index] =
uint2(vert_index, vert_index + 1);
1149 data[line_index] =
uint2(vert_index + 1, vert_index + 2);
1151 data[line_index] =
uint2(vert_index + 2, vert_index);
1169 const int grid_vert_len = gridsize * gridsize;
1170 for (
int i = 0;
i < totgrid;
i++, offset += grid_vert_len) {
1174 grid_hidden[grid_indices[
i]];
1176 for (
int y = 0;
y < gridsize - skip;
y += skip) {
1177 for (
int x = 0;
x < gridsize - skip;
x += skip) {
1208 const int grid_vert_len =
square_uint(gridsize - 1) * 4;
1209 for (
int i = 0;
i < totgrid;
i++, offset += grid_vert_len) {
1211 grid_hidden[grid_indices[
i]];
1214 for (
int y = 0;
y < gridsize - skip;
y += skip) {
1215 for (
int x = 0;
x < gridsize - skip;
x += skip) {
1221 v0 = (
y * (gridsize - 1) +
x) * 4;
1224 v1 = (
y * (gridsize - 1) +
x + skip - 1) * 4;
1225 v2 = ((
y + skip - 1) * (gridsize - 1) +
x + skip - 1) * 4;
1226 v3 = ((
y + skip - 1) * (gridsize - 1) +
x) * 4;
1252 int display_gridsize,
1261 const int grid_vert_len = gridsize * gridsize;
1262 for (
int i = 0;
i < totgrid;
i++, offset += grid_vert_len) {
1264 bool grid_visible =
false;
1267 grid_hidden[grid_indices[
i]];
1269 for (
int y = 0;
y < gridsize - skip;
y += skip) {
1270 for (
int x = 0;
x < gridsize - skip;
x += skip) {
1286 if (
y / skip + 2 == display_gridsize) {
1290 grid_visible =
true;
1302 int display_gridsize,
1311 const int grid_vert_len =
square_uint(gridsize - 1) * 4;
1312 for (
int i = 0;
i < totgrid;
i++, offset += grid_vert_len) {
1313 bool grid_visible =
false;
1315 grid_hidden[grid_indices[
i]];
1318 for (
int y = 0;
y < gridsize - skip;
y += skip) {
1319 for (
int x = 0;
x < gridsize - skip;
x += skip) {
1325 v0 = (
y * (gridsize - 1) +
x) * 4;
1328 v1 = (
y * (gridsize - 1) +
x + skip - 1) * 4;
1329 v2 = ((
y + skip - 1) * (gridsize - 1) +
x + skip - 1) * 4;
1330 v3 = ((
y + skip - 1) * (gridsize - 1) +
x) * 4;
1350 if (
y / skip + 2 == display_gridsize) {
1354 grid_visible =
true;
1369 switch (
pbvh.type()) {
1374 const VArray material_indices = *attributes.
lookup<
int>(
"material_index",
1376 if (!material_indices) {
1381 for (const int i : range) {
1382 const Span<int> face_indices = nodes[i].faces();
1383 if (face_indices.is_empty()) {
1386 node_materials[i] = material_indices[face_indices.first()];
1389 return node_materials;
1395 const VArray material_indices = *attributes.lookup<
int>(
"material_index",
1397 if (!material_indices) {
1404 for (const int i : range) {
1405 const Span<int> grids = nodes[i].grids();
1406 if (grids.is_empty()) {
1409 node_materials[i] = material_indices[grid_faces[grids.first()]];
1412 return node_materials;
1424 switch (
pbvh.type()) {
1437 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
1443 for (const int i : range) {
1444 const Span<int> grids = nodes[i].grids();
1445 if (grids.is_empty()) {
1448 use_flat_layout[i] = std::any_of(grids.begin(), grids.end(), [&](const int grid) {
1449 return sharp_faces[grid_to_face_map[grid]];
1473 for (
const int face : face_indices) {
1474 if (hide_poly[face]) {
1486 int node_corner_offset = 0;
1487 for (
const int face_index : face_indices) {
1489 if (!hide_poly.
is_empty() && hide_poly[face_index]) {
1490 node_corner_offset += face.
size();
1495 const int corner = tri[
i];
1496 const int index_in_face = corner - face.
first();
1497 data[tri_index][
i] = node_corner_offset + index_in_face;
1501 node_corner_offset += face.
size();
1509 const bool do_coarse,
1511 const bool use_flat_layout)
1514 int display_gridsize = gridsize;
1515 int totgrid = grid_indices.
size();
1518 const int display_level = do_coarse ? 0 : key.
level;
1520 if (display_level < key.
level) {
1521 display_gridsize = (1 << display_level) + 1;
1522 skip = 1 << (key.
level - display_level - 1);
1526 grid_hidden, grid_indices, key.
grid_size, display_gridsize);
1534 if (use_flat_layout) {
1536 grid_indices, grid_hidden, gridsize, skip, totgrid,
data);
1544 builder.
index_max = 6 * visible_quad_len;
1553 const bool do_coarse,
1555 const bool use_flat_layout)
1558 int display_gridsize = gridsize;
1559 int totgrid = grid_indices.
size();
1562 const int display_level = do_coarse ? 0 : key.
level;
1564 if (display_level < key.
level) {
1565 display_gridsize = (1 << display_level) + 1;
1566 skip = 1 << (key.
level - display_level - 1);
1571 &builder,
GPU_PRIM_LINES, 2 * totgrid * display_gridsize * (display_gridsize - 1), INT_MAX);
1575 if (use_flat_layout) {
1577 grid_indices, display_gridsize, grid_hidden, gridsize, skip, totgrid,
data);
1581 grid_indices, display_gridsize, grid_hidden, gridsize, skip, totgrid,
data);
1585 &builder, 0, 2 * totgrid * display_gridsize * (display_gridsize - 1),
false));
1589 const OrigMeshData &orig_mesh_data,
1599 node_mask,
GrainSize(8196), memory, [&](
const int i) {
return !ibos[
i]; });
1601 switch (pbvh.
type()) {
1614 const Span<bke::pbvh::GridsNode> nodes = pbvh.
nodes<bke::pbvh::GridsNode>();
1615 nodes_to_calculate.
foreach_index(GrainSize(1), [&](
const int i) {
1616 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
1619 key, subdiv_ccg.
grid_hidden, coarse, nodes[
i].grids(), use_flat_layout_[
i]);
1624 const Span<bke::pbvh::BMeshNode> nodes = pbvh.
nodes<bke::pbvh::BMeshNode>();
1625 nodes_to_calculate.
foreach_index(GrainSize(1), [&](
const int i) {
1627 &
const_cast<bke::pbvh::BMeshNode &
>(nodes[
i]));
1638BitSpan DrawCacheImpl::ensure_use_flat_layout(
const Object &
object,
1642 if (use_flat_layout_.size() != pbvh.nodes_num()) {
1645 return use_flat_layout_;
1655 const OrigMeshData &orig_mesh_data,
1672 node_mask,
GrainSize(8196), memory, [&](
const int i) {
return !vbos[
i]; });
1677 switch (pbvh.
type()) {
1679 if (
const CustomRequest *request_type = std::get_if<CustomRequest>(&attr)) {
1680 switch (*request_type) {
1697 object, orig_mesh_data,
mask, std::get<GenericRequest>(attr), vbos);
1702 if (
const CustomRequest *request_type = std::get_if<CustomRequest>(&attr)) {
1703 switch (*request_type) {
1725 mask.foreach_index(GrainSize(1),
1731 if (
const CustomRequest *request_type = std::get_if<CustomRequest>(&attr)) {
1732 switch (*request_type) {
1749 object, orig_mesh_data,
mask, std::get<GenericRequest>(attr), vbos);
1757 dirty_mask.foreach_index_optimized<
int>([&](
const int i) {
data.dirty_nodes[
i].reset(); });
1764Span<gpu::IndexBufPtr> DrawCacheImpl::ensure_tri_indices(
const Object &
object,
1766 const IndexMask &node_mask,
1770 switch (pbvh.type()) {
1772 const Span<bke::pbvh::MeshNode> nodes = pbvh.nodes<bke::pbvh::MeshNode>();
1774 Vector<gpu::IndexBufPtr> &ibos = tris_ibos_;
1780 IndexMaskMemory memory;
1782 node_mask, GrainSize(8196), memory, [&](
const int i) {
return !ibos[
i]; });
1785 const OffsetIndices<int>
faces = mesh.faces();
1786 const Span<int3> corner_tris = mesh.corner_tris();
1787 const bke::AttributeAccessor attributes = orig_mesh_data.attributes;
1789 nodes_to_calculate.
foreach_index(GrainSize(1), [&](
const int i) {
1802 const Span<bke::pbvh::GridsNode> nodes = pbvh.nodes<bke::pbvh::GridsNode>();
1804 Vector<gpu::IndexBufPtr> &ibos = coarse ? tris_ibos_coarse_ : tris_ibos_;
1805 ibos.resize(nodes.
size());
1810 IndexMaskMemory memory;
1812 node_mask, GrainSize(8196), memory, [&](
const int i) {
return !ibos[
i]; });
1814 const SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
1817 nodes_to_calculate.
foreach_index(GrainSize(1), [&](
const int i) {
1819 key, subdiv_ccg.grid_hidden, coarse, nodes[
i].grids(), use_flat_layout_[
i]);
1838 this->ensure_use_flat_layout(
object, orig_mesh_data);
1839 this->free_nodes_with_changed_topology(
pbvh);
1845 this->ensure_attribute_data(
object, orig_mesh_data, attr, nodes_to_update);
1852 if (
const AttributeData *attr_data = attribute_vbos_.lookup_ptr(attr)) {
1853 attr_vbos.
append(attr_data->vbos);
1882 this->ensure_use_flat_layout(
object, orig_mesh_data);
1883 this->free_nodes_with_changed_topology(
pbvh);
1908 if (material_indices_.size() !=
pbvh.nodes_num()) {
1913 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.
eCustomDataMask CD_TYPE_AS_MASK(eCustomDataType type)
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)
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.
T & DRW_object_get_data_for_drawing(const Object &object)
#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)
blender::gpu::IndexBuf * GPU_indexbuf_calloc()
void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *, blender::gpu::IndexBuf *)
void GPU_vertbuf_use(blender::gpu::VertBuf *)
static blender::gpu::VertBuf * GPU_vertbuf_create_with_format(const GPUVertFormat &format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
#define BM_elem_flag_test(ele, hflag)
BMDataLayerLookup BM_data_layer_lookup(const BMesh &bm, const blender::StringRef name)
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
static float normals[][3]
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)
std::optional< eCustomDataType > attr_type_to_custom_data_type(AttrType attr_type)
AttrType cpp_type_to_attribute_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 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 int 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)
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 GPUVertFormat attribute_format(const OrigMeshData &orig_mesh_data, const StringRef name, const bke::AttrType data_type)
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 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)
static int 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)
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
void DRW_cdlayer_attr_aliases_add(GPUVertFormat *format, const char *base_name, bke::AttrType data_type, blender::StringRef layer_name, bool is_active_render, bool is_active_layer)
GPUVertFormat init_format_for_attribute(const bke::AttrType data_type, const StringRef vbo_name)
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::bke::AttrType type
blender::bke::AttrDomain domain
bool uses_restart_indices
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