Go to the documentation of this file.
5 #ifndef COAL_SERIALIZATION_BVH_MODEL_H
6 #define COAL_SERIALIZATION_BVH_MODEL_H
18 namespace serialization {
28 template <
class Archive>
30 const unsigned int ) {
36 "The BVH model is not in a BVH_BUILD_STATE_PROCESSED or "
37 "BVH_BUILD_STATE_UPDATED state.\n"
38 "The BVHModel could not be serialized.",
39 std::invalid_argument);
44 boost::serialization::base_object<coal::CollisionGeometry>(bvh_model));
47 ar &make_nvp(
"vertices", bvh_model.
vertices);
49 ar &make_nvp(
"num_tris", bvh_model.
num_tris);
67 template <
class Archive>
69 const unsigned int ) {
72 ar >> make_nvp(
"base",
73 boost::serialization::base_object<coal::CollisionGeometry>(
77 ar >> make_nvp(
"vertices", bvh_model.
vertices);
79 ar >> make_nvp(
"num_tris", bvh_model.
num_tris);
80 ar >> make_nvp(
"tri_indices", bvh_model.
tri_indices);
81 ar >> make_nvp(
"build_state", bvh_model.
build_state);
92 template <
typename BV>
102 template <
class Archive,
typename BV>
104 const unsigned int version) {
105 split_free(ar, bvh_model,
version);
108 template <
class Archive,
typename BV>
110 const unsigned int ) {
111 using namespace coal;
115 const Accessor &bvh_model =
reinterpret_cast<const Accessor &
>(bvh_model_);
117 boost::serialization::base_object<BVHModelBase>(bvh_model));
157 if (bvh_model.bvs.get()) {
158 const bool with_bvs =
true;
159 ar &make_nvp(
"with_bvs", with_bvs);
160 ar &make_nvp(
"num_bvs", bvh_model.num_bvs);
164 reinterpret_cast<const char *
>(bvh_model.bvs->data()),
166 (std::size_t)bvh_model.num_bvs));
168 const bool with_bvs =
false;
169 ar &make_nvp(
"with_bvs", with_bvs);
173 template <
class Archive,
typename BV>
175 const unsigned int ) {
176 using namespace coal;
180 Accessor &bvh_model =
reinterpret_cast<Accessor &
>(bvh_model_);
182 ar >> make_nvp(
"base",
183 boost::serialization::base_object<BVHModelBase>(bvh_model));
204 ar >> make_nvp(
"with_bvs", with_bvs);
206 unsigned int num_bvs;
207 ar >> make_nvp(
"num_bvs", num_bvs);
209 if (num_bvs != bvh_model.num_bvs) {
210 bvh_model.bvs.reset();
211 bvh_model.num_bvs = num_bvs;
213 bvh_model.bvs.reset(
new
217 ar >> make_nvp(
"bvs",
218 make_array(
reinterpret_cast<char *
>(bvh_model.bvs->data()),
219 sizeof(Node) * (std::size_t)num_bvs));
221 bvh_model.bvs.reset();
231 template <
typename BV>
233 static size_t run(const ::coal::BVHModel<BV> &bvh_model) {
234 return static_cast<size_t>(bvh_model.memUsage(
false));
250 #endif // ifndef COAL_SERIALIZATION_BVH_MODEL_H
void load(Archive &ar, coal::BVSplitter< BV > &splitter_, const unsigned int)
unsigned int num_bvs_allocated
std::shared_ptr< std::vector< Vec3s > > vertices
Geometry point data.
void serialize(Archive &ar, coal::AABB &aabb, const unsigned int)
A base class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewe...
unsigned int num_bvs
Number of BV nodes in bounding volume hierarchy.
unsigned int num_vertices_allocated
unsigned int num_tris_allocated
#define COAL_SERIALIZATION_DECLARE_EXPORT(T)
@ BVH_BUILD_STATE_PROCESSED
#define COAL_SERIALIZATION_SPLIT(Type)
@ BVH_MODEL_TRIANGLES
unknown model type
#define COAL_THROW_PRETTY(message, exception)
BVHModelType getModelType() const
Model type described by the instance.
@ BVH_BUILD_STATE_UPDATED
std::shared_ptr< std::vector< unsigned int > > primitive_indices
BVHBuildState build_state
The state of BVH building process.
std::shared_ptr< bv_node_vector_t > bvs
Bounding volume hierarchy.
A class describing a bounding volume node. It includes the tree structure providing in BVNodeBase and...
KDOP class describes the KDOP collision structures. K is set as the template parameter,...
std::shared_ptr< std::vector< Triangle > > tri_indices
Geometry triangle index data, will be NULL for point clouds.
A class describing the bounding hierarchy of a mesh model or a point cloud model (which is viewed as ...
unsigned int num_vertices
Number of points.
void save(Archive &ar, const coal::BVSplitter< BV > &splitter_, const unsigned int)
unsigned int num_tris
Number of triangles.
coal::BVHModel< BV > Base
std::shared_ptr< std::vector< Vec3s > > prev_vertices
Geometry point data in previous frame.
std::vector< BVNode< BV >, Eigen::aligned_allocator< BVNode< BV > >> bv_node_vector_t
hpp-fcl
Author(s):
autogenerated on Sat Nov 23 2024 03:44:57