RavEngine
Loading...
Searching...
No Matches
GuBV4_Slabs_SwizzledNoOrder.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_SLABS_SWIZZLED_NO_ORDER_H
30#define GU_BV4_SLABS_SWIZZLED_NO_ORDER_H
31
32 // Generic, no sort
33/* template<class LeafTestT, class ParamsT>
34 static PxIntBool BV4_ProcessStreamSwizzledNoOrder(const BVDataPacked* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params)
35 {
36 const BVDataPacked* root = node;
37
38 PxU32 nb=1;
39 PxU32 stack[GU_BV4_STACK_SIZE];
40 stack[0] = initData;
41
42 do
43 {
44 const PxU32 childData = stack[--nb];
45 node = root + getChildOffset(childData);
46
47 const BVDataSwizzled* tn = reinterpret_cast<const BVDataSwizzled*>(node);
48
49 const PxU32 nodeType = getChildType(childData);
50
51 if(nodeType>1 && BV4_ProcessNodeNoOrder_Swizzled<LeafTestT, 3>(stack, nb, tn, params))
52 return 1;
53 if(nodeType>0 && BV4_ProcessNodeNoOrder_Swizzled<LeafTestT, 2>(stack, nb, tn, params))
54 return 1;
55 if(BV4_ProcessNodeNoOrder_Swizzled<LeafTestT, 1>(stack, nb, tn, params))
56 return 1;
57 if(BV4_ProcessNodeNoOrder_Swizzled<LeafTestT, 0>(stack, nb, tn, params))
58 return 1;
59
60 }while(nb);
61
62 return 0;
63 }*/
64
65 template<class LeafTestT, class ParamsT>
66 static PxIntBool BV4_ProcessStreamSwizzledNoOrderQ(const BVDataPackedQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params)
67 {
68 const BVDataPackedQ* root = node;
69
70 PxU32 nb=1;
71 PxU32 stack[GU_BV4_STACK_SIZE];
72 stack[0] = initData;
73
74 do
75 {
76 const PxU32 childData = stack[--nb];
77 node = root + getChildOffset(childData);
78
79 const BVDataSwizzledQ* tn = reinterpret_cast<const BVDataSwizzledQ*>(node);
80
81 const PxU32 nodeType = getChildType(childData);
82
83 if(nodeType>1 && BV4_ProcessNodeNoOrder_SwizzledQ<LeafTestT, 3>(stack, nb, tn, params))
84 return 1;
85 if(nodeType>0 && BV4_ProcessNodeNoOrder_SwizzledQ<LeafTestT, 2>(stack, nb, tn, params))
86 return 1;
87 if(BV4_ProcessNodeNoOrder_SwizzledQ<LeafTestT, 1>(stack, nb, tn, params))
88 return 1;
89 if(BV4_ProcessNodeNoOrder_SwizzledQ<LeafTestT, 0>(stack, nb, tn, params))
90 return 1;
91
92 }while(nb);
93
94 return 0;
95 }
96
97 template<class LeafTestT, class ParamsT>
98 static PxIntBool BV4_ProcessStreamSwizzledNoOrderNQ(const BVDataPackedNQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params)
99 {
100 const BVDataPackedNQ* root = node;
101
102 PxU32 nb=1;
103 PxU32 stack[GU_BV4_STACK_SIZE];
104 stack[0] = initData;
105
106 do
107 {
108 const PxU32 childData = stack[--nb];
109 node = root + getChildOffset(childData);
110
111 const BVDataSwizzledNQ* tn = reinterpret_cast<const BVDataSwizzledNQ*>(node);
112
113 const PxU32 nodeType = getChildType(childData);
114
115 if(nodeType>1 && BV4_ProcessNodeNoOrder_SwizzledNQ<LeafTestT, 3>(stack, nb, tn, params))
116 return 1;
117 if(nodeType>0 && BV4_ProcessNodeNoOrder_SwizzledNQ<LeafTestT, 2>(stack, nb, tn, params))
118 return 1;
119 if(BV4_ProcessNodeNoOrder_SwizzledNQ<LeafTestT, 1>(stack, nb, tn, params))
120 return 1;
121 if(BV4_ProcessNodeNoOrder_SwizzledNQ<LeafTestT, 0>(stack, nb, tn, params))
122 return 1;
123
124 }while(nb);
125
126 return 0;
127 }
128
129#endif // GU_BV4_SLABS_SWIZZLED_NO_ORDER_H
#define PX_RESTRICT
Definition PxPreprocessor.h:355