Blender V4.3
embree.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2018-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#ifndef __BVH_EMBREE_H__
6#define __BVH_EMBREE_H__
7
8#ifdef WITH_EMBREE
9
10# if EMBREE_MAJOR_VERSION >= 4
11# include <embree4/rtcore.h>
12# include <embree4/rtcore_scene.h>
13# else
14# include <embree3/rtcore.h>
15# include <embree3/rtcore_scene.h>
16# endif
17
18# include "bvh/bvh.h"
19# include "bvh/params.h"
20
21# include "util/string.h"
22# include "util/thread.h"
23# include "util/types.h"
24# include "util/vector.h"
25
27
28class Hair;
29class Mesh;
30class PointCloud;
31
32class BVHEmbree : public BVH {
33 public:
34 void build(Progress &progress,
35 Stats *stats,
36 RTCDevice rtc_device,
37 const bool isSyclEmbreeDevice = false);
38 void refit(Progress &progress);
39
40# if defined(WITH_EMBREE_GPU) && RTC_VERSION >= 40302
41 RTCError offload_scenes_to_gpu(const vector<RTCScene> &scenes);
42# endif
43
44 const char *get_error_string(RTCError error_code);
45
46 RTCScene scene;
47
48 protected:
49 friend class BVH;
50 BVHEmbree(const BVHParams &params,
51 const vector<Geometry *> &geometry,
52 const vector<Object *> &objects);
53 virtual ~BVHEmbree();
54
55 void add_object(Object *ob, int i);
56 void add_instance(Object *ob, int i);
57 void add_curves(const Object *ob, const Hair *hair, int i);
58 void add_points(const Object *ob, const PointCloud *pointcloud, int i);
59 void add_triangles(const Object *ob, const Mesh *mesh, int i);
60
61 private:
62 void set_tri_vertex_buffer(RTCGeometry geom_id, const Mesh *mesh, const bool update);
63 void set_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair, const bool update);
64 void set_point_vertex_buffer(RTCGeometry geom_id,
65 const PointCloud *pointcloud,
66 const bool update);
67
68 RTCDevice rtc_device;
69 bool rtc_device_is_sycl;
70 enum RTCBuildQuality build_quality;
71};
72
74
75#endif /* WITH_EMBREE */
76
77#endif /* __BVH_EMBREE_H__ */
void refit(btStridingMeshInterface *triangles, const btVector3 &aabbMin, const btVector3 &aabbMax)
void build(btStridingMeshInterface *triangles, bool useQuantizedAabbCompression, const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax)
Definition bvh/bvh.h:66
Definition hair.h:14
#define CCL_NAMESPACE_END
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void add_curves(bke::CurvesGeometry &curves, const Span< int > new_sizes)
static void update(bNodeTree *ntree)