105 if (cache ==
nullptr) {
119 cache = MEM_new<PointCloudBatchCache>(__func__);
138 if (cache ==
nullptr) {
207 bool do_discard =
false;
242 uint32_t vertid_max = pointcloud.
totpoint << 3;
244 uint32_t primitive_len = pointcloud.
totpoint * tri_count_per_point;
252 for (int p : range) {
253 for (int i : IndexRange(tri_count_per_point)) {
254 data[p * tri_count_per_point + i] = uint3(half_octahedron_tris[i]) | (p << 3);
260 &builder, 0, primitive_len * 3,
false, cache.eval_cache.geom_indices);
284 for (const int i : range) {
285 vbo_data[i].x = positions[i].x;
286 vbo_data[i].y = positions[i].y;
287 vbo_data[i].z = positions[i].z;
288 vbo_data[i].w = radii_span[i];
294 for (const int i : range) {
295 vbo_data[i].x = positions[i].x;
296 vbo_data[i].y = positions[i].y;
297 vbo_data[i].z = positions[i].z;
298 vbo_data[i].w = 0.01f;
424 if (request_i == -1) {
432 const int max_index =
mask.min_array_size();
436 mask.to_indices<
int>(
data.cast<
int>());
446 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.
#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)
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
bool contains(StringRef attribute_id) const
GAttributeReader lookup(const StringRef attribute_id) const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const void *default_value=nullptr) 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)
Mesh & DRW_object_get_data_for_drawing(const Object &object)
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)
void drw_attributes_merge(VectorSet< std::string > *dst, const VectorSet< std::string > *src, Mutex &render_mutex)
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_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