server
ModelLoader
SceneInfoCollada_impl.h
Go to the documentation of this file.
1
// -*- coding: utf-8 -*-
2
// Copyright (C) 2011 University of Tokyo, General Robotix Inc.
3
//
4
// Licensed under the Apache License, Version 2.0 (the "License");
5
// you may not use this file except in compliance with the License.
6
// You may obtain a copy of the License at
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
21
/*
22
* Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
23
* All rights reserved. This program is made available under the terms of the
24
* Eclipse Public License v1.0 which accompanies this distribution, and is
25
* available at http://www.eclipse.org/legal/epl-v10.html
26
* Contributors:
27
* National Institute of Advanced Industrial Science and Technology (AIST)
28
*/
29
35
#ifndef OPENHRP_MODEL_LOADER_SCENE_INFO_COLLADA_IMPL_H_INCLUDED
36
#define OPENHRP_MODEL_LOADER_SCENE_INFO_COLLADA_IMPL_H_INCLUDED
37
38
#include <string>
39
#include <hrpCorba/ModelLoader.hh>
40
#include <
hrpUtil/EasyScanner.h
>
41
42
#include "
SceneInfo_impl.h
"
43
44
using namespace
OpenHRP
;
45
46
class
SceneInfoCollada_impl
:
public
SceneInfo_impl
47
{
48
public
:
49
BodyInfoCollada_impl
*
probot
;
50
51
SceneInfoCollada_impl
(PortableServer::POA_ptr poa) :
ShapeSetInfo_impl
(poa),
SceneInfo_impl
(poa)
52
{
53
probot =
new
BodyInfoCollada_impl
(poa);
54
}
55
virtual
~SceneInfoCollada_impl
()
56
{
57
}
58
59
void
load
(
const
std::string&
filename
)
60
{
61
try
{
62
probot->
loadModelFile
(
filename
);
63
url_ = CORBA::string_dup(
filename
.c_str());
64
65
shapes_ = probot->
shapes_
;
66
appearances_ = probot->
appearances_
;
67
materials_ = probot->
materials_
;
68
textures_ = probot->
textures_
;
69
70
Matrix44
E(Matrix44::Identity());
71
AllLinkShapeIndexSequence* asis = probot->
linkShapeIndices
();
72
size_t
linkLength = asis->length();
73
for
(
size_t
linkIndex = 0; linkIndex < linkLength; ++linkIndex) {
74
TransformedShapeIndexSequence tsis = (*asis)[linkIndex];
75
for
(
size_t
segmentIndex = 0; segmentIndex < tsis.length(); ++segmentIndex) {
76
long
length
= shapeIndices_.length();
77
shapeIndices_.length(
length
+1);
78
TransformedShapeIndex tsi = tsis[segmentIndex];
79
shapeIndices_[
length
] = tsi;
80
81
const
DblArray12& M = tsi.transformMatrix;
82
inlinedShapeTransformMatrices_.length(
length
+1);
83
for
(
int
i
=0;
i
<12;
i
++) {
84
inlinedShapeTransformMatrices_[
length
][
i
] = M[
i
];
85
}
86
}
87
}
88
}
catch
(
EasyScanner::Exception
& ex){
89
cout << ex.
getFullMessage
() << endl;
90
throw
ModelLoader::ModelLoaderException(ex.
getFullMessage
().c_str());
91
}
92
}
93
};
94
95
96
#endif
SceneInfo_impl
Definition:
SceneInfo_impl.h:26
SceneInfo_impl.h
hrp::EasyScanner::Exception::getFullMessage
std::string getFullMessage()
Definition:
EasyScanner.cpp:106
i
png_uint_32 i
Definition:
png.h:2732
SceneInfoCollada_impl::probot
BodyInfoCollada_impl * probot
Definition:
SceneInfoCollada_impl.h:49
SceneInfoCollada_impl::load
void load(const std::string &filename)
Definition:
SceneInfoCollada_impl.h:59
OpenHRP
Definition:
ConstraintForceSolver.h:19
BodyInfoCollada_impl
reads in collada files and initializes a BodyInfo struct
Definition:
BodyInfoCollada_impl.h:36
ShapeSetInfo_impl::appearances_
AppearanceInfoSequence appearances_
Definition:
ShapeSetInfo_impl.h:64
filename
char * filename
Definition:
cdjpeg.h:133
hrp::Matrix44
Eigen::Matrix4d Matrix44
Definition:
Eigen4d.h:18
SceneInfoCollada_impl
Definition:
SceneInfoCollada_impl.h:46
SceneInfoCollada_impl::SceneInfoCollada_impl
SceneInfoCollada_impl(PortableServer::POA_ptr poa)
Definition:
SceneInfoCollada_impl.h:51
BodyInfoCollada_impl::linkShapeIndices
virtual AllLinkShapeIndexSequence * linkShapeIndices()
Definition:
BodyInfoCollada_impl.cpp:3311
length
png_bytep png_bytep png_size_t length
Definition:
png.h:1538
hrp::EasyScanner::Exception
Definition:
EasyScanner.h:35
ShapeSetInfo_impl
Definition:
ShapeSetInfo_impl.h:30
EasyScanner.h
The header file of a text scanner class.
ShapeSetInfo_impl::materials_
MaterialInfoSequence materials_
Definition:
ShapeSetInfo_impl.h:65
ShapeSetInfo_impl::shapes_
ShapeInfoSequence shapes_
Definition:
ShapeSetInfo_impl.h:63
SceneInfoCollada_impl::~SceneInfoCollada_impl
virtual ~SceneInfoCollada_impl()
Definition:
SceneInfoCollada_impl.h:55
ShapeSetInfo_impl::textures_
TextureInfoSequence textures_
Definition:
ShapeSetInfo_impl.h:66
BodyInfoCollada_impl::loadModelFile
void loadModelFile(const std::string &filename)
Definition:
BodyInfoCollada_impl.cpp:3322
openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:04