// Copyright 2009-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 #pragma once #include "node_intersector.h" namespace embree { namespace isa { ////////////////////////////////////////////////////////////////////////////////////// // Frustum structure used in hybrid and stream traversal ////////////////////////////////////////////////////////////////////////////////////// /* Optimized frustum test. We calculate t=(p-org)/dir in ray/box intersection. We assume the rays are split by octant, thus dir intervals are either positive or negative in each dimension. Case 1: dir.min >= 0 && dir.max >= 0: t_min = (p_min - org_max) / dir_max = (p_min - org_max)*rdir_min = p_min*rdir_min - org_max*rdir_min t_max = (p_max - org_min) / dir_min = (p_max - org_min)*rdir_max = p_max*rdir_max - org_min*rdir_max Case 2: dir.min < 0 && dir.max < 0: t_min = (p_max - org_min) / dir_min = (p_max - org_min)*rdir_max = p_max*rdir_max - org_min*rdir_max t_max = (p_min - org_max) / dir_max = (p_min - org_max)*rdir_min = p_min*rdir_min - org_max*rdir_min */ template<bool robust> struct Frustum; /* Fast variant */ template<> struct Frustum<false> { … }; FrustumFast; /* Robust variant */ template<> struct Frustum<true> { … }; FrustumRobust; ////////////////////////////////////////////////////////////////////////////////////// // Fast AABBNode intersection ////////////////////////////////////////////////////////////////////////////////////// template<int N> __forceinline size_t intersectNodeFrustum(const typename BVHN<N>::AABBNode* __restrict__ node, const FrustumFast& frustum, vfloat<N>& dist) { … } ////////////////////////////////////////////////////////////////////////////////////// // Robust AABBNode intersection ////////////////////////////////////////////////////////////////////////////////////// template<int N> __forceinline size_t intersectNodeFrustum(const typename BVHN<N>::AABBNode* __restrict__ node, const FrustumRobust& frustum, vfloat<N>& dist) { … } } }