Cycles: Cleanup, spacing after preprocessor
[blender.git] / intern / cycles / bvh / bvh4.h
1 /*
2  * Adapted from code copyright 2009-2010 NVIDIA Corporation
3  * Modifications Copyright 2011, Blender Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef __BVH4_H__
19 #define __BVH4_H__
20
21 #include "bvh/bvh.h"
22 #include "bvh/bvh_params.h"
23
24 #include "util/util_types.h"
25 #include "util/util_vector.h"
26
27 CCL_NAMESPACE_BEGIN
28
29 class BVHNode;
30 struct BVHStackEntry;
31 class BVHParams;
32 class BoundBox;
33 class LeafNode;
34 class Object;
35 class Progress;
36
37 #define BVH_QNODE_SIZE           8
38 #define BVH_QNODE_LEAF_SIZE      1
39 #define BVH_UNALIGNED_QNODE_SIZE 14
40
41 /* BVH4
42  *
43  * Quad BVH, with each node having four children, to use with SIMD instructions.
44  */
45 class BVH4 : public BVH {
46 protected:
47         /* constructor */
48         friend class BVH;
49         BVH4(const BVHParams& params, const vector<Object*>& objects);
50
51         /* pack */
52         void pack_nodes(const BVHNode *root);
53
54         void pack_leaf(const BVHStackEntry& e, const LeafNode *leaf);
55         void pack_inner(const BVHStackEntry& e, const BVHStackEntry *en, int num);
56
57         void pack_aligned_inner(const BVHStackEntry& e,
58                                 const BVHStackEntry *en,
59                                 int num);
60         void pack_aligned_node(int idx,
61                                const BoundBox *bounds,
62                                const int *child,
63                                const uint visibility,
64                                const float time_from,
65                                const float time_to,
66                                const int num);
67
68         void pack_unaligned_inner(const BVHStackEntry& e,
69                                   const BVHStackEntry *en,
70                                   int num);
71         void pack_unaligned_node(int idx,
72                                  const Transform *aligned_space,
73                                  const BoundBox *bounds,
74                                  const int *child,
75                                  const uint visibility,
76                                  const float time_from,
77                                  const float time_to,
78                                  const int num);
79
80         /* refit */
81         void refit_nodes();
82         void refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility);
83 };
84
85 CCL_NAMESPACE_END
86
87 #endif  /* __BVH4_H__ */