Blender  V3.3
scene/pointcloud.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #pragma once
5 
6 #ifndef __POINTCLOUD_H__
7 # define __POINTCLOUD_H__
8 
9 # include "scene/geometry.h"
10 
12 
13 class PointCloud : public Geometry {
14  public:
16 
17  /* PointCloud Point */
18  struct Point {
19  int index;
20 
21  void bounds_grow(const float3 *points, const float *radius, BoundBox &bounds) const;
22  void bounds_grow(const float3 *points,
23  const float *radius,
24  const Transform &aligned_space,
25  BoundBox &bounds) const;
26  void bounds_grow(const float4 &point, BoundBox &bounds) const;
27 
28  float4 motion_key(const float3 *points,
29  const float *radius,
30  const float3 *point_steps,
31  size_t num_points,
32  size_t num_steps,
33  float time,
34  size_t p) const;
35  float4 point_for_step(const float3 *points,
36  const float *radius,
37  const float3 *point_steps,
38  size_t num_points,
39  size_t num_steps,
40  size_t step,
41  size_t p) const;
42  };
43 
47 
48  /* Constructor/Destructor */
49  PointCloud();
50  ~PointCloud();
51 
52  /* Geometry */
53  void clear(const bool preserver_shaders = false) override;
54 
55  void resize(int numpoints);
56  void reserve(int numpoints);
57  void add_point(float3 loc, float radius, int shader = 0);
58 
60 
61  void compute_bounds() override;
62  void apply_transform(const Transform &tfm, const bool apply_to_motion) override;
63 
64  /* Points */
65  Point get_point(int i) const
66  {
67  Point point = {i};
68  return point;
69  }
70 
71  size_t num_points() const
72  {
73  return points.size();
74  }
75 
76  size_t num_attributes() const
77  {
78  return 1;
79  }
80 
81  /* UDIM */
82  void get_uv_tiles(ustring map, unordered_set<int> &tiles) override;
83 
84  PrimitiveType primitive_type() const override;
85 
86  /* BVH */
87  void pack(Scene *scene, float4 *packed_points, uint *packed_shader);
88 
89  private:
90  friend class BVH2;
91  friend class BVHBuild;
92  friend class BVHSpatialSplit;
93  friend class DiagSplit;
94  friend class EdgeDice;
95  friend class GeometryManager;
96  friend class ObjectManager;
97 };
98 
100 
101 #endif /* __POINTCLOUD_H__ */
unsigned int uint
Definition: BLI_sys_types.h:67
float float4[4]
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 Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise 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 point
Definition: bvh2.h:33
Definition: build.h:34
Definition: dice.h:49
BoundBox bounds
int motion_step(float time) const
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
double time
Scene scene
#define NODE_SOCKET_API_ARRAY(type_, name)
Definition: graph/node.h:62
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
PrimitiveType
Definition: kernel/types.h:549
SocketIndexByIdentifierMap * map
#define NODE_DECLARE
Definition: node_type.h:135
float4 motion_key(const float3 *points, const float *radius, const float3 *point_steps, size_t num_points, size_t num_steps, float time, size_t p) const
float4 point_for_step(const float3 *points, const float *radius, const float3 *point_steps, size_t num_points, size_t num_steps, size_t step, size_t p) const
void bounds_grow(const float3 *points, const float *radius, BoundBox &bounds) const
size_t num_attributes() const
void pack(Scene *scene, float4 *packed_points, uint *packed_shader)
void reserve(int numpoints)
void clear(const bool preserver_shaders=false) override
void apply_transform(const Transform &tfm, const bool apply_to_motion) override
Point get_point(int i) const
void get_uv_tiles(ustring map, unordered_set< int > &tiles) override
size_t num_points() const
void resize(int numpoints)
void copy_center_to_motion_step(const int motion_step)
void compute_bounds() override
PrimitiveType primitive_type() const override
void add_point(float3 loc, float radius, int shader=0)