GLmodel.h
Go to the documentation of this file.
00001 #include <hrpCorba/ModelLoader.hh>
00002 #include <hrpUtil/Tvmet3d.h>
00003 #include <vector>
00004 
00005 class GLlink;
00006 
00007 class GLcamera
00008 {
00009 public:
00010     GLcamera(const OpenHRP::SensorInfo &i_si, GLlink *i_link);
00011     GLcamera(int i_width, int i_height, double i_near, double i_far, double i_fovy);
00012     const std::string& name() const;
00013     void setView();
00014     void computeAbsTransform(double o_trans[16]);
00015     void setTransform(double i_trans[16]);
00016     void getAbsTransform(double o_trans[16]);
00017     double near() { return m_near; }
00018     double far() { return m_far; }
00019     double fovy() { return m_fovy; }
00020     int width() { return m_width; }
00021     int height() { return m_height; }
00022     void getDepthOfLine(int i_row, float *o_depth);
00023 private:
00024     std::string m_name;
00025     double m_trans[16], m_absTrans[16];
00026     GLlink *m_link;
00027     double m_near, m_far, m_fovy;
00028     int m_width, m_height;
00029 };
00030 
00031 class GLlink
00032 {
00033 public:
00034     GLlink(const OpenHRP::LinkInfo &i_li, OpenHRP::BodyInfo_var i_binfo);
00035 
00036     void draw();
00037 
00038     void setParent(GLlink *i_parent);
00039 
00040     void addChild(GLlink *i_child);
00041 
00042     void setQ(double i_q);
00043 
00044     void setTransform(double i_trans[16]);
00045 
00046     int jointId();
00047 
00048     GLcamera *findCamera(const char *i_name);
00049 
00050     void computeAbsTransform(double o_trans[16]);
00051 
00052 private:
00053     GLlink *m_parent;
00054     std::vector<GLlink *> m_children;
00055     std::vector<GLcamera *> m_cameras;
00056     hrp::Vector3 m_axis;
00057     double m_trans[16], m_T_j[16];
00058     int m_list, m_jointId;
00059 };
00060 
00061 class GLbody
00062 {
00063 public:
00064     GLbody(OpenHRP::BodyInfo_var i_binfo);
00065 
00066     ~GLbody();
00067 
00068     void setPosture(double *i_angles, double *i_pos, double *i_rpy);
00069 
00070     void draw();
00071 
00072     GLcamera *findCamera(const char *i_name);
00073 private:
00074     GLlink *m_root;
00075     std::vector<GLlink *> m_links;
00076 };
00077 
00078 class GLscene
00079 {
00080 public:
00081     void addBody(GLbody *i_body);
00082     unsigned int numBodies() const;
00083     GLbody *body(unsigned int i_rank);
00084     void draw(bool swap=true);
00085     void save(const char *i_fname);
00086     void capture(unsigned char *o_image);
00087     void init();
00088     void setCamera(GLcamera *i_camera);
00089     GLcamera *getCamera();
00090 
00091     static GLscene *getInstance();
00092 private:
00093     GLscene();
00094     ~GLscene();
00095 
00096     static GLscene *m_scene;
00097     std::vector<GLbody *> m_bodies; 
00098     GLcamera *m_camera, *m_default_camera;
00099 };
00100 
00101 void mulTrans(const double i_m1[16], const double i_m2[16], double o_m[16]);
00102 void printMatrix(double mat[16]);


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed May 15 2019 05:02:17