100 if (cache ==
nullptr) {
114 cache = MEM_new<PointCloudBatchCache>(__func__);
131 if (cache ==
nullptr) {
197 bool do_discard =
false;
242 for (int p : range) {
243 for (int i : IndexRange(tri_count_per_point)) {
244 data[p * tri_count_per_point + i] = uint3(half_octahedron_tris[i]) | (p << 3);
250 &builder, 0, primitive_len * 3,
false, cache.eval_cache.geom_indices);
260 if (
format.attr_len == 0) {
272 for (const int i : range) {
273 vbo_data[i].x = positions[i].x;
274 vbo_data[i].y = positions[i].y;
275 vbo_data[i].z = positions[i].z;
277 vbo_data[i].w = radii_span[i] * 100.0f;
283 for (const int i : range) {
284 vbo_data[i].x = positions[i].x;
285 vbo_data[i].y = positions[i].y;
286 vbo_data[i].z = positions[i].z;
287 vbo_data[i].w = 1.0f;
311 if (
format.attr_len == 0) {
345 const char *name = gpu_attr->name;
416 if (request_i == -1) {
General operations for point clouds.
@ BKE_POINTCLOUD_BATCH_DIRTY_ALL
#define LISTBASE_FOREACH(type, var, list)
MINLINE int max_ii(int a, int b)
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)
#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.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
constexpr IndexRange index_range() const
constexpr int64_t size() 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)
void *(* MEM_callocN)(size_t len, const char *str)
static PointCloudBatchCache * pointcloud_batch_cache_get(PointCloud &pointcloud)
gpu::Batch * pointcloud_surface_get(PointCloud *pointcloud)
void drw_attributes_clear(DRW_Attributes *attributes)
static void pointcloud_extract_position_and_radius(const PointCloud &pointcloud, PointCloudBatchCache &cache)
static void pointcloud_discard_attributes(PointCloudBatchCache &cache)
void DRW_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
bool drw_custom_data_match_attribute(const CustomData &custom_data, const char *name, int *r_layer_index, eCustomDataType *r_type)
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)
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)
int DRW_pointcloud_material_count_get(const PointCloud *pointcloud)
void drw_attributes_merge(DRW_Attributes *dst, const DRW_Attributes *src, std::mutex &render_mutex)
static bool pointcloud_batch_cache_valid(PointCloud &pointcloud)
gpu::VertBuf ** DRW_pointcloud_evaluated_attribute(PointCloud *pointcloud, const char *name)
static void pointcloud_extract_attribute(const PointCloud &pointcloud, PointCloudBatchCache &cache, const DRW_AttributeRequest &request, int index)
void DRW_pointcloud_batch_cache_free(PointCloud *pointcloud)
void drw_attributes_add_request(DRW_Attributes *attrs, const char *name, const eCustomDataType type, const int layer_index, const blender::bke::AttrDomain domain)
gpu::VertBuf * pointcloud_position_and_radius_get(PointCloud *pointcloud)
gpu::VertBuf * DRW_pointcloud_position_and_radius_buffer_get(Object *ob)
bool drw_attributes_overlap(const DRW_Attributes *a, const DRW_Attributes *b)
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
blender::bke::AttrDomain domain
DRW_AttributeRequest requests[GPU_MAX_ATTR]
PointCloudEvalCache eval_cache
DRW_Attributes attr_used_over_time
gpu::VertBuf * attr_viewer
int last_attr_matching_time
gpu::IndexBuf * geom_indices
gpu::VertBuf * attributes_buf[GPU_MAX_ATTR]
gpu::Batch ** surface_per_mat