Blender  V2.93
bvh/bvh_embree.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018, Blender Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __BVH_EMBREE_H__
18 #define __BVH_EMBREE_H__
19 
20 #ifdef WITH_EMBREE
21 
22 # include <embree3/rtcore.h>
23 # include <embree3/rtcore_scene.h>
24 
25 # include "bvh/bvh.h"
26 # include "bvh/bvh_params.h"
27 
28 # include "util/util_thread.h"
29 # include "util/util_types.h"
30 # include "util/util_vector.h"
31 
33 
34 class Hair;
35 class Mesh;
36 
37 class BVHEmbree : public BVH {
38  public:
39  void build(Progress &progress, Stats *stats, RTCDevice rtc_device);
40  void refit(Progress &progress);
41 
42  RTCScene scene;
43 
44  protected:
45  friend class BVH;
46  BVHEmbree(const BVHParams &params,
48  const vector<Object *> &objects);
49  virtual ~BVHEmbree();
50 
51  void add_object(Object *ob, int i);
52  void add_instance(Object *ob, int i);
53  void add_curves(const Object *ob, const Hair *hair, int i);
54  void add_triangles(const Object *ob, const Mesh *mesh, int i);
55 
56  private:
57  void set_tri_vertex_buffer(RTCGeometry geom_id, const Mesh *mesh, const bool update);
58  void set_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair, const bool update);
59 
60  RTCDevice rtc_device;
61  enum RTCBuildQuality build_quality;
62 };
63 
65 
66 #endif /* WITH_EMBREE */
67 
68 #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:80
vector< Geometry * > geometry
Definition: bvh/bvh.h:83
vector< Object * > objects
Definition: bvh/bvh.h:84
Scene scene
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define CCL_NAMESPACE_END
static void update(bNodeTree *ntree)