Blender V5.0
unaligned.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#include "util/vector.h"
8
10
11class BoundBox;
13class BVHRange;
14class BVHReference;
15struct Transform;
16class Object;
17
18/* Helper class to perform calculations needed for unaligned nodes. */
20 public:
21 BVHUnaligned(const vector<Object *> &objects);
22
23 /* Calculate alignment for the oriented node for a given range. */
25 const BVHReference *references) const;
26 Transform compute_aligned_space(const BVHRange &range, const BVHReference *references) const;
27
28 /* Calculate alignment for the oriented node for a given reference.
29 *
30 * Return true when space was calculated successfully.
31 */
32 bool compute_aligned_space(const BVHReference &ref, Transform *aligned_space) const;
33
34 /* Calculate primitive's bounding box in given space. */
36 const Transform &aligned_space) const;
37
38 /* Calculate bounding box in given space. */
40 const BVHReference *references,
41 const Transform &aligned_space,
42 BoundBox *cent_bounds = nullptr) const;
44 const BVHReference *references,
45 const Transform &aligned_space,
46 BoundBox *cent_bounds = nullptr) const;
47
48 /* Calculate affine transform for node packing.
49 * Bounds will be in the range of 0..1.
50 */
51 static Transform compute_node_transform(const BoundBox &bounds, const Transform &aligned_space);
52
53 protected:
54 /* List of objects BVH is being created for. */
56};
57
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition btDbvt.cpp:299
BVHUnaligned(const vector< Object * > &objects)
Definition unaligned.cpp:18
Transform compute_aligned_space(const BVHObjectBinning &range, const BVHReference *references) const
Definition unaligned.cpp:20
const vector< Object * > & objects_
Definition unaligned.h:55
BoundBox compute_aligned_prim_boundbox(const BVHReference &prim, const Transform &aligned_space) const
Definition unaligned.cpp:77
BoundBox compute_aligned_boundbox(const BVHObjectBinning &range, const BVHReference *references, const Transform &aligned_space, BoundBox *cent_bounds=nullptr) const
static Transform compute_node_transform(const BoundBox &bounds, const Transform &aligned_space)
#define CCL_NAMESPACE_END