Go to the documentation of this file.00001 #ifndef __IRR_MODEL_H__
00002 #define __IRR_MODEL_H__
00003
00004 #include <irrlicht/irrlicht.h>
00005 #include <hrpModel/ModelLoaderUtil.h>
00006
00007 class GLbody;
00008 class GLcamera;
00009 class GLlink;
00010
00011 class GLscene
00012 {
00013 public:
00014 GLscene();
00015 ~GLscene();
00016 static GLscene *getInstance();
00017 bool init(int w=640, int h=480);
00018 void draw();
00019 GLbody *addBody(OpenHRP::BodyInfo_var i_binfo);
00020 void setCamera(GLcamera *i_camera);
00021 GLcamera *getCamera();
00022 irr::scene::ISceneManager *getSceneManager();
00023 irr::video::IVideoDriver *getVideoDriver();
00024 private:
00025 static GLscene *m_scene;
00026 irr::IrrlichtDevice *m_device;
00027 GLcamera *m_camera, *m_defaultCamera;
00028 irr::scene::ICameraSceneNode *m_cnode;
00029 irr::IEventReceiver *m_receiver;
00030 };
00031
00032 class GLcamera
00033 {
00034 public:
00035 GLcamera(const OpenHRP::SensorInfo& i_info,
00036 irr::scene::ISceneNode *i_node);
00037 GLcamera(irr::scene::ISceneNode *i_node);
00038 void setCameraParameters(irr::scene::ICameraSceneNode *i_camera);
00039 void updateCameraTransform(irr::scene::ICameraSceneNode *i_camera);
00040 const char *name();
00041 int width();
00042 int height();
00043 float near();
00044 float far();
00045 float fovy();
00046 void getAbsTransform(double *o_T);
00047 private:
00048 irr::scene::ISceneNode *m_node;
00049 float m_near, m_far, m_fovy;
00050 int m_width, m_height;
00051 };
00052
00053 class GLbody : public irr::scene::ISceneNode
00054 {
00055 public:
00056 GLbody(irr::scene::ISceneNode *i_parent,
00057 irr::scene::ISceneManager *i_mgr,
00058 irr::s32 i_id,
00059 OpenHRP::BodyInfo_var i_binfo);
00060 virtual void render() {}
00061 virtual const irr::core::aabbox3d<irr::f32>& getBoundingBox() const {
00062 return m_box;
00063 }
00064 void setPosture(double *i_angles, double *i_pos, double *i_rpy);
00065 GLcamera *findCamera(const char *i_name);
00066 private:
00067 irr::core::aabbox3d<irr::f32> m_box;
00068 std::vector<GLlink *> m_links;
00069 GLlink *m_root;
00070 };
00071
00072 #endif