1 | // Copyright 2009-2021 Intel Corporation |
2 | // SPDX-License-Identifier: Apache-2.0 |
3 | |
4 | #pragma once |
5 | |
6 | #include "default.h" |
7 | #include "accel.h" |
8 | |
9 | namespace embree |
10 | { |
11 | #define MODE_HIGH_QUALITY (1<<8) |
12 | |
13 | /*! virtual interface for all hierarchy builders */ |
14 | class Builder : public RefCount { |
15 | public: |
16 | |
17 | static const size_t DEFAULT_SINGLE_THREAD_THRESHOLD = 1024; |
18 | |
19 | /*! initiates the hierarchy builder */ |
20 | virtual void build() = 0; |
21 | |
22 | /*! notifies the builder about the deletion of some geometry */ |
23 | virtual void deleteGeometry(size_t geomID) {}; |
24 | |
25 | /*! clears internal builder state */ |
26 | virtual void clear() = 0; |
27 | }; |
28 | |
29 | /*! virtual interface for progress monitor class */ |
30 | struct BuildProgressMonitor { |
31 | virtual void operator() (size_t dn) const = 0; |
32 | }; |
33 | |
34 | /*! build the progress monitor interface from a closure */ |
35 | template<typename Closure> |
36 | struct ProgressMonitorClosure : BuildProgressMonitor |
37 | { |
38 | public: |
39 | ProgressMonitorClosure (const Closure& closure) : closure(closure) {} |
40 | void operator() (size_t dn) const { closure(dn); } |
41 | private: |
42 | const Closure closure; |
43 | }; |
44 | template<typename Closure> __forceinline const ProgressMonitorClosure<Closure> BuildProgressMonitorFromClosure(const Closure& closure) { |
45 | return ProgressMonitorClosure<Closure>(closure); |
46 | } |
47 | |
48 | struct LineSegments; |
49 | struct TriangleMesh; |
50 | struct QuadMesh; |
51 | struct UserGeometry; |
52 | |
53 | class Scene; |
54 | |
55 | typedef void (*createLineSegmentsAccelTy)(Scene* scene, LineSegments* mesh, AccelData*& accel, Builder*& builder); |
56 | typedef void (*createTriangleMeshAccelTy)(Scene* scene, unsigned int geomID, AccelData*& accel, Builder*& builder); |
57 | typedef void (*createQuadMeshAccelTy)(Scene* scene, unsigned int geomID, AccelData*& accel, Builder*& builder); |
58 | typedef void (*createUserGeometryAccelTy)(Scene* scene, unsigned int geomID, AccelData*& accel, Builder*& builder); |
59 | |
60 | } |
61 | |