1 | // Copyright 2009-2021 Intel Corporation |
---|---|
2 | // SPDX-License-Identifier: Apache-2.0 |
3 | |
4 | #pragma once |
5 | |
6 | #include "bvh.h" |
7 | |
8 | namespace embree |
9 | { |
10 | namespace isa |
11 | { |
12 | struct NearFarPrecalculations |
13 | { |
14 | size_t nearX, nearY, nearZ; |
15 | size_t farX, farY, farZ; |
16 | |
17 | __forceinline NearFarPrecalculations() {} |
18 | |
19 | __forceinline NearFarPrecalculations(const Vec3fa& dir, size_t N) |
20 | { |
21 | const size_t size = sizeof(float)*N; |
22 | nearX = (dir.x < 0.0f) ? 1*size : 0*size; |
23 | nearY = (dir.y < 0.0f) ? 3*size : 2*size; |
24 | nearZ = (dir.z < 0.0f) ? 5*size : 4*size; |
25 | farX = nearX ^ size; |
26 | farY = nearY ^ size; |
27 | farZ = nearZ ^ size; |
28 | } |
29 | }; |
30 | } |
31 | } |
32 |