GLsceneBase.h
Go to the documentation of this file.
00001 #ifndef __GL_SCENE_BASE_H__
00002 #define __GL_SCENE_BASE_H__
00003 
00004 #include <string>
00005 #include <vector>
00006 #include <map>
00007 #include <sys/time.h>
00008 //Open CV header
00009 #include <cv.h>
00010 #include <highgui.h>
00011 #include <SDL/SDL_thread.h>
00012 #include <hrpCorba/ModelLoader.hh>
00013 #include <hrpModel/ConstraintForceSolver.h>
00014 #include <hrpModel/World.h>
00015 
00016 class GLbody;
00017 class GLcamera;
00018 class LogManagerBase;
00019 
00020 #define DEFAULT_W 640
00021 #define DEFAULT_H 480
00022 #define SLIDER_AREA_HEIGHT 30
00023 #define SLIDER_SIDE_MARGIN 10
00024 
00025 class GLsceneBase : virtual public hrp::World<hrp::ConstraintForceSolver>
00026 {
00027 public:
00028     GLsceneBase(LogManagerBase *i_log);
00029     virtual ~GLsceneBase();
00030     void save(const char *i_fname);
00031     void capture(char *o_image);
00032     void init();
00033     void initLights();
00034     void defaultLights(bool flag);
00035     bool defaultLights();
00036     void clear();
00037     void requestClear();
00038     void requestCapture(const char *i_fname);
00039     void setCamera(GLcamera *i_camera);
00040     void nextCamera();
00041     void nextObject();
00042     GLcamera *getCamera();
00043     GLcamera *getDefaultCamera();
00044     void setMessages(const std::vector<std::string>& i_msgs) { m_msgs = i_msgs;}
00045     void showSlider(bool flag) { m_showSlider = flag; }
00046     void setScreenSize(int w, int h);
00047     void toggleRobotState() { m_showingStatus = !m_showingStatus; }
00048     void draw();
00049     size_t drawObjects(bool showSensors=true);
00050     void setView();
00051     virtual void showStatus() {}
00052     virtual void drawAdditionalLines() {}
00053     virtual void updateScene()=0;
00054     void showFloorGrid(bool flag);
00055     bool showFloorGrid();
00056     void showInfo(bool flag);
00057     void addBody(hrp::BodyPtr i_body);
00058     void maxEdgeLen(double i_len);
00059     hrp::BodyPtr targetObject();
00060     void setBackGroundColor(float rgb[3]);
00061     hrp::Vector3 center();
00062     void capture() { m_isCapturing = true; }
00063 protected:
00064     enum {REQ_NONE, REQ_CLEAR, REQ_CAPTURE};
00065 
00066     void drawFloorGrid();
00067     void drawInfo(double fps, size_t ntri);
00068 
00069     std::vector<std::string> m_msgs; 
00070     bool m_showingStatus, m_showSlider;
00071     int m_width, m_height;
00072     GLcamera *m_camera, *m_default_camera;
00073     struct timeval m_lastDraw;
00074     CvVideoWriter *m_videoWriter;
00075     IplImage *m_cvImage;
00076     LogManagerBase *m_log;
00077     SDL_sem *m_sem;
00078     bool m_showFloorGrid, m_showInfo, m_defaultLights;
00079     int m_request;
00080     std::string m_fname;
00081     double m_maxEdgeLen;
00082     int m_targetObject;
00083     float m_bgColor[3];
00084     bool m_isCapturing;
00085 };
00086 
00087 #endif


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