Line |
Branch |
Exec |
Source |
1 |
|
|
// Copyright (c) 2019 CNRS |
2 |
|
|
// Authors: Joseph Mirabel |
3 |
|
|
// |
4 |
|
|
// |
5 |
|
|
// This file is part of hpp-gui |
6 |
|
|
// hpp-gui is free software: you can redistribute it |
7 |
|
|
// and/or modify it under the terms of the GNU Lesser General Public |
8 |
|
|
// License as published by the Free Software Foundation, either version |
9 |
|
|
// 3 of the License, or (at your option) any later version. |
10 |
|
|
// |
11 |
|
|
// hpp-gui is distributed in the hope that it will be |
12 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
13 |
|
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
|
|
// General Lesser Public License for more details. You should have |
15 |
|
|
// received a copy of the GNU Lesser General Public License along with |
16 |
|
|
// hpp-gui If not, see |
17 |
|
|
// <http://www.gnu.org/licenses/>. |
18 |
|
|
|
19 |
|
|
#ifndef HPP_GUI_COAL_PLUGIN_NODE_HH |
20 |
|
|
#define HPP_GUI_COAL_PLUGIN_NODE_HH |
21 |
|
|
|
22 |
|
|
#include <coal/BVH/BVH_model.h> |
23 |
|
|
#include <coal/internal/BV_splitter.h> |
24 |
|
|
#include <gepetto/viewer/node.h> |
25 |
|
|
|
26 |
|
|
namespace hpp { |
27 |
|
|
namespace gui { |
28 |
|
|
typedef gepetto::viewer::Node Node; |
29 |
|
|
|
30 |
|
|
DEF_CLASS_SMART_PTR(BVHDisplay) |
31 |
|
|
|
32 |
|
|
class BVHDisplay : public Node { |
33 |
|
|
public: |
34 |
|
|
BVHDisplay(const std::string& filename, const std::string& name); |
35 |
|
|
|
36 |
|
|
void setLevel(const int& level); |
37 |
|
|
|
38 |
|
✗ |
const int& getLevel() const { return level_; } |
39 |
|
|
|
40 |
|
|
void setColor(const osgVector4& color); |
41 |
|
|
|
42 |
|
|
void init(coal::SplitMethodType splitMethod); |
43 |
|
|
|
44 |
|
|
private: |
45 |
|
|
typedef coal::OBB BoundingVolume; |
46 |
|
|
typedef coal::BVHModel<BoundingVolume> BVH_t; |
47 |
|
|
typedef coal::shared_ptr<BVH_t> BVHPtr_t; |
48 |
|
|
|
49 |
|
|
void recursiveBuildTree(const BVH_t& bvh, int ibv, std::size_t level); |
50 |
|
|
|
51 |
|
|
struct BVLevel { |
52 |
|
|
// std::vector< ::osg::ShapeDrawableRefPtr > bvs; |
53 |
|
|
std::vector< ::osg::BoxRefPtr> boxes; |
54 |
|
|
::osg::GeodeRefPtr geode; |
55 |
|
|
}; |
56 |
|
|
const std::string filename_; |
57 |
|
|
std::vector<BVLevel> levels_; |
58 |
|
|
int level_; |
59 |
|
|
}; |
60 |
|
|
} // namespace gui |
61 |
|
|
} // namespace hpp |
62 |
|
|
|
63 |
|
|
#endif // HPP_GUI_COAL_PLUGIN_NODE_HH |
64 |
|
|
|