ShapeSetInfo_impl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * National Institute of Advanced Industrial Science and Technology (AIST)
8  */
9 
15 #ifndef OPENHRP_MODEL_LOADER_SHAPE_SET_INFO_INPL_H_INCLUDED
16 #define OPENHRP_MODEL_LOADER_SHAPE_SET_INFO_INPL_H_INCLUDED
17 
18 #include <string>
19 #include <hrpCorba/ORBwrap.h>
20 #include <hrpCorba/ModelLoader.hh>
22 #include <hrpUtil/VrmlNodes.h>
23 #include <hrpUtil/Eigen3d.h>
24 #include <hrpUtil/Eigen4d.h>
26 
27 using namespace OpenHRP;
28 using namespace hrp;
29 
30 class ShapeSetInfo_impl : public virtual POA_OpenHRP::ShapeSetInfo
31 {
32 public:
33 
34  ShapeSetInfo_impl(PortableServer::POA_ptr poa);
35  virtual ~ShapeSetInfo_impl();
36 
37  virtual PortableServer::POA_ptr _default_POA();
38 
39  virtual ShapeInfoSequence* shapes();
40  virtual AppearanceInfoSequence* appearances();
41  virtual MaterialInfoSequence* materials();
42  virtual TextureInfoSequence* textures();
43 
44 protected:
45 
46  void applyTriangleMeshShaper(VrmlNodePtr node);
47  static void putMessage(const std::string& message);
48  std::string& replace(std::string& str, const std::string& sb, const std::string& sa);
49  void traverseShapeNodes(VrmlNode* node, const Matrix44& T, TransformedShapeIndexSequence& io_shapeIndices, DblArray12Sequence& inlinedShapeM, const SFString* url = NULL);
50  virtual const std::string& topUrl() = 0;
51  void setColdetModel(ColdetModelPtr& coldetModel, TransformedShapeIndexSequence shapeIndices, const Matrix44& Tparent, int& vertexIndex, int& triangleIndex);
52  void saveOriginalData();
53  void restoreOriginalData();
54  void createAppearanceInfo();
55  void setBoundingBoxData(const Vector3& boxSize, int shapeIndex);
56  bool checkFileUpdateTime();
57  bool readImage;
58 
59 private:
60 
61  PortableServer::POA_var poa;
62 
63  ShapeInfoSequence shapes_;
64  AppearanceInfoSequence appearances_;
65  MaterialInfoSequence materials_;
66  TextureInfoSequence textures_;
67 
68  ShapeInfoSequence originShapes_;
69  AppearanceInfoSequence originAppearances_;
70  MaterialInfoSequence originMaterials_;
71 
73 
74  typedef std::map<VrmlShapePtr, int> ShapeNodeToShapeInfoIndexMap;
75  ShapeNodeToShapeInfoIndexMap shapeInfoIndexMap;
76 
77  std::map<std::string, time_t> fileTimeMap;
78 
79  int createShapeInfo(VrmlShape* shapeNode, const SFString* url);
80  void setTriangleMesh(ShapeInfo& shapeInfo, VrmlIndexedFaceSet* triangleMesh);
81  void setPrimitiveProperties(ShapeInfo& shapeInfo, VrmlShape* shapeNode);
82  int createAppearanceInfo(ShapeInfo& shapeInfo, VrmlShape* shapeNode, VrmlIndexedFaceSet* faceSet, const SFString *url);
83  void setColors(AppearanceInfo& appInfo, VrmlIndexedFaceSet* triangleMesh);
84  void setNormals(AppearanceInfo& appInfo, VrmlIndexedFaceSet* triangleMesh);
85  void setTexCoords(AppearanceInfo& appInfo, VrmlIndexedFaceSet* triangleMesh);
86  int createMaterialInfo(VrmlMaterialPtr& materialNode);
87  int createTextureInfo(VrmlTexturePtr& textureNode, const SFString *url);
88  void createTextureTransformMatrix(AppearanceInfo& appInfo, VrmlTextureTransformPtr& textureTransform );
89  std::string getModelFileDirPath(const std::string& url);
90  void setColdetModelTriangles(ColdetModelPtr& coldetModel, const TransformedShapeIndex& tsi, const Matrix44& Tparent, int& vertexIndex, int& triangleIndex);
91 
92  friend class BodyInfo_impl;
93  friend class SceneInfo_impl;
94 #ifdef OPENHRP_COLLADA_FOUND
95  friend class ColladaReader;
96  friend class BodyInfoCollada_impl;
97  friend class SceneInfoCollada_impl;
98 #endif
99 };
100 #endif
boost::intrusive_ptr< VrmlTextureTransform > VrmlTextureTransformPtr
Definition: VrmlNodes.h:301
Abstract base class of all vrml nodes.
Definition: VrmlNodes.h:121
VRML Shape node.
Definition: VrmlNodes.h:285
std::map< VrmlShapePtr, int > ShapeNodeToShapeInfoIndexMap
VRML IndexedFaseSet node.
Definition: VrmlNodes.h:483
string message
Eigen::Matrix4d Matrix44
Definition: Eigen4d.h:18
AppearanceInfoSequence originAppearances_
reads in collada files and initializes a BodyInfo struct
PortableServer::POA_var poa
Eigen::Vector3d Vector3
Definition: EigenTypes.h:11
std::string SFString
Definition: VrmlNodes.h:52
AppearanceInfoSequence appearances_
ShapeNodeToShapeInfoIndexMap shapeInfoIndexMap
MaterialInfoSequence originMaterials_
boost::intrusive_ptr< VrmlTexture > VrmlTexturePtr
Definition: VrmlNodes.h:298
TextureInfoSequence textures_
boost::intrusive_ptr< VrmlNode > VrmlNodePtr
Definition: VrmlNodes.h:155
ShapeInfoSequence shapes_
MaterialInfoSequence materials_
TriangleMeshShaper triangleMeshShaper
The colladadom reader that fills in the BodyInfoCollada_impl class.
boost::intrusive_ptr< ColdetModel > ColdetModelPtr
Definition: ColdetModel.h:268
std::map< std::string, time_t > fileTimeMap
boost::intrusive_ptr< VrmlMaterial > VrmlMaterialPtr
Definition: VrmlNodes.h:295
ShapeInfoSequence originShapes_


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:41