Blender  V2.93
pointcloud.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include "MEM_guardedalloc.h"
22 
23 #include "DNA_defaults.h"
24 #include "DNA_material_types.h"
25 #include "DNA_object_types.h"
26 #include "DNA_pointcloud_types.h"
27 
28 #include "BLI_listbase.h"
29 #include "BLI_math.h"
30 #include "BLI_rand.h"
31 #include "BLI_string.h"
32 #include "BLI_utildefines.h"
33 
34 #include "BKE_anim_data.h"
35 #include "BKE_customdata.h"
36 #include "BKE_geometry_set.hh"
37 #include "BKE_global.h"
38 #include "BKE_idtype.h"
39 #include "BKE_lib_id.h"
40 #include "BKE_lib_query.h"
41 #include "BKE_lib_remap.h"
42 #include "BKE_main.h"
43 #include "BKE_mesh_wrapper.h"
44 #include "BKE_modifier.h"
45 #include "BKE_object.h"
46 #include "BKE_pointcloud.h"
47 
48 #include "BLT_translation.h"
49 
50 #include "DEG_depsgraph_query.h"
51 
52 #include "BLO_read_write.h"
53 
54 /* PointCloud datablock */
55 
56 static void pointcloud_random(PointCloud *pointcloud);
57 
58 const char *POINTCLOUD_ATTR_POSITION = "position";
59 const char *POINTCLOUD_ATTR_RADIUS = "radius";
60 
61 static void pointcloud_init_data(ID *id)
62 {
63  PointCloud *pointcloud = (PointCloud *)id;
64  BLI_assert(MEMCMP_STRUCT_AFTER_IS_ZERO(pointcloud, id));
65 
67 
68  CustomData_reset(&pointcloud->pdata);
69  CustomData_add_layer_named(&pointcloud->pdata,
71  CD_CALLOC,
72  nullptr,
73  pointcloud->totpoint,
76 }
77 
78 static void pointcloud_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
79 {
80  PointCloud *pointcloud_dst = (PointCloud *)id_dst;
81  const PointCloud *pointcloud_src = (const PointCloud *)id_src;
82  pointcloud_dst->mat = static_cast<Material **>(MEM_dupallocN(pointcloud_dst->mat));
83 
84  const eCDAllocType alloc_type = (flag & LIB_ID_COPY_CD_REFERENCE) ? CD_REFERENCE : CD_DUPLICATE;
85  CustomData_copy(&pointcloud_src->pdata,
86  &pointcloud_dst->pdata,
88  alloc_type,
89  pointcloud_dst->totpoint);
91 
92  pointcloud_dst->batch_cache = nullptr;
93 }
94 
95 static void pointcloud_free_data(ID *id)
96 {
97  PointCloud *pointcloud = (PointCloud *)id;
98  BKE_animdata_free(&pointcloud->id, false);
100  CustomData_free(&pointcloud->pdata, pointcloud->totpoint);
101  MEM_SAFE_FREE(pointcloud->mat);
102 }
103 
105 {
106  PointCloud *pointcloud = (PointCloud *)id;
107  for (int i = 0; i < pointcloud->totcol; i++) {
109  }
110 }
111 
112 static void pointcloud_blend_write(BlendWriter *writer, ID *id, const void *id_address)
113 {
114  PointCloud *pointcloud = (PointCloud *)id;
115  if (pointcloud->id.us > 0 || BLO_write_is_undo(writer)) {
116  CustomDataLayer *players = nullptr, players_buff[CD_TEMP_CHUNK_SIZE];
118  &pointcloud->pdata, &players, players_buff, ARRAY_SIZE(players_buff));
119 
120  /* Write LibData */
121  BLO_write_id_struct(writer, PointCloud, id_address, &pointcloud->id);
122  BKE_id_blend_write(writer, &pointcloud->id);
123 
124  /* Direct data */
126  writer, &pointcloud->pdata, players, pointcloud->totpoint, CD_MASK_ALL, &pointcloud->id);
127 
128  BLO_write_pointer_array(writer, pointcloud->totcol, pointcloud->mat);
129  if (pointcloud->adt) {
130  BKE_animdata_blend_write(writer, pointcloud->adt);
131  }
132 
133  /* Remove temporary data. */
134  if (players && players != players_buff) {
135  MEM_freeN(players);
136  }
137  }
138 }
139 
141 {
142  PointCloud *pointcloud = (PointCloud *)id;
143  BLO_read_data_address(reader, &pointcloud->adt);
144  BKE_animdata_blend_read_data(reader, pointcloud->adt);
145 
146  /* Geometry */
147  CustomData_blend_read(reader, &pointcloud->pdata, pointcloud->totpoint);
149 
150  /* Materials */
151  BLO_read_pointer_array(reader, (void **)&pointcloud->mat);
152 }
153 
154 static void pointcloud_blend_read_lib(BlendLibReader *reader, ID *id)
155 {
156  PointCloud *pointcloud = (PointCloud *)id;
157  for (int a = 0; a < pointcloud->totcol; a++) {
158  BLO_read_id_address(reader, pointcloud->id.lib, &pointcloud->mat[a]);
159  }
160 }
161 
162 static void pointcloud_blend_read_expand(BlendExpander *expander, ID *id)
163 {
164  PointCloud *pointcloud = (PointCloud *)id;
165  for (int a = 0; a < pointcloud->totcol; a++) {
166  BLO_expand(expander, pointcloud->mat[a]);
167  }
168 }
169 
171  /* id_code */ ID_PT,
172  /* id_filter */ FILTER_ID_PT,
173  /* main_listbase_index */ INDEX_ID_PT,
174  /* struct_size */ sizeof(PointCloud),
175  /* name */ "PointCloud",
176  /* name_plural */ "pointclouds",
177  /* translation_context */ BLT_I18NCONTEXT_ID_POINTCLOUD,
178  /* flags */ 0,
179 
180  /* init_data */ pointcloud_init_data,
181  /* copy_data */ pointcloud_copy_data,
182  /* free_data */ pointcloud_free_data,
183  /* make_local */ nullptr,
184  /* foreach_id */ pointcloud_foreach_id,
185  /* foreach_cache */ nullptr,
186  /* owner_get */ nullptr,
187 
188  /* blend_write */ pointcloud_blend_write,
189  /* blend_read_data */ pointcloud_blend_read_data,
190  /* blend_read_lib */ pointcloud_blend_read_lib,
191  /* blend_read_expand */ pointcloud_blend_read_expand,
192 
193  /* blend_read_undo_preserve */ nullptr,
194 
195  /* lib_override_apply_post */ nullptr,
196 };
197 
198 static void pointcloud_random(PointCloud *pointcloud)
199 {
200  pointcloud->totpoint = 400;
201  CustomData_realloc(&pointcloud->pdata, pointcloud->totpoint);
203 
204  RNG *rng = BLI_rng_new(0);
205 
206  for (int i = 0; i < pointcloud->totpoint; i++) {
207  pointcloud->co[i][0] = 2.0f * BLI_rng_get_float(rng) - 1.0f;
208  pointcloud->co[i][1] = 2.0f * BLI_rng_get_float(rng) - 1.0f;
209  pointcloud->co[i][2] = 2.0f * BLI_rng_get_float(rng) - 1.0f;
210  pointcloud->radius[i] = 0.05f * BLI_rng_get_float(rng);
211  }
212 
213  BLI_rng_free(rng);
214 }
215 
216 void *BKE_pointcloud_add(Main *bmain, const char *name)
217 {
218  PointCloud *pointcloud = static_cast<PointCloud *>(BKE_id_new(bmain, ID_PT, name));
219 
220  return pointcloud;
221 }
222 
223 void *BKE_pointcloud_add_default(Main *bmain, const char *name)
224 {
225  PointCloud *pointcloud = static_cast<PointCloud *>(BKE_libblock_alloc(bmain, ID_PT, name, 0));
226 
227  pointcloud_init_data(&pointcloud->id);
228 
229  CustomData_add_layer_named(&pointcloud->pdata,
231  CD_CALLOC,
232  nullptr,
233  pointcloud->totpoint,
235  pointcloud_random(pointcloud);
236 
237  return pointcloud;
238 }
239 
241 {
242  PointCloud *pointcloud = static_cast<PointCloud *>(BKE_libblock_alloc(
244 
245  pointcloud_init_data(&pointcloud->id);
246 
247  pointcloud->totpoint = totpoint;
248 
249  CustomData_add_layer_named(&pointcloud->pdata,
251  CD_CALLOC,
252  nullptr,
253  pointcloud->totpoint,
255 
256  pointcloud->totpoint = totpoint;
257  CustomData_realloc(&pointcloud->pdata, pointcloud->totpoint);
259 
260  return pointcloud;
261 }
262 
263 void BKE_pointcloud_minmax(const struct PointCloud *pointcloud, float r_min[3], float r_max[3])
264 {
265  float(*pointcloud_co)[3] = pointcloud->co;
266  float *pointcloud_radius = pointcloud->radius;
267  for (int a = 0; a < pointcloud->totpoint; a++) {
268  float *co = pointcloud_co[a];
269  float radius = (pointcloud_radius) ? pointcloud_radius[a] : 0.0f;
270  const float co_min[3] = {co[0] - radius, co[1] - radius, co[2] - radius};
271  const float co_max[3] = {co[0] + radius, co[1] + radius, co[2] + radius};
272  DO_MIN(co_min, r_min);
273  DO_MAX(co_max, r_max);
274  }
275 }
276 
278 {
279  BLI_assert(ob->type == OB_POINTCLOUD);
280 
281  if (ob->runtime.bb != nullptr && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) {
282  return ob->runtime.bb;
283  }
284 
285  if (ob->runtime.bb == nullptr) {
286  ob->runtime.bb = static_cast<BoundBox *>(MEM_callocN(sizeof(BoundBox), "pointcloud boundbox"));
287  }
288 
290  INIT_MINMAX(min, max);
291  if (ob->runtime.geometry_set_eval != nullptr) {
293  }
294  else {
295  const PointCloud *pointcloud = static_cast<PointCloud *>(ob->data);
296  BKE_pointcloud_minmax(pointcloud, min, max);
297  }
299 
300  return ob->runtime.bb;
301 }
302 
304 {
305  pointcloud->co = static_cast<float(*)[3]>(
307  pointcloud->radius = static_cast<float *>(
309 }
310 
312 {
313  return layer->type == CD_PROP_FLOAT3 && STREQ(layer->name, POINTCLOUD_ATTR_POSITION);
314 }
315 
316 /* Dependency Graph */
317 
318 PointCloud *BKE_pointcloud_new_for_eval(const PointCloud *pointcloud_src, int totpoint)
319 {
320  PointCloud *pointcloud_dst = static_cast<PointCloud *>(BKE_id_new_nomain(ID_PT, nullptr));
321  CustomData_free(&pointcloud_dst->pdata, pointcloud_dst->totpoint);
322 
323  STRNCPY(pointcloud_dst->id.name, pointcloud_src->id.name);
324  pointcloud_dst->mat = static_cast<Material **>(MEM_dupallocN(pointcloud_src->mat));
325  pointcloud_dst->totcol = pointcloud_src->totcol;
326 
327  pointcloud_dst->totpoint = totpoint;
329  &pointcloud_src->pdata, &pointcloud_dst->pdata, CD_MASK_ALL, CD_CALLOC, totpoint);
331 
332  return pointcloud_dst;
333 }
334 
335 PointCloud *BKE_pointcloud_copy_for_eval(struct PointCloud *pointcloud_src, bool reference)
336 {
337  int flags = LIB_ID_COPY_LOCALIZE;
338 
339  if (reference) {
340  flags |= LIB_ID_COPY_CD_REFERENCE;
341  }
342 
343  PointCloud *result = (PointCloud *)BKE_id_copy_ex(nullptr, &pointcloud_src->id, nullptr, flags);
344  return result;
345 }
346 
348  struct Scene *scene,
349  Object *object,
350  GeometrySet &geometry_set)
351 {
352  /* Modifier evaluation modes. */
353  const bool use_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
354  const int required_mode = use_render ? eModifierMode_Render : eModifierMode_Realtime;
355  ModifierApplyFlag apply_flag = use_render ? MOD_APPLY_RENDER : MOD_APPLY_USECACHE;
356  const ModifierEvalContext mectx = {depsgraph, object, apply_flag};
357 
358  /* Get effective list of modifiers to execute. Some effects like shape keys
359  * are added as virtual modifiers before the user created modifiers. */
360  VirtualModifierData virtualModifierData;
361  ModifierData *md = BKE_modifiers_get_virtual_modifierlist(object, &virtualModifierData);
362 
363  /* Evaluate modifiers. */
364  for (; md; md = md->next) {
366 
367  if (!BKE_modifier_is_enabled(scene, md, required_mode)) {
368  continue;
369  }
370 
371  if (mti->modifyGeometrySet) {
372  mti->modifyGeometrySet(md, &mectx, &geometry_set);
373  }
374  }
375 }
376 
378 {
379  if (!geometry_set.has<PointCloudComponent>()) {
380  return nullptr;
381  }
382  PointCloudComponent &pointcloud_component =
384  PointCloud *pointcloud = pointcloud_component.release();
385  if (pointcloud != nullptr) {
386  /* Add back, but as read-only non-owning component. */
387  pointcloud_component.replace(pointcloud, GeometryOwnershipType::ReadOnly);
388  }
389  else {
390  /* The component was empty, we can also remove it. */
391  geometry_set.remove<PointCloudComponent>();
392  }
393  return pointcloud;
394 }
395 
397 {
398  /* Free any evaluated data and restore original data. */
400 
401  /* Evaluate modifiers. */
402  PointCloud *pointcloud = static_cast<PointCloud *>(object->data);
403  GeometrySet geometry_set = GeometrySet::create_with_pointcloud(pointcloud,
405  pointcloud_evaluate_modifiers(depsgraph, scene, object, geometry_set);
406 
407  PointCloud *pointcloud_eval = take_pointcloud_ownership_from_geometry_set(geometry_set);
408 
409  /* If the geometry set did not contain a point cloud, we still create an empty one. */
410  if (pointcloud_eval == nullptr) {
411  pointcloud_eval = BKE_pointcloud_new_nomain(0);
412  }
413 
414  /* Assign evaluated object. */
415  const bool eval_is_owned = pointcloud_eval != pointcloud;
416  BKE_object_eval_assign_data(object, &pointcloud_eval->id, eval_is_owned);
417  object->runtime.geometry_set_eval = new GeometrySet(std::move(geometry_set));
418 }
419 
420 /* Draw Cache */
421 void (*BKE_pointcloud_batch_cache_dirty_tag_cb)(PointCloud *pointcloud, int mode) = nullptr;
422 void (*BKE_pointcloud_batch_cache_free_cb)(PointCloud *pointcloud) = nullptr;
423 
425 {
426  if (pointcloud->batch_cache) {
427  BKE_pointcloud_batch_cache_dirty_tag_cb(pointcloud, mode);
428  }
429 }
430 
432 {
433  if (pointcloud->batch_cache) {
435  }
436 }
typedef float(TangentPoint)[2]
void BKE_animdata_free(struct ID *id, const bool do_id_user)
Definition: anim_data.c:230
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt)
Definition: anim_data.c:1574
void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt)
Definition: anim_data.c:1552
CustomData interface, see also DNA_customdata_types.h.
void CustomData_free(struct CustomData *data, int totelem)
Definition: customdata.c:2239
void CustomData_blend_read(struct BlendDataReader *reader, struct CustomData *data, int count)
Definition: customdata.c:5180
void CustomData_blend_write(struct BlendWriter *writer, struct CustomData *data, CustomDataLayer *layers, int count, CustomDataMask cddata_mask, struct ID *id)
Definition: customdata.c:5073
eCDAllocType
@ CD_REFERENCE
@ CD_CALLOC
@ CD_DUPLICATE
void CustomData_blend_write_prepare(struct CustomData *data, struct CustomDataLayer **r_write_layers, struct CustomDataLayer *write_layers_buff, size_t write_layers_size)
Definition: customdata.c:4237
void * CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem, const char *name)
Definition: customdata.c:2637
void * CustomData_get_layer_named(const struct CustomData *data, int type, const char *name)
Definition: customdata.c:3217
void CustomData_copy(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
Definition: customdata.c:2193
void CustomData_realloc(struct CustomData *data, int totelem)
Definition: customdata.c:2180
void CustomData_reset(struct CustomData *data)
Definition: customdata.c:2233
const char * BKE_idtype_idcode_to_name(const short idcode)
Definition: idtype.c:168
void * BKE_id_new_nomain(const short type, const char *name)
Definition: lib_id.c:1196
@ LIB_ID_CREATE_LOCALIZE
Definition: BKE_lib_id.h:142
@ LIB_ID_COPY_CD_REFERENCE
Definition: BKE_lib_id.h:122
@ LIB_ID_COPY_LOCALIZE
Definition: BKE_lib_id.h:145
void * BKE_libblock_alloc(struct Main *bmain, short type, const char *name, const int flag) ATTR_WARN_UNUSED_RESULT
Definition: lib_id.c:1062
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, const int flag)
void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id)
Definition: lib_id.c:2395
void * BKE_id_new(struct Main *bmain, const short type, const char *name)
Definition: lib_id.c:1177
#define BKE_LIB_FOREACHID_PROCESS(_data, _id_super, _cb_flag)
@ IDWALK_CB_USER
Definition: BKE_lib_query.h:87
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
bool BKE_modifier_is_enabled(const struct Scene *scene, struct ModifierData *md, int required_mode)
struct ModifierData * BKE_modifiers_get_virtual_modifierlist(const struct Object *ob, struct VirtualModifierData *data)
ModifierApplyFlag
Definition: BKE_modifier.h:126
@ MOD_APPLY_USECACHE
Definition: BKE_modifier.h:131
@ MOD_APPLY_RENDER
Definition: BKE_modifier.h:128
General operations, lookup, etc. for blender objects.
void BKE_boundbox_init_from_minmax(struct BoundBox *bb, const float min[3], const float max[3])
Definition: object.c:3778
void BKE_object_free_derived_caches(struct Object *ob)
Definition: object.c:1719
void BKE_object_eval_assign_data(struct Object *object, struct ID *data, bool is_owned)
Definition: object.c:1687
General operations for point-clouds.
#define BLI_assert(a)
Definition: BLI_assert.h:58
Random number functions.
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
Definition: rand.cc:76
struct RNG * BLI_rng_new(unsigned int seed)
Definition: rand.cc:54
float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: rand.cc:120
#define STRNCPY(dst, src)
Definition: BLI_string.h:163
#define INIT_MINMAX(min, max)
#define ARRAY_SIZE(arr)
#define UNUSED(x)
#define DO_MAX(vec, max)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define DO_MIN(vec, min)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define STREQ(a, b)
#define BLO_read_data_address(reader, ptr_p)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_read_id_address(reader, lib, id_ptr_p)
#define BLO_expand(expander, id)
void BLO_read_pointer_array(BlendDataReader *reader, void **ptr_p)
Definition: readfile.c:5727
bool BLO_write_is_undo(BlendWriter *writer)
Definition: writefile.c:1412
void BLO_write_pointer_array(BlendWriter *writer, uint num, const void *data_ptr)
Definition: writefile.c:1388
#define BLT_I18NCONTEXT_ID_POINTCLOUD
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
@ DAG_EVAL_RENDER
Definition: DEG_depsgraph.h:62
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
#define FILTER_ID_PT
Definition: DNA_ID.h:737
@ INDEX_ID_PT
Definition: DNA_ID.h:831
@ ID_PT
Definition: DNA_ID_enums.h:94
#define CD_MASK_ALL
@ CD_PROP_FLOAT
@ CD_PROP_FLOAT3
#define CD_TEMP_CHUNK_SIZE
#define DNA_struct_default_get(struct_name)
Definition: DNA_defaults.h:44
@ eModifierMode_Render
@ eModifierMode_Realtime
ModifierType
Object is a sort of wrapper for general info.
@ BOUNDBOX_DIRTY
@ OB_POINTCLOUD
struct PointCloud PointCloud
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
void replace(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
Scene scene
const Depsgraph * depsgraph
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:42
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static unsigned a[3]
Definition: RandGen.cpp:92
void BKE_pointcloud_update_customdata_pointers(PointCloud *pointcloud)
Definition: pointcloud.cc:303
void BKE_pointcloud_data_update(struct Depsgraph *depsgraph, struct Scene *scene, Object *object)
Definition: pointcloud.cc:396
static void pointcloud_init_data(ID *id)
Definition: pointcloud.cc:61
static void pointcloud_evaluate_modifiers(struct Depsgraph *depsgraph, struct Scene *scene, Object *object, GeometrySet &geometry_set)
Definition: pointcloud.cc:347
static void pointcloud_free_data(ID *id)
Definition: pointcloud.cc:95
static void pointcloud_foreach_id(ID *id, LibraryForeachIDData *data)
Definition: pointcloud.cc:104
const char * POINTCLOUD_ATTR_RADIUS
Definition: pointcloud.cc:59
static void pointcloud_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag)
Definition: pointcloud.cc:78
PointCloud * BKE_pointcloud_new_for_eval(const PointCloud *pointcloud_src, int totpoint)
Definition: pointcloud.cc:318
void BKE_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
Definition: pointcloud.cc:424
void BKE_pointcloud_batch_cache_free(PointCloud *pointcloud)
Definition: pointcloud.cc:431
static PointCloud * take_pointcloud_ownership_from_geometry_set(GeometrySet &geometry_set)
Definition: pointcloud.cc:377
BoundBox * BKE_pointcloud_boundbox_get(Object *ob)
Definition: pointcloud.cc:277
void BKE_pointcloud_minmax(const struct PointCloud *pointcloud, float r_min[3], float r_max[3])
Definition: pointcloud.cc:263
PointCloud * BKE_pointcloud_copy_for_eval(struct PointCloud *pointcloud_src, bool reference)
Definition: pointcloud.cc:335
void * BKE_pointcloud_add_default(Main *bmain, const char *name)
Definition: pointcloud.cc:223
IDTypeInfo IDType_ID_PT
Definition: pointcloud.cc:170
bool BKE_pointcloud_customdata_required(PointCloud *UNUSED(pointcloud), CustomDataLayer *layer)
Definition: pointcloud.cc:311
static void pointcloud_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: pointcloud.cc:112
static void pointcloud_blend_read_lib(BlendLibReader *reader, ID *id)
Definition: pointcloud.cc:154
static void pointcloud_blend_read_data(BlendDataReader *reader, ID *id)
Definition: pointcloud.cc:140
const char * POINTCLOUD_ATTR_POSITION
Definition: pointcloud.cc:58
static void pointcloud_random(PointCloud *pointcloud)
Definition: pointcloud.cc:198
PointCloud * BKE_pointcloud_new_nomain(const int totpoint)
Definition: pointcloud.cc:240
void(* BKE_pointcloud_batch_cache_free_cb)(PointCloud *pointcloud)
Definition: pointcloud.cc:422
void * BKE_pointcloud_add(Main *bmain, const char *name)
Definition: pointcloud.cc:216
void(* BKE_pointcloud_batch_cache_dirty_tag_cb)(PointCloud *pointcloud, int mode)
Definition: pointcloud.cc:421
static void pointcloud_blend_read_expand(BlendExpander *expander, ID *id)
Definition: pointcloud.cc:162
#define min(a, b)
Definition: sort.c:51
void remove(const GeometryComponentType component_type)
GeometryComponent & get_component_for_write(GeometryComponentType component_type)
void compute_boundbox_without_instances(blender::float3 *r_min, blender::float3 *r_max) const
bool has(const GeometryComponentType component_type) const
static GeometrySet create_with_pointcloud(PointCloud *pointcloud, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
Definition: DNA_ID.h:273
struct Library * lib
Definition: DNA_ID.h:277
int us
Definition: DNA_ID.h:293
char name[66]
Definition: DNA_ID.h:283
Definition: BKE_main.h:116
struct ModifierData * next
void(* modifyGeometrySet)(struct ModifierData *md, const struct ModifierEvalContext *ctx, struct GeometrySet *geometry_set)
Definition: BKE_modifier.h:257
struct GeometrySet * geometry_set_eval
struct BoundBox * bb
Object_Runtime runtime
void * data
struct Material ** mat
struct AnimData * adt
float(* co)[3]
struct CustomData pdata
Definition: rand.cc:48
float max