Blender V5.0
scene/pointcloud.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#include "scene/geometry.h"
8
10
11class PointCloud : public Geometry {
12 public:
14
15 /* PointCloud Point */
16 struct Point {
17 int index;
18
19 void bounds_grow(const float3 *points, const float *radius, BoundBox &bounds) const;
20 void bounds_grow(const float3 *points,
21 const float *radius,
22 const Transform &aligned_space,
23 BoundBox &bounds) const;
24 void bounds_grow(const float4 &point, BoundBox &bounds) const;
25
26 float4 motion_key(const float3 *points,
27 const float *radius,
28 const float4 *point_steps,
29 const size_t num_points,
30 const size_t num_steps,
31 const float time,
32 size_t p) const;
33 float4 point_for_step(const float3 *points,
34 const float *radius,
35 const float4 *point_steps,
36 const size_t num_points,
37 const size_t num_steps,
38 const size_t step,
39 size_t p) const;
40 };
41
45
46 /* Constructor/Destructor */
47 PointCloud();
48 ~PointCloud() override;
49
50 /* Geometry */
51 void clear_non_sockets();
52 void clear(const bool preserve_shaders = false) override;
53
54 void resize(const int numpoints);
55 void reserve(const int numpoints);
56 void add_point(const float3 co, const float radius, const int shader = 0);
57
59
60 void compute_bounds() override;
61 void apply_transform(const Transform &tfm, const bool apply_to_motion) override;
62
63 /* Points */
64 Point get_point(const int i) const
65 {
66 Point point = {i};
67 return point;
68 }
69
70 size_t num_points() const
71 {
72 return points.size();
73 }
74
75 size_t num_attributes() const
76 {
77 return 1;
78 }
79
80 /* UDIM */
81 void get_uv_tiles(ustring map, unordered_set<int> &tiles) override;
82
83 PrimitiveType primitive_type() const override;
84
85 /* BVH */
86 void pack(Scene *scene, float4 *packed_points, uint *packed_shader);
87
88 private:
89 friend class BVH2;
90 friend class BVHBuild;
91 friend class BVHSpatialSplit;
92 friend class DiagSplit;
93 friend class EdgeDice;
94 friend class GeometryManager;
95 friend class ObjectManager;
96};
97
unsigned int uint
int motion_step(const float time) const
BoundBox bounds
#define CCL_NAMESPACE_END
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
#define NODE_SOCKET_API_ARRAY(type_, name)
Definition graph/node.h:63
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
PrimitiveType
#define NODE_DECLARE
Definition node_type.h:145
float4 point_for_step(const float3 *points, const float *radius, const float4 *point_steps, const size_t num_points, const size_t num_steps, const size_t step, size_t p) const
void bounds_grow(const float3 *points, const float *radius, BoundBox &bounds) const
float4 motion_key(const float3 *points, const float *radius, const float4 *point_steps, const size_t num_points, const size_t num_steps, const float time, size_t p) const
size_t num_attributes() const
friend class EdgeDice
void pack(Scene *scene, float4 *packed_points, uint *packed_shader)
friend class BVHSpatialSplit
void clear(const bool preserve_shaders=false) override
Point get_point(const int i) const
void resize(const int numpoints)
friend class GeometryManager
void add_point(const float3 co, const float radius, const int shader=0)
void reserve(const int numpoints)
friend class BVH2
friend class ObjectManager
void apply_transform(const Transform &tfm, const bool apply_to_motion) override
friend class BVHBuild
void get_uv_tiles(ustring map, unordered_set< int > &tiles) override
size_t num_points() const
~PointCloud() override
void copy_center_to_motion_step(const int motion_step)
void compute_bounds() override
PrimitiveType primitive_type() const override
friend class DiagSplit
i
Definition text_draw.cc:230