98 if (cache ==
nullptr) {
112 cache = MEM_new<PointCloudBatchCache>(__func__);
131 if (cache ==
nullptr) {
200 bool do_discard =
false;
235 uint32_t vertid_max = pointcloud.
totpoint << 3;
237 uint32_t primitive_len = pointcloud.
totpoint * tri_count_per_point;
243 const uint32_t max_totpoint =
INT32_MAX / uint32_t(tri_count_per_point *
245 if (pointcloud.
totpoint > max_totpoint) {
256 for (int p : range) {
257 for (int i : IndexRange(tri_count_per_point)) {
258 data[p * tri_count_per_point + i] = uint3(half_octahedron_tris[i]) | (p << 3);
264 &builder, 0, primitive_len * 3,
false, cache.eval_cache.geom_indices);
288 for (const int i : range) {
289 vbo_data[i].x = positions[i].x;
290 vbo_data[i].y = positions[i].y;
291 vbo_data[i].z = positions[i].z;
292 vbo_data[i].w = radii_span[i];
298 for (const int i : range) {
299 vbo_data[i].x = positions[i].x;
300 vbo_data[i].y = positions[i].y;
301 vbo_data[i].z = positions[i].z;
302 vbo_data[i].w = 0.01f;
428 if (request_i == -1) {
436 const int max_index =
mask.min_array_size();
440 mask.to_indices<
int>(
data.cast<
int>());
450 if (
mask.is_empty()) {
General operations, lookup, etc. for materials.
int BKE_id_material_used_with_fallback_eval(const ID &id)
General operations for point clouds.
@ BKE_POINTCLOUD_BATCH_DIRTY_ALL
#define LISTBASE_FOREACH(type, var, list)
Object is a sort of wrapper for general info.
T & DRW_object_get_data_for_drawing(const Object &object)
#define GPU_BATCH_DISCARD_SAFE(batch)
void GPU_indexbuf_build_in_place_ex(GPUIndexBufBuilder *builder, uint index_min, uint index_max, bool uses_restart_indices, blender::gpu::IndexBuf *elem)
int GPU_indexbuf_primitive_len(GPUPrimType prim_type)
blender::MutableSpan< uint32_t > GPU_indexbuf_get_data(GPUIndexBufBuilder *)
#define GPU_INDEXBUF_DISCARD_SAFE(elem)
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
ListBase GPU_material_attributes(const GPUMaterial *material)
static constexpr int GPU_MAX_ATTR
#define GPU_VERTBUF_DISCARD_SAFE(verts)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
void GPU_vertbuf_init_with_format_ex(blender::gpu::VertBuf &verts, const GPUVertFormat &format, GPUUsageType)
@ GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY
Read Guarded memory(de)allocation.
BMesh const char void * data
static IndexMask from_bools(Span< bool > bools, IndexMaskMemory &memory)
IndexRange index_range() const
constexpr IndexRange index_range() const
constexpr int64_t size() const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
bool contains(StringRef attribute_id) const
GAttributeReader lookup(const StringRef attribute_id) const
Utilities for rendering attributes.
bool DRW_batch_requested(blender::gpu::Batch *batch, GPUPrimType prim_type)
blender::gpu::Batch * DRW_batch_request(blender::gpu::Batch **batch)
void DRW_vbo_request(blender::gpu::Batch *batch, blender::gpu::VertBuf **vbo)
bool DRW_vbo_requested(blender::gpu::VertBuf *vbo)
void DRW_ibo_request(blender::gpu::Batch *batch, blender::gpu::IndexBuf **ibo)
bool DRW_ibo_requested(blender::gpu::IndexBuf *ibo)
void * MEM_callocN(size_t len, const char *str)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
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)
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)
blender::gpu::Batch * DRW_pointcloud_batch_cache_get_dots(Object *ob)
static void pointcloud_batch_cache_clear(PointCloud &pointcloud)
static void pointcloud_extract_indices(const PointCloud &pointcloud, PointCloudBatchCache &cache)
void DRW_pointcloud_batch_cache_free_old(PointCloud *pointcloud, int ctime)
blender::gpu::Batch * DRW_pointcloud_batch_cache_get_edit_dots(PointCloud *pointcloud)
bool drw_attributes_overlap(const VectorSet< std::string > *a, const VectorSet< std::string > *b)
gpu::VertBuf ** DRW_pointcloud_evaluated_attribute(PointCloud *pointcloud, StringRef name)
static const uint half_octahedron_tris[4][3]
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))
VecBase< uint32_t, 3 > uint3
VecBase< float, 4 > float4
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
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::IndexBuf * geom_indices
gpu::VertBuf * attributes_buf[GPU_MAX_ATTR]
VectorSet< std::string > attr_used_over_time
gpu::Batch ** surface_per_mat