00001
00002
00003
00004
00005 #ifndef CAJUN_DRAW_SCAN_GP_H
00006 #define CAJUN_DRAW_SCAN_GP_H
00007
00008 #include "data_queue.H"
00009 #include "laser_data.H"
00010 #include "component_interface.H"
00011
00012 #include "GL/glx.h"
00013
00014 #ifdef VR_JUGGLER
00015 #include <vrj/Draw/OGL/GlContextData.h>
00016 #endif
00017
00018 namespace cajun
00019 {
00020 class draw_scan_gp_t : public laser_data_t, public component_interface_t
00021 {
00022 public:
00023 draw_scan_gp_t (double cbviz_origin[3], int scan_gp_id,
00024 conf_t &conf, world_state_t *ws_);
00025 virtual ~draw_scan_gp_t ();
00026 void intra_update_data ();
00027 void update_data (double bot_pos_[3]);
00028 void dynamic_data ();
00029 void display (double bot_pos[3]);
00030 void toggle_display ();
00031 void flush_buffer ();
00032 void init_data ();
00033 private:
00034 void translate_pts (scan_gp_data_t &scan_gp_);
00035 struct point_t
00036 {
00037 point_t () {;}
00038 point_t (float pt_x_, float pt_y_, float pt_z_)
00039 : x (pt_x_), y (pt_y_), z (pt_z_)
00040 {}
00041 point_t (double pt_x_, double pt_y_, double pt_z_)
00042 : x (pt_x_), y (pt_y_), z (pt_z_)
00043 {}
00044 float x, y, z;
00045 unsigned char r, g, b, a;
00046 };
00047
00048 bool m_vbo_support;
00049 unsigned m_num_scans;
00050 point_t *m_vertex_data;
00051
00052 double m_prev_scan_tstamp;
00053
00054 size_t m_counter;
00055 size_t m_buffer_size;
00056 size_t m_prev_data_point;
00057
00058 #ifdef VR_JUGGLER
00059 vrj::GlContextData<GLuint> m_vbo_vert_name;
00060 #else
00061 unsigned m_vbo_vert_name;
00062 #endif
00063 scan_gp_data_t::coord_t start_beam, end_beam;
00064
00065 PFNGLGENBUFFERSARBPROC glGenBuffersARB;
00066 PFNGLBINDBUFFERARBPROC glBindBufferARB;
00067 PFNGLBUFFERDATAARBPROC glBufferDataARB;
00068 PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB;
00069 PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB;
00070 };
00071 }
00072 #endif