42 float minSAH =
min(bestSAH.x,
min(bestSAH.y, bestSAH.z));
44 if (bestSAH.x == minSAH) {
47 else if (bestSAH.y == minSAH) {
65 unaligned_heuristic_(unaligned_heuristic),
66 aligned_space_(aligned_space)
88 for (
size_t i = 0; i <
num_bins; i++) {
90 bin_bounds[i][0] = bin_bounds[i][1] = bin_bounds[i][2] =
BoundBox::empty;
113 bin_bounds[b00][0].
grow(bounds0);
116 bin_bounds[b01][1].
grow(bounds0);
119 bin_bounds[b02][2].
grow(bounds0);
124 bin_bounds[b10][0].
grow(bounds1);
127 bin_bounds[b11][1].
grow(bounds1);
130 bin_bounds[b12][2].
grow(bounds1);
143 bin_bounds[b00][0].
grow(bounds0);
146 bin_bounds[b01][1].
grow(bounds0);
149 bin_bounds[b02][2].
grow(bounds0);
162 for (
size_t i =
num_bins - 1; i > 0; i--) {
166 bx =
merge(bx, bin_bounds[i][0]);
168 by =
merge(by, bin_bounds[i][1]);
169 r_area[i][1] = by.half_area();
170 bz =
merge(bz, bin_bounds[i][2]);
172 r_area[i][3] = r_area[i][2];
189 bx =
merge(bx, bin_bounds[i - 1][0]);
191 by =
merge(by, bin_bounds[i - 1][1]);
192 float Ay = by.half_area();
193 bz =
merge(bz, bin_bounds[i - 1][2]);
198 float4 sah = lArea * lCount + r_area[i] * r_count[i];
200 bestSplit =
select(sah < bestSAH, ii, bestSplit);
201 bestSAH =
min(sah, bestSAH);
238 lcent_bounds.
grow(center);
243 rcent_bounds.
grow(center);
249 if (
l != 0 &&
N - 1 - r != 0) {
263 for (
size_t i = 0; i <
N / 2; i++) {
268 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
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
__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=NULL) const
local_group_size(16, 16) .push_constant(Type b
#define CCL_NAMESPACE_END
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
OrientationBounds merge(const OrientationBounds &cone_a, const OrientationBounds &cone_b)
ccl_device_inline float3 rcp(const float3 a)
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
CCL_NAMESPACE_BEGIN ccl_device_inline float4 zero_float4()
__forceinline float half_area() const
__forceinline float3 size() const
__forceinline void grow(const float3 &pt)
__forceinline float3 center2() const
ccl_device_inline float4 float3_to_float4(const float3 a)