42 const float minSAH =
min(bestSAH.
x,
min(bestSAH.
y, bestSAH.
z));
44 if (bestSAH.
x == minSAH) {
47 if (bestSAH.
y == minSAH) {
111 bin_bounds[b00][0].
grow(bounds0);
114 bin_bounds[b01][1].
grow(bounds0);
117 bin_bounds[b02][2].
grow(bounds0);
122 bin_bounds[b10][0].
grow(bounds1);
125 bin_bounds[b11][1].
grow(bounds1);
128 bin_bounds[b12][2].
grow(bounds1);
141 bin_bounds[b00][0].
grow(bounds0);
144 bin_bounds[b01][1].
grow(bounds0);
147 bin_bounds[b02][2].
grow(bounds0);
164 bx =
merge(bx, bin_bounds[
i][0]);
166 by =
merge(by, bin_bounds[
i][1]);
168 bz =
merge(bz, bin_bounds[
i][2]);
170 r_area[
i][3] = r_area[
i][2];
187 bx =
merge(bx, bin_bounds[
i - 1][0]);
189 by =
merge(by, bin_bounds[
i - 1][1]);
191 bz =
merge(bz, bin_bounds[
i - 1][2]);
196 const float4 sah = lArea * lCount + r_area[
i] * r_count[
i];
198 bestSplit =
select(sah < bestSAH, ii, bestSplit);
199 bestSAH =
min(sah, bestSAH);
216 const size_t N =
size();
237 lcent_bounds.
grow(center);
242 rcent_bounds.
grow(center);
248 if (
l != 0 &&
N - 1 - r != 0) {
262 for (
size_t i = 0;
i <
N / 2;
i++) {
267 for (
size_t i =
N / 2;
i <
N;
i++) {
void BLI_kdtree_nd_ insert(KDTree *tree, int index, const float co[KD_DIMS]) ATTR_NONNULL(1
MINLINE float safe_divide(float a, float b)
CCL_NAMESPACE_BEGIN __forceinline void prefetch_L1(const void *)
__forceinline float extract(const int4 &b)
__forceinline void prefetch_L2(const void *)
__forceinline void prefetch_NTA(const void *)
__forceinline void prefetch_L3(const void *)
__forceinline const float4 insert(const float4 &a, const float b)
__forceinline int get_best_dimension(const float4 &bestSAH)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
void split(BVHReference *prims, BVHObjectBinning &left_o, BVHObjectBinning &right_o) const
const BVHUnaligned * unaligned_heuristic_
__forceinline int4 get_bin(const BoundBox &box) const
__forceinline BVHObjectBinning()
__forceinline BoundBox get_prim_bounds(const BVHReference &prim) const
__forceinline const BoundBox & unaligned_bounds()
__forceinline float4 blocks(const int4 &a) const
const Transform * aligned_space_
__forceinline int size() const
__forceinline int start() const
__forceinline const BoundBox & bounds() const
__forceinline const BoundBox & cent_bounds() const
__forceinline const BoundBox & bounds() const
BoundBox compute_aligned_boundbox(const BVHObjectBinning &range, const BVHReference *references, const Transform &aligned_space, BoundBox *cent_bounds=nullptr) const
#define CCL_NAMESPACE_END
OrientationBounds merge(const OrientationBounds &cone_a, const OrientationBounds &cone_b)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
CCL_NAMESPACE_BEGIN ccl_device_inline float4 zero_float4()
__forceinline float half_area() const
__forceinline void grow(const float3 &pt)
__forceinline float3 center2() const