RavEngine
Loading...
Searching...
No Matches
GuBV4_ProcessStreamOrdered_OBBOBB.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef GU_BV4_PROCESS_STREAM_ORDERED_OBB_OBB_H
30#define GU_BV4_PROCESS_STREAM_ORDERED_OBB_OBB_H
31
32#ifdef GU_BV4_USE_SLABS
33/* template<class LeafTestT, int i, class ParamsT>
34 PX_FORCE_INLINE void BV4_ProcessNodeOrdered2_Swizzled(PxU32& code, const BVDataSwizzled* PX_RESTRICT node, ParamsT* PX_RESTRICT params)
35 {
36 OPC_SLABS_GET_CE(i)
37
38 if(BV4_BoxBoxOverlap(centerV, extentsV, params))
39 {
40 if(node->isLeaf(i))
41 LeafTestT::doLeafTest(params, node->getPrimitive(i));
42 else
43 code |= 1<<i;
44 }
45 }*/
46
47 template<class LeafTestT, int i, class ParamsT>
48 PX_FORCE_INLINE void BV4_ProcessNodeOrdered2_SwizzledQ(PxU32& code, const BVDataSwizzledQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params)
49 {
50 OPC_SLABS_GET_CEQ(i)
51
52 if(BV4_BoxBoxOverlap(centerV, extentsV, params))
53 {
54 if(node->isLeaf(i))
55 LeafTestT::doLeafTest(params, node->getPrimitive(i));
56 else
57 code |= 1<<i;
58 }
59 }
60
61 template<class LeafTestT, int i, class ParamsT>
62 PX_FORCE_INLINE void BV4_ProcessNodeOrdered2_SwizzledNQ(PxU32& code, const BVDataSwizzledNQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params)
63 {
64 OPC_SLABS_GET_CENQ(i)
65
66 if(BV4_BoxBoxOverlap(centerV, extentsV, params))
67 {
68 if(node->isLeaf(i))
69 LeafTestT::doLeafTest(params, node->getPrimitive(i));
70 else
71 code |= 1<<i;
72 }
73 }
74
75#else
76 template<class LeafTestT, class ParamsT>
77 PX_FORCE_INLINE void BV4_ProcessNodeOrdered(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params, PxU32 i, PxU32 limit)
78 {
79 #ifdef GU_BV4_QUANTIZED_TREE
80 if(i<limit && BV4_BoxBoxOverlap(node+i, params))
81 #else
82 if(i<limit && BV4_BoxBoxOverlap(node[i].mAABB.mExtents, node[i].mAABB.mCenter, params))
83 #endif
84 {
85 if(node[i].isLeaf())
86 LeafTestT::doLeafTest(params, node[i].getPrimitive());
87 else
88 Stack[Nb++] = node[i].getChildData();
89 }
90 }
91
92 template<class LeafTestT, int i, class ParamsT>
93 PX_FORCE_INLINE void BV4_ProcessNodeOrdered2(PxU32& code, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params)
94 {
95 #ifdef GU_BV4_QUANTIZED_TREE
96 if(BV4_BoxBoxOverlap(node+i, params))
97 #else
98 if(BV4_BoxBoxOverlap(node[i].mAABB.mExtents, node[i].mAABB.mCenter, params))
99 #endif
100 {
101 if(node[i].isLeaf())
102 LeafTestT::doLeafTest(params, node[i].getPrimitive());
103 else
104 code |= 1<<i;
105 }
106 }
107#endif
108
109#endif // GU_BV4_PROCESS_STREAM_ORDERED_OBB_OBB_H
#define PX_RESTRICT
Definition PxPreprocessor.h:355
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335