Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00021
00022
00023
00024
00025
00026
00027
00028
00029
00035 #ifndef OPENHRP_MODEL_LOADER_SCENE_INFO_COLLADA_IMPL_H_INCLUDED
00036 #define OPENHRP_MODEL_LOADER_SCENE_INFO_COLLADA_IMPL_H_INCLUDED
00037
00038 #include <string>
00039 #include <hrpCorba/ModelLoader.hh>
00040 #include <hrpUtil/EasyScanner.h>
00041
00042 #include "SceneInfo_impl.h"
00043
00044 using namespace OpenHRP;
00045
00046 class SceneInfoCollada_impl : public SceneInfo_impl
00047 {
00048 public:
00049 BodyInfoCollada_impl* probot;
00050
00051 SceneInfoCollada_impl(PortableServer::POA_ptr poa) : ShapeSetInfo_impl(poa), SceneInfo_impl(poa)
00052 {
00053 probot = new BodyInfoCollada_impl(poa);
00054 }
00055 virtual ~SceneInfoCollada_impl()
00056 {
00057 }
00058
00059 void load(const std::string& filename)
00060 {
00061 try {
00062 probot->loadModelFile(filename);
00063 url_ = CORBA::string_dup(filename.c_str());
00064
00065 shapes_ = probot->shapes_;
00066 appearances_ = probot->appearances_;
00067 materials_ = probot->materials_;
00068 textures_ = probot->textures_;
00069
00070 Matrix44 E(Matrix44::Identity());
00071 AllLinkShapeIndexSequence* asis = probot->linkShapeIndices();
00072 size_t linkLength = asis->length();
00073 for(size_t linkIndex = 0; linkIndex < linkLength; ++linkIndex) {
00074 TransformedShapeIndexSequence tsis = (*asis)[linkIndex];
00075 for(size_t segmentIndex = 0; segmentIndex < tsis.length(); ++segmentIndex) {
00076 long length = shapeIndices_.length();
00077 shapeIndices_.length(length+1);
00078 TransformedShapeIndex tsi = tsis[segmentIndex];
00079 shapeIndices_[length] = tsi;
00080
00081 const DblArray12& M = tsi.transformMatrix;
00082 inlinedShapeTransformMatrices_.length(length+1);
00083 for(int i=0; i<12;i++) {
00084 inlinedShapeTransformMatrices_[length][i] = M[i];
00085 }
00086 }
00087 }
00088 } catch(EasyScanner::Exception& ex){
00089 cout << ex.getFullMessage() << endl;
00090 throw ModelLoader::ModelLoaderException(ex.getFullMessage().c_str());
00091 }
00092 }
00093 };
00094
00095
00096 #endif