Blender  V2.93
bvh_unaligned.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __BVH_UNALIGNED_H__
18 #define __BVH_UNALIGNED_H__
19 
20 #include "util/util_vector.h"
21 
23 
24 class BoundBox;
25 class BVHObjectBinning;
26 class BVHRange;
27 class BVHReference;
28 struct Transform;
29 class Object;
30 
31 /* Helper class to perform calculations needed for unaligned nodes. */
32 class BVHUnaligned {
33  public:
34  BVHUnaligned(const vector<Object *> &objects);
35 
36  /* Calculate alignment for the oriented node for a given range. */
38  const BVHReference *references) const;
39  Transform compute_aligned_space(const BVHRange &range, const BVHReference *references) const;
40 
41  /* Calculate alignment for the oriented node for a given reference.
42  *
43  * Return true when space was calculated successfully.
44  */
45  bool compute_aligned_space(const BVHReference &ref, Transform *aligned_space) const;
46 
47  /* Calculate primitive's bounding box in given space. */
49  const Transform &aligned_space) const;
50 
51  /* Calculate bounding box in given space. */
53  const BVHReference *references,
54  const Transform &aligned_space,
55  BoundBox *cent_bounds = NULL) const;
57  const BVHReference *references,
58  const Transform &aligned_space,
59  BoundBox *cent_bounds = NULL) const;
60 
61  /* Calculate affine transform for node packing.
62  * Bounds will be in the range of 0..1.
63  */
64  static Transform compute_node_transform(const BoundBox &bounds, const Transform &aligned_space);
65 
66  protected:
67  /* List of objects BVH is being created for. */
69 };
70 
72 
73 #endif /* __BVH_UNALIGNED_H__ */
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition: btDbvt.cpp:299
BVHUnaligned(const vector< Object * > &objects)
Transform compute_aligned_space(const BVHObjectBinning &range, const BVHReference *references) const
BoundBox compute_aligned_boundbox(const BVHObjectBinning &range, const BVHReference *references, const Transform &aligned_space, BoundBox *cent_bounds=NULL) const
const vector< Object * > & objects_
Definition: bvh_unaligned.h:68
BoundBox compute_aligned_prim_boundbox(const BVHReference &prim, const Transform &aligned_space) const
static Transform compute_node_transform(const BoundBox &bounds, const Transform &aligned_space)
#define CCL_NAMESPACE_END