1 | // Copyright 2009-2021 Intel Corporation |
---|---|
2 | // SPDX-License-Identifier: Apache-2.0 |
3 | |
4 | #pragma once |
5 | |
6 | #include "accel.h" |
7 | #include "builder.h" |
8 | |
9 | namespace embree |
10 | { |
11 | class AccelInstance : public Accel |
12 | { |
13 | public: |
14 | AccelInstance (AccelData* accel, Builder* builder, Intersectors& intersectors) |
15 | : Accel(AccelData::TY_ACCEL_INSTANCE,intersectors), accel(accel), builder(builder) {} |
16 | |
17 | void immutable () { |
18 | builder.reset(nullptr); |
19 | } |
20 | |
21 | public: |
22 | void build () { |
23 | if (builder) builder->build(); |
24 | bounds = accel->bounds; |
25 | } |
26 | |
27 | void deleteGeometry(size_t geomID) { |
28 | if (accel ) accel->deleteGeometry(geomID); |
29 | if (builder) builder->deleteGeometry(geomID); |
30 | } |
31 | |
32 | void clear() { |
33 | if (accel) accel->clear(); |
34 | if (builder) builder->clear(); |
35 | } |
36 | |
37 | private: |
38 | std::unique_ptr<AccelData> accel; |
39 | std::unique_ptr<Builder> builder; |
40 | }; |
41 | } |
42 |