98 if (cache ==
nullptr) {
112 cache = MEM_new<PointCloudBatchCache>(__func__);
131 if (cache ==
nullptr) {
145 for (
const int j :
IndexRange(GPU_MAX_ATTR)) {
199 bool do_discard =
false;
244 for (const int i : range) {
245 vbo_data[i].x = positions[i].x;
246 vbo_data[i].y = positions[i].y;
247 vbo_data[i].z = positions[i].z;
248 vbo_data[i].w = radii_span[i];
254 for (const int i : range) {
255 vbo_data[i].x = positions[i].x;
256 vbo_data[i].y = positions[i].y;
257 vbo_data[i].z = positions[i].z;
258 vbo_data[i].w = 0.01f;
327 for (
const int i :
IndexRange(GPU_MAX_ATTR)) {
399 if (request_i == -1) {
407 const int max_index =
mask.min_array_size();
411 mask.to_indices<
int>(
data.cast<
int>());
417 const VArray selection = *pointcloud.attributes().lookup_or_default<
bool>(
421 if (
mask.is_empty()) {
General operations, lookup, etc. for materials.
General operations for point clouds.
Object is a sort of wrapper for general info.
#define GPU_BATCH_DISCARD_SAFE(batch)
#define GPU_INDEXBUF_DISCARD_SAFE(elem)
#define GPU_VERTBUF_DISCARD_SAFE(verts)
Read Blender memory allocation and freeing.
static IndexMask from_bools(Span< bool > bools, LinearAllocator<> &memory)
constexpr IndexRange()=default
constexpr IndexRange index_range() const
constexpr int64_t size() const
IndexRange index_range() const
GAttributeReader lookup_or_default(StringRef name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
bool contains(StringRef name) const
GAttributeReader lookup(const StringRef name) const
Utilities for rendering attributes.
#define DRW_POINTCLOUD_STRIP_TILE_SIZE
void copy(const GVArray &src, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
void drw_attributes_add_request(VectorSet< std::string > *attrs, const StringRef name)
static PointCloudBatchCache * pointcloud_batch_cache_get(PointCloud &pointcloud)
gpu::Batch * pointcloud_surface_get(PointCloud *pointcloud)
static void pointcloud_extract_attribute(const PointCloud &pointcloud, PointCloudBatchCache &cache, const StringRef name, int index)
static void pointcloud_extract_position_and_radius(const PointCloud &pointcloud, PointCloudBatchCache &cache)
static void build_edit_selection_indices(const PointCloud &pointcloud, gpu::IndexBuf &ibo)
static void pointcloud_discard_attributes(PointCloudBatchCache &cache)
gpu::Batch * DRW_pointcloud_batch_cache_get_edit_dots(Object *ob)
void DRW_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
static void pointcloud_batch_cache_init(PointCloud &pointcloud)
gpu::Batch ** pointcloud_surface_shaded_get(PointCloud *pointcloud, GPUMaterial **gpu_materials, int mat_len)
gpu::Batch * DRW_pointcloud_batch_cache_get_dots(Object *ob)
static void pointcloud_batch_cache_clear(PointCloud &pointcloud)
void DRW_pointcloud_batch_cache_free_old(PointCloud *pointcloud, int ctime)
bool drw_attributes_overlap(const VectorSet< std::string > *a, const VectorSet< std::string > *b)
gpu::VertBuf ** DRW_pointcloud_evaluated_attribute(PointCloud *pointcloud, StringRef name)
gpu::VertBuf ** DRW_gsplat_evaluated_attribute(PointCloud *pointcloud, StringRef name)
void DRW_pointcloud_batch_cache_create_requested(Object *ob)
void DRW_pointcloud_batch_cache_validate(PointCloud *pointcloud)
static void index_mask_to_ibo(const IndexMask &mask, gpu::IndexBuf &ibo)
static bool pointcloud_batch_cache_valid(PointCloud &pointcloud)
void drw_attributes_merge(VectorSet< std::string > *dst, const VectorSet< std::string > *src)
void DRW_pointcloud_batch_cache_free(PointCloud *pointcloud)
gpu::VertBuf * pointcloud_position_and_radius_get(PointCloud *pointcloud)
gpu::VertBuf * DRW_pointcloud_position_and_radius_buffer_get(Object *ob)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ BKE_POINTCLOUD_BATCH_DIRTY_ALL
bool DRW_vbo_requested(gpu::VertBuf *vbo)
gpu::Batch * GPU_batch_create_procedural(GPUPrimType primitive_type, int32_t vertex_count)
void GPU_vertformat_alias_add(GPUVertFormat *, StringRef alias)
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
void GPU_vertbuf_init_with_format_ex(gpu::VertBuf &verts, const GPUVertFormat &format, GPUUsageType)
bool DRW_batch_requested(gpu::Batch *batch, GPUPrimType prim_type)
VecBase< float, 4 > float4
int BKE_id_material_used_with_fallback_eval(const ID &id)
void DRW_ibo_request(gpu::Batch *batch, gpu::IndexBuf **ibo)
void GPU_indexbuf_build_in_place_ex(GPUIndexBufBuilder *builder, uint index_min, uint index_max, bool uses_restart_indices, gpu::IndexBuf *elem)
T & DRW_object_get_data_for_drawing(const Object &object)
BMesh const char void * data
ListBaseT< GPUMaterialAttribute > GPU_material_attributes(const GPUMaterial *material)
MutableSpan< uint32_t > GPU_indexbuf_get_data(GPUIndexBufBuilder *)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
gpu::Batch * DRW_batch_request(gpu::Batch **batch)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
void DRW_vbo_request(gpu::Batch *batch, gpu::VertBuf **vbo)
@ GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool DRW_ibo_requested(gpu::IndexBuf *ibo)
draw::PointCloudBatchCache * pointcloud_batch_cache
PointCloudEvalCache eval_cache
gpu::IndexBuf * edit_selection_indices
gpu::Batch * edit_selection
gpu::VertBuf * attr_viewer
VectorSet< std::string > attr_used
int last_attr_matching_time
gpu::VertBuf * attributes_buf[GPU_MAX_ATTR]
VectorSet< std::string > attr_used_over_time
gpu::Batch ** surface_per_mat