coal
3.0.4
Coal, The Collision Detection Library. Previously known as HPP-FCL, fork of FCL -- The Flexible Collision Library
Toggle main menu visibility
Loading...
Searching...
No Matches
loader.h
Go to the documentation of this file.
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Copyright (c) 2011-2014, Willow Garage, Inc.
5
* Copyright (c) 2014-2015, Open Source Robotics Foundation
6
* Copyright (c) 2016, CNRS - LAAS
7
* Copyright (c) 2020, INRIA
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
13
*
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* * Redistributions in binary form must reproduce the above
17
* copyright notice, this list of conditions and the following
18
* disclaimer in the documentation and/or other materials provided
19
* with the distribution.
20
* * Neither the name of Open Source Robotics Foundation nor the names of its
21
* contributors may be used to endorse or promote products derived
22
* from this software without specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*/
37
38
#ifndef COAL_MESH_LOADER_LOADER_H
39
#define COAL_MESH_LOADER_LOADER_H
40
41
#include "
coal/fwd.hh
"
42
#include "coal/config.hh"
43
#include "
coal/data_types.h
"
44
#include "
coal/collision_object.h
"
45
46
#include <map>
47
#include <ctime>
48
49
namespace
coal
{
52
class
COAL_DLLAPI
MeshLoader
{
53
public
:
54
virtual
~MeshLoader
() {}
55
56
virtual
BVHModelPtr_t
load
(
const
std::string& filename,
57
const
Vec3s
& scale = Vec3s::Ones());
58
61
virtual
CollisionGeometryPtr_t
loadOctree
(
const
std::string& filename);
62
63
MeshLoader
(
const
NODE_TYPE
& bvType =
BV_OBBRSS
) : bvType_(bvType) {}
64
65
private
:
66
const
NODE_TYPE
bvType_;
67
};
68
73
class
COAL_DLLAPI
CachedMeshLoader
:
public
MeshLoader
{
74
public
:
75
virtual
~CachedMeshLoader
() {}
76
77
CachedMeshLoader
(
const
NODE_TYPE
& bvType =
BV_OBBRSS
) :
MeshLoader
(bvType) {}
78
79
virtual
BVHModelPtr_t
load
(
const
std::string& filename,
const
Vec3s
& scale);
80
81
struct
COAL_DLLAPI
Key
{
82
std::string
filename
;
83
Vec3s
scale
;
84
85
Key
(
const
std::string& f,
const
Vec3s
& s) :
filename
(f),
scale
(s) {}
86
87
bool
operator<
(
const
CachedMeshLoader::Key
& b)
const
;
88
};
89
struct
COAL_DLLAPI
Value
{
90
BVHModelPtr_t
model
;
91
std::time_t
mtime
;
92
};
93
typedef
std::map<Key, Value>
Cache_t
;
94
95
const
Cache_t
&
cache
()
const
{
return
cache_; }
96
97
private
:
98
Cache_t cache_;
99
};
100
}
// namespace coal
101
102
#endif
// COAL_MESH_LOADER_LOADER_H
coal::CachedMeshLoader::~CachedMeshLoader
virtual ~CachedMeshLoader()
Definition
loader.h:75
coal::CachedMeshLoader::CachedMeshLoader
CachedMeshLoader(const NODE_TYPE &bvType=BV_OBBRSS)
Definition
loader.h:77
coal::CachedMeshLoader::Cache_t
std::map< Key, Value > Cache_t
Definition
loader.h:93
coal::CachedMeshLoader::load
virtual BVHModelPtr_t load(const std::string &filename, const Vec3s &scale)
coal::CachedMeshLoader::cache
const Cache_t & cache() const
Definition
loader.h:95
coal::MeshLoader::~MeshLoader
virtual ~MeshLoader()
Definition
loader.h:54
coal::MeshLoader::loadOctree
virtual CollisionGeometryPtr_t loadOctree(const std::string &filename)
coal::MeshLoader::load
virtual BVHModelPtr_t load(const std::string &filename, const Vec3s &scale=Vec3s::Ones())
coal::MeshLoader::MeshLoader
MeshLoader(const NODE_TYPE &bvType=BV_OBBRSS)
Definition
loader.h:63
collision_object.h
data_types.h
fwd.hh
coal::BV_OBBRSS
@ BV_OBBRSS
Definition
collision_object.h:70
coal
Main namespace.
Definition
broadphase_bruteforce.h:44
coal::NODE_TYPE
NODE_TYPE
traversal node type: bounding volume (AABB, OBB, RSS, kIOS, OBBRSS, KDOP16, KDOP18,...
Definition
collision_object.h:64
coal::CollisionGeometryPtr_t
shared_ptr< CollisionGeometry > CollisionGeometryPtr_t
Definition
fwd.hh:135
coal::Vec3s
Eigen::Matrix< CoalScalar, 3, 1 > Vec3s
Definition
data_types.h:77
coal::BVHModelPtr_t
shared_ptr< BVHModelBase > BVHModelPtr_t
Definition
fwd.hh:142
coal::CachedMeshLoader::Key
Definition
loader.h:81
coal::CachedMeshLoader::Key::scale
Vec3s scale
Definition
loader.h:83
coal::CachedMeshLoader::Key::Key
Key(const std::string &f, const Vec3s &s)
Definition
loader.h:85
coal::CachedMeshLoader::Key::operator<
bool operator<(const CachedMeshLoader::Key &b) const
coal::CachedMeshLoader::Key::filename
std::string filename
Definition
loader.h:82
coal::CachedMeshLoader::Value
Definition
loader.h:89
coal::CachedMeshLoader::Value::mtime
std::time_t mtime
Definition
loader.h:91
coal::CachedMeshLoader::Value::model
BVHModelPtr_t model
Definition
loader.h:90
include
coal
mesh_loader
loader.h
Generated by
1.17.0