00001 #ifndef __GLLINK_H__ 00002 #define __GLLINK_H__ 00003 00004 #include <string> 00005 #include <vector> 00006 #ifdef __APPLE__ 00007 #include <OpenGL/gl.h> 00008 #else 00009 #include <GL/gl.h> 00010 #endif 00011 #include <hrpModel/Link.h> 00012 #include "GLcoordinates.h" 00013 00014 class GLcamera; 00015 class GLshape; 00016 00017 class GLlink : public hrp::Link, public GLcoordinates 00018 { 00019 public: 00020 enum {DM_SOLID, DM_WIREFRAME, DM_COLLISION, DM_NUM}; 00021 00022 GLlink(); 00023 ~GLlink(); 00024 size_t draw(); 00025 void setQ(double i_q); 00026 00027 GLcamera *findCamera(const char *i_name); 00028 00029 void computeAbsTransform(); 00030 void computeAbsTransform(double o_trans[16]); 00031 void setAbsTransform(double o_trans[16]); 00032 void addShape(GLshape *shape); 00033 void addCamera(GLcamera *camera); 00034 void showAxes(bool flag); 00035 void highlight(bool flag); 00036 void divideLargeTriangles(double maxEdgeLen); 00037 const std::vector<GLcamera *>& cameras(); 00038 void computeAABB(hrp::Vector3& o_min, hrp::Vector3& o_max); 00039 static void useAbsTransformToDraw(); 00040 static int drawMode(); 00041 static void drawMode(int i_mode); 00042 protected: 00043 static bool m_useAbsTransformToDraw; 00044 static int m_drawMode; 00045 std::vector<GLcamera *> m_cameras; 00046 double m_T_j[16], m_absTrans[16]; 00047 std::vector<GLshape *> m_shapes; 00048 bool m_showAxes, m_highlight; 00049 }; 00050 00051 hrp::Link *GLlinkFactory(); 00052 00053 #endif