2#ifndef _TINYPBRT_ACCELERATOR_HPP_
3#define _TINYPBRT_ACCELERATOR_HPP_
42 case BVH:
return "bvh";
45 default:
return "UNKNOWN";
75 case SAH:
return "sah";
76 case MIDDLE:
return "middle";
77 case EQUAL:
return "equal";
78 case HLBVH:
return "hlbvh";
80 default:
return "UNKNOWN";
90 using wrapper::wrapper;
110 using wrapper::wrapper;
122 [[nodiscard]]
constexpr uint_t max_prims() const noexcept {
return _native->max_prims; }
125 [[nodiscard]]
constexpr int_t max_depth() const noexcept {
return _native->max_depth; }
128 [[nodiscard]]
constexpr auto reflect() const noexcept {
137 struct accelerator : detail::wrapper<accelerator, tpbrt_accelerator_t>,
138 detail::with_variant<accelerator, accelerator_bvh_params, accelerator_kd_tree_params> {
140 using wrapper::wrapper;
152 [[nodiscard]]
constexpr std::optional<accelerator_bvh_params>
as_bvh() const noexcept {
153 if (!
is_bvh()) {
return std::nullopt; }
154 return _native->as.bvh;
158 [[nodiscard]]
constexpr std::optional<accelerator_kd_tree_params>
as_kd_tree() const noexcept {
160 return _native->as.kd_tree;
164 [[nodiscard]]
constexpr variant_type
to_variant() const noexcept {
167 case BVH:
return _native->as.bvh;
168 case KD_TREE:
return _native->as.kd_tree;
constexpr std::string_view to_string(const accelerator_type type) noexcept
Converts accelerator_type enum value to string.
Definition accelerator.hpp:39
accelerator_type
Used to declare accelerator type.
Definition accelerator.hpp:24
accelerator_bvh_split_method
Used to declare BVH split method.
Definition accelerator.hpp:53
@ MAX_NUM
Count of available accelerator types.
@ KD_TREE
KD Tree acceleration.
@ HLBVH
HLBVH split method. Selects the HLBVH algorithm, which parallelizes well.
@ SAH
SAH split method. Denotes the surface area heuristic.
@ MIDDLE
Middle split method. Splits each node at its midpoint along the split axis.
@ EQUAL
Equal split method. Splits the current group of primitives into two equal-sized sets.
@ TPBRT_ACCELERATOR_BVH_SPLIT_METHOD_SAH
SAH split method. Denotes the surface area heuristic.
Definition accelerator.h:35
@ TPBRT_ACCELERATOR_BVH_SPLIT_METHOD_MIDDLE
Middle split method. Splits each node at its midpoint along the split axis.
Definition accelerator.h:37
@ TPBRT_ACCELERATOR_BVH_SPLIT_METHOD_MAX_NUM
Count of available BVH split methods.
Definition accelerator.h:43
@ TPBRT_ACCELERATOR_BVH_SPLIT_METHOD_HLBVH
HLBVH split method. Selects the HLBVH algorithm, which parallelizes well.
Definition accelerator.h:41
@ TPBRT_ACCELERATOR_BVH_SPLIT_METHOD_EQUAL
Equal split method. Splits the current group of primitives into two equal-sized sets.
Definition accelerator.h:39
@ TPBRT_ACCELERATOR_TYPE_KD_TREE
KD Tree acceleration.
Definition accelerator.h:24
@ TPBRT_ACCELERATOR_TYPE_BVH
BVH acceleration.
Definition accelerator.h:22
@ TPBRT_ACCELERATOR_TYPE_MAX_NUM
Count of available accelerator types.
Definition accelerator.h:26
tpbrt_uchar_t uchar_t
Unsigned char type.
Definition fwd.hpp:34
tpbrt_int_t int_t
Int type.
Definition fwd.hpp:87
tpbrt_uint_t uint_t
Unsigned int type.
Definition fwd.hpp:92
bool bool_t
Bool type.
Definition fwd.hpp:82
tpbrt_float_t float_t
Float type.
Definition fwd.hpp:97
Definition accelerator.hpp:14
C++ wrapper for tpbrt_accelerator_bvh_params_t.
Definition accelerator.hpp:88
constexpr accelerator_bvh_split_method split_method() const noexcept
Returns split_method value.
Definition accelerator.hpp:96
constexpr auto reflect() const noexcept
Conversion to tuple.
Definition accelerator.hpp:101
constexpr uint_t max_node_prims() const noexcept
Returns max_node_prims value.
Definition accelerator.hpp:93
C++ wrapper for tpbrt_accelerator_kd_tree_params_t.
Definition accelerator.hpp:108
constexpr uint_t traversal_cost() const noexcept
Returns traversal_cost value.
Definition accelerator.hpp:116
constexpr auto reflect() const noexcept
Conversion to tuple.
Definition accelerator.hpp:128
constexpr float_t empty_bonus() const noexcept
Returns empty_bonus value.
Definition accelerator.hpp:119
constexpr uint_t max_prims() const noexcept
Returns max_prims value.
Definition accelerator.hpp:122
constexpr uint_t intersect_cost() const noexcept
Returns intersect_cost value.
Definition accelerator.hpp:113
constexpr int_t max_depth() const noexcept
Returns max_depth value.
Definition accelerator.hpp:125
C++ wrapper for tpbrt_accelerator_t.
Definition accelerator.hpp:138
constexpr std::optional< accelerator_bvh_params > as_bvh() const noexcept
Returns accelerator parameters as bvh.
Definition accelerator.hpp:152
constexpr bool_t is_bvh() const noexcept
Returns true if type is bvh.
Definition accelerator.hpp:146
constexpr accelerator_type type() const noexcept
Returns type value.
Definition accelerator.hpp:143
constexpr std::optional< accelerator_kd_tree_params > as_kd_tree() const noexcept
Returns accelerator parameters as kd tree.
Definition accelerator.hpp:158
constexpr auto reflect() const noexcept
Conversion to tuple.
Definition accelerator.hpp:176
constexpr variant_type to_variant() const noexcept
Conversion to variant.
Definition accelerator.hpp:164
constexpr bool_t is_kd_tree() const noexcept
Returns true if type is kd tree.
Definition accelerator.hpp:149