forked from s-nakaoka/openhrp-plugin
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSceneInfo_impl.cpp
55 lines (39 loc) · 954 Bytes
/
SceneInfo_impl.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*!
@file
@author Shizuko Hattori
*/
#include "SceneInfo_impl.h"
#include "BodyInfo_impl.h"
#include <cnoid/BodyLoader>
#include <cnoid/Body>
using namespace std;
using namespace cnoid;
using namespace OpenHRP;
SceneInfo_impl::SceneInfo_impl(PortableServer::POA_ptr poa) :
ShapeSetInfo_impl(poa)
{
os = &cout;
}
SceneInfo_impl::~SceneInfo_impl()
{
}
char* SceneInfo_impl::url()
{
return CORBA::string_dup(url_.c_str());
}
TransformedShapeIndexSequence* SceneInfo_impl::shapeIndices()
{
return new TransformedShapeIndexSequence(shapeIndices_);
}
void SceneInfo_impl::load(const std::string& filename)
{
url_ = filename;
BodyLoader loader;
loader.setMessageSink(*os);
BodyPtr body = loader.load(filename);
if(!body){
throw ModelLoader::ModelLoaderException("The model file cannot be loaded.");
return ;
}
setShapeIndices(body->rootLink()->visualShape(), shapeIndices_);
}