GLmodel.h
Go to the documentation of this file.
1 #include <hrpCorba/ModelLoader.hh>
2 #include <hrpUtil/Tvmet3d.h>
3 #include <vector>
4 
5 class GLlink;
6 
7 class GLcamera
8 {
9 public:
10  GLcamera(const OpenHRP::SensorInfo &i_si, GLlink *i_link);
11  GLcamera(int i_width, int i_height, double i_near, double i_far, double i_fovy);
12  const std::string& name() const;
13  void setView();
14  void computeAbsTransform(double o_trans[16]);
15  void setTransform(double i_trans[16]);
16  void getAbsTransform(double o_trans[16]);
17  double near() { return m_near; }
18  double far() { return m_far; }
19  double fovy() { return m_fovy; }
20  int width() { return m_width; }
21  int height() { return m_height; }
22  void getDepthOfLine(int i_row, float *o_depth);
23 private:
24  std::string m_name;
25  double m_trans[16], m_absTrans[16];
26  GLlink *m_link;
27  double m_near, m_far, m_fovy;
29 };
30 
31 class GLlink
32 {
33 public:
34  GLlink(const OpenHRP::LinkInfo &i_li, OpenHRP::BodyInfo_var i_binfo);
35 
36  void draw();
37 
38  void setParent(GLlink *i_parent);
39 
40  void addChild(GLlink *i_child);
41 
42  void setQ(double i_q);
43 
44  void setTransform(double i_trans[16]);
45 
46  int jointId();
47 
48  GLcamera *findCamera(const char *i_name);
49 
50  void computeAbsTransform(double o_trans[16]);
51 
52 private:
54  std::vector<GLlink *> m_children;
55  std::vector<GLcamera *> m_cameras;
57  double m_trans[16], m_T_j[16];
58  int m_list, m_jointId;
59 };
60 
61 class GLbody
62 {
63 public:
64  GLbody(OpenHRP::BodyInfo_var i_binfo);
65 
66  ~GLbody();
67 
68  void setPosture(double *i_angles, double *i_pos, double *i_rpy);
69 
70  void draw();
71 
72  GLcamera *findCamera(const char *i_name);
73 private:
75  std::vector<GLlink *> m_links;
76 };
77 
78 class GLscene
79 {
80 public:
81  void addBody(GLbody *i_body);
82  unsigned int numBodies() const;
83  GLbody *body(unsigned int i_rank);
84  void draw(bool swap=true);
85  void save(const char *i_fname);
86  void capture(unsigned char *o_image);
87  void init();
88  void setCamera(GLcamera *i_camera);
89  GLcamera *getCamera();
90 
91  static GLscene *getInstance();
92 private:
93  GLscene();
94  ~GLscene();
95 
96  static GLscene *m_scene;
97  std::vector<GLbody *> m_bodies;
99 };
100 
101 void mulTrans(const double i_m1[16], const double i_m2[16], double o_m[16]);
102 void printMatrix(double mat[16]);
std::vector< GLbody * > m_bodies
Definition: GLmodel.h:97
int height()
Definition: GLmodel.h:21
void save(int w, int h, const char *i_fname)
double * getAbsTransform()
Definition: GLcamera.cpp:108
unsigned int m_height
Definition: GLcamera.h:49
double m_trans[16]
Definition: GLmodel.h:25
double near()
Definition: GLmodel.h:17
double far()
Definition: GLmodel.h:18
double m_near
Definition: GLcamera.h:48
void setView()
Definition: GLcamera.cpp:73
const std::string & name() const
Definition: GLcamera.cpp:55
GLlink * m_link
Definition: GLcamera.h:47
Definition: GLbody.h:11
Eigen::Vector3d Vector3
double fovy()
Definition: GLmodel.h:19
static GLscene * m_scene
Definition: GLmodel.h:96
int width()
Definition: GLmodel.h:20
GLcamera * m_default_camera
Definition: GLmodel.h:98
double m_fovy
Definition: GLcamera.h:48
unsigned int m_width
Definition: GLcamera.h:49
GLlink * m_root
Definition: GLmodel.h:74
void setTransform(double i_trans[16])
Definition: GLmodel.cpp:70
def init()
Definition: HRP4C.py:27
GLcamera(int i_width, int i_height, double i_near, double i_far, double i_fovy, GLlink *i_link=NULL, int i_id=-1)
Definition: GLcamera.cpp:21
void getDepthOfLine(int i_row, float *o_depth)
Definition: GLmodel.cpp:78
double m_absTrans[16]
Definition: GLcamera.h:46
void capture(int w, int h, unsigned char *o_buffer)
size_t draw(int i_mode)
Definition: GLcamera.cpp:41
void computeAbsTransform(double o_trans[16])
Definition: GLcamera.cpp:63
void printMatrix(double mat[16])
Definition: GLmodel.cpp:337
std::string m_name
Definition: GLcamera.h:45
void mulTrans(const double i_m1[16], const double i_m2[16], double o_m[16])
Definition: GLutil.cpp:58
double m_far
Definition: GLcamera.h:48
std::vector< GLlink * > m_links
Definition: GLmodel.h:75


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Sat Dec 17 2022 03:52:20