Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TANGO_POINT_CLOUD_SCENE_H_
00018 #define TANGO_POINT_CLOUD_SCENE_H_
00019
00020 #include <jni.h>
00021 #include <memory>
00022 #include <set>
00023
00024 #include <tango_client_api.h>
00025 #include <tango-gl/axis.h>
00026 #include <tango-gl/camera.h>
00027 #include <tango-gl/color.h>
00028 #include <tango-gl/gesture_camera.h>
00029 #include <tango-gl/grid.h>
00030 #include <tango-gl/frustum.h>
00031 #include <tango-gl/trace.h>
00032 #include <tango-gl/transform.h>
00033 #include <tango-gl/util.h>
00034
00035 #include <rtabmap/core/Transform.h>
00036 #include <rtabmap/core/Link.h>
00037
00038 #include <point_cloud_drawable.h>
00039 #include <graph_drawable.h>
00040
00041 #include <pcl/point_cloud.h>
00042 #include <pcl/point_types.h>
00043
00044
00045 class Scene {
00046 public:
00047
00048 Scene();
00049 ~Scene();
00050
00051
00052 void InitGLContent();
00053
00054
00055 void DeleteResources();
00056
00057
00058 void SetupViewPort(int w, int h);
00059
00060 void clear();
00061
00062
00063
00064
00065
00066
00067
00068 int Render();
00069
00070
00071
00072
00073
00074 void SetCameraType(tango_gl::GestureCamera::CameraType camera_type);
00075
00076 void SetCameraPose(const rtabmap::Transform & pose);
00077 rtabmap::Transform GetCameraPose() const {return currentPose_!=0?*currentPose_:rtabmap::Transform();}
00078 rtabmap::Transform GetOpenGLCameraPose(float * fov) const;
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 void OnTouchEvent(int touch_count, tango_gl::GestureCamera::TouchEvent event,
00090 float x0, float y0, float x1, float y1);
00091
00092 void updateGraph(
00093 const std::map<int, rtabmap::Transform> & poses,
00094 const std::multimap<int, rtabmap::Link> & links);
00095
00096 void setGraphVisible(bool visible);
00097 void setTraceVisible(bool visible);
00098
00099 void addCloud(
00100 int id,
00101 const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
00102 const std::vector<pcl::Vertices> & polygons,
00103 const rtabmap::Transform & pose,
00104 const cv::Mat & image = cv::Mat());
00105
00106 void setCloudPose(int id, const rtabmap::Transform & pose);
00107 void setCloudVisible(int id, bool visible);
00108 bool hasCloud(int id) const;
00109 std::set<int> getAddedClouds() const;
00110
00111 void setMapRendering(bool enabled) {mapRendering_ = enabled;}
00112 void setMeshRendering(bool enabled) {meshRendering_ = enabled;}
00113 void setPointSize(float size) {pointSize_ = size;}
00114
00115 private:
00116
00117 tango_gl::GestureCamera* gesture_camera_;
00118
00119
00120 tango_gl::Axis* axis_;
00121
00122
00123 tango_gl::Frustum* frustum_;
00124
00125
00126 tango_gl::Grid* grid_;
00127
00128
00129 tango_gl::Trace* trace_;
00130 GraphDrawable * graph_;
00131 bool graphVisible_;
00132 bool traceVisible_;
00133
00134 std::map<int, PointCloudDrawable*> pointClouds_;
00135
00136 rtabmap::Transform * currentPose_;
00137
00138
00139 GLuint cloud_shader_program_;
00140 GLuint texture_mesh_shader_program_;
00141 GLuint graph_shader_program_;
00142
00143 bool mapRendering_;
00144 bool meshRendering_;
00145 float pointSize_;
00146 };
00147
00148 #endif // TANGO_POINT_CLOUD_SCENE_H_