Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 2f6559b7006594cad03af173263c219e > files > 360

mrpt-doc-0.9.4-0.1.20110110svn2383.fc15.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>The MRPT project: CDisplayWindow3D.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> &gt; <b>C++ reference</b> </div>
<div align="right">
<a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a>
</div>
<!-- Generated by Doxygen 1.7.2 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
          <span class="left">
            <form id="FSearchBox" action="search.php" method="get">
              <img id="MSearchSelect" src="search/mag.png" alt=""/>
              <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" 
                     onfocus="searchBox.OnSearchFieldFocus(true)" 
                     onblur="searchBox.OnSearchFieldFocus(false)"/>
            </form>
          </span><span class="right"></span>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>CDisplayWindow3D.h</h1>  </div>
</div>
<div class="contents">
<a href="_c_display_window3_d_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* +---------------------------------------------------------------------------+</span>
<a name="l00002"></a>00002 <span class="comment">   |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |</span>
<a name="l00003"></a>00003 <span class="comment">   |                                                                           |</span>
<a name="l00004"></a>00004 <span class="comment">   |                   http://mrpt.sourceforge.net/                            |</span>
<a name="l00005"></a>00005 <span class="comment">   |                                                                           |</span>
<a name="l00006"></a>00006 <span class="comment">   |   Copyright (C) 2005-2011  University of Malaga                           |</span>
<a name="l00007"></a>00007 <span class="comment">   |                                                                           |</span>
<a name="l00008"></a>00008 <span class="comment">   |    This software was written by the Machine Perception and Intelligent    |</span>
<a name="l00009"></a>00009 <span class="comment">   |      Robotics Lab, University of Malaga (Spain).                          |</span>
<a name="l00010"></a>00010 <span class="comment">   |    Contact: Jose-Luis Blanco  &lt;jlblanco@ctima.uma.es&gt;                     |</span>
<a name="l00011"></a>00011 <span class="comment">   |                                                                           |</span>
<a name="l00012"></a>00012 <span class="comment">   |  This file is part of the MRPT project.                                   |</span>
<a name="l00013"></a>00013 <span class="comment">   |                                                                           |</span>
<a name="l00014"></a>00014 <span class="comment">   |     MRPT is free software: you can redistribute it and/or modify          |</span>
<a name="l00015"></a>00015 <span class="comment">   |     it under the terms of the GNU General Public License as published by  |</span>
<a name="l00016"></a>00016 <span class="comment">   |     the Free Software Foundation, either version 3 of the License, or     |</span>
<a name="l00017"></a>00017 <span class="comment">   |     (at your option) any later version.                                   |</span>
<a name="l00018"></a>00018 <span class="comment">   |                                                                           |</span>
<a name="l00019"></a>00019 <span class="comment">   |   MRPT is distributed in the hope that it will be useful,                 |</span>
<a name="l00020"></a>00020 <span class="comment">   |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |</span>
<a name="l00021"></a>00021 <span class="comment">   |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |</span>
<a name="l00022"></a>00022 <span class="comment">   |     GNU General Public License for more details.                          |</span>
<a name="l00023"></a>00023 <span class="comment">   |                                                                           |</span>
<a name="l00024"></a>00024 <span class="comment">   |     You should have received a copy of the GNU General Public License     |</span>
<a name="l00025"></a>00025 <span class="comment">   |     along with MRPT.  If not, see &lt;http://www.gnu.org/licenses/&gt;.         |</span>
<a name="l00026"></a>00026 <span class="comment">   |                                                                           |</span>
<a name="l00027"></a>00027 <span class="comment">   +---------------------------------------------------------------------------+ */</span>
<a name="l00028"></a>00028 <span class="preprocessor">#ifndef  CDisplayWindow3D_H</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define  CDisplayWindow3D_H</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;<a class="code" href="_c_base_g_u_i_window_8h.html">mrpt/gui/CBaseGUIWindow.h</a>&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;<a class="code" href="opengl_8h.html">mrpt/opengl.h</a>&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;<a class="code" href="opengl__fonts_8h.html">mrpt/opengl/opengl_fonts.h</a>&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;<a class="code" href="_c_image_8h.html">mrpt/utils/CImage.h</a>&gt;</span>
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 <span class="comment">/*---------------------------------------------------------------</span>
<a name="l00037"></a>00037 <span class="comment">        Class</span>
<a name="l00038"></a>00038 <span class="comment">  ---------------------------------------------------------------*/</span>
<a name="l00039"></a>00039 <span class="keyword">namespace </span>mrpt
<a name="l00040"></a><a class="code" href="structmrpt_1_1gui_1_1_c_display_window3_d_ptr.html#a18f925a4ba7907e18ad53db69c1224ca">00040</a> {
<a name="l00041"></a>00041         <span class="keyword">namespace </span>gui
<a name="l00042"></a>00042         {
<a name="l00043"></a>00043                 <span class="keyword">using namespace </span>mrpt::utils;
<a name="l00044"></a>00044 
<a name="l00045"></a>00045                 <span class="keyword">class </span>C3DWindowDialog;
<a name="l00046"></a>00046                 <span class="keyword">class </span>CMyGLCanvas_DisplayWindow3D;
<a name="l00047"></a>00047 
<a name="l00048"></a>00048                 <a class="code" href="_c_object_8h.html#a0e854723702802213de8c20bf5697bff">DEFINE_MRPT_OBJECT_PRE_CUSTOM_BASE_LINKAGE</a>(<a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html" title="A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.">CDisplayWindow3D</a>, <a class="code" href="classmrpt_1_1gui_1_1_c_base_g_u_i_window.html" title="The base class for GUI window classes.">mrpt::gui::CBaseGUIWindow</a>, <a class="code" href="gui_2include_2mrpt_2gui_2link__pragmas_8h.html#a69a861d20c11137851da0fe69a66d7b6">GUI_IMPEXP</a>)
<a name="l00049"></a>00049 
<a name="l00050"></a>00050                 <span class="comment">/** A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.</span>
<a name="l00051"></a>00051 <span class="comment">                  *  This class always contains internally an instance of opengl::COpenGLScene, which</span>
<a name="l00052"></a>00052 <span class="comment">                  *   the objects, viewports, etc. to be rendered.</span>
<a name="l00053"></a>00053 <span class="comment">                  *</span>
<a name="l00054"></a>00054 <span class="comment">                  *  Images can be grabbed automatically to disk for easy creation of videos.</span>
<a name="l00055"></a>00055 <span class="comment">                  *  See CDisplayWindow3D::grabImagesStart  (and for creating videos, mrpt::utils::CVideoFileWriter).</span>
<a name="l00056"></a>00056 <span class="comment">                  *</span>
<a name="l00057"></a>00057 <span class="comment">                  *</span>
<a name="l00058"></a>00058 <span class="comment">                  *  Since the 3D rendering is performed in a detached thread, especial care must be taken</span>
<a name="l00059"></a>00059 <span class="comment">                  *   when updating the 3D scene to be rendered. The process involves an internal critical section</span>
<a name="l00060"></a>00060 <span class="comment">                  *   and it must always consist of these steps:</span>
<a name="l00061"></a>00061 <span class="comment">                  *</span>
<a name="l00062"></a>00062 <span class="comment">                  * \code</span>
<a name="l00063"></a>00063 <span class="comment">                  *   CDisplayWindow3D  win(&quot;My window&quot;);</span>
<a name="l00064"></a>00064 <span class="comment">                  *</span>
<a name="l00065"></a>00065 <span class="comment">                  *   // Adquire the scene:</span>
<a name="l00066"></a>00066 <span class="comment">                  *   opengl::COpenGLScenePtr &amp;ptrScene = win.get3DSceneAndLock();</span>
<a name="l00067"></a>00067 <span class="comment">                  *</span>
<a name="l00068"></a>00068 <span class="comment">                  *   // Modify the scene:</span>
<a name="l00069"></a>00069 <span class="comment">                  *   ptrScene-&gt;...</span>
<a name="l00070"></a>00070 <span class="comment">                  *   // or replace by another scene:</span>
<a name="l00071"></a>00071 <span class="comment">                  *   ptrScene = otherScene;</span>
<a name="l00072"></a>00072 <span class="comment">                  *</span>
<a name="l00073"></a>00073 <span class="comment">                  *   // Unlock it, so the window can use it for redraw:</span>
<a name="l00074"></a>00074 <span class="comment">                  *   win.unlockAccess3DScene();</span>
<a name="l00075"></a>00075 <span class="comment">                  *</span>
<a name="l00076"></a>00076 <span class="comment">                  *   // Update window, if required</span>
<a name="l00077"></a>00077 <span class="comment">                  *   win.forceRepaint();</span>
<a name="l00078"></a>00078 <span class="comment">                  * \endcode</span>
<a name="l00079"></a>00079 <span class="comment">                  *</span>
<a name="l00080"></a>00080 <span class="comment">                  * An alternative way of updating the scene is by creating, before locking the 3D window, a new object</span>
<a name="l00081"></a>00081 <span class="comment">                  *  of class COpenGLScene, then locking the window only for replacing the smart pointer. This may be</span>
<a name="l00082"></a>00082 <span class="comment">                  *  advantageous is generating the 3D scene takes a long time, since while the window</span>
<a name="l00083"></a>00083 <span class="comment">                  *  is locked it will not be responsive to the user input or window redraw.</span>
<a name="l00084"></a>00084 <span class="comment">                  *</span>
<a name="l00085"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html">00085</a> <span class="comment">                  * The window can also display a set of 2D text messages overlapped to the 3D scene.</span>
<a name="l00086"></a>00086 <span class="comment">                  *  See CDisplayWindow3D::add2DTextMessage</span>
<a name="l00087"></a>00087 <span class="comment">                  *</span>
<a name="l00088"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#aa9adecc5e844d81664b85845ded2bb1a">00088</a> <span class="comment">                  *  For a list of supported events with the observer/observable pattern, see the discussion in mrpt::gui::CBaseGUIWindow.</span>
<a name="l00089"></a>00089 <span class="comment">                  *</span>
<a name="l00090"></a>00090 <span class="comment">                  *</span>
<a name="l00091"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#af363eff8a66db772f89467af51a862bb">00091</a> <span class="comment">                  * \sa  The example /samples/display3D, the &lt;a href=&quot;http://www.mrpt.org/Tutorial_3D_Scenes&quot; &gt; tutorial only&lt;/a&gt;.</span>
<a name="l00092"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a4bf71221b5cfa6c266d84d73b8a732e9">00092</a> <span class="comment">                  */</span>
<a name="l00093"></a>00093                 class <a class="code" href="gui_2include_2mrpt_2gui_2link__pragmas_8h.html#a69a861d20c11137851da0fe69a66d7b6">GUI_IMPEXP</a> <a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html" title="A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.">CDisplayWindow3D</a> : public mrpt::gui::<a class="code" href="classmrpt_1_1gui_1_1_c_base_g_u_i_window.html" title="The base class for GUI window classes.">CBaseGUIWindow</a>
<a name="l00094"></a>00094                 {
<a name="l00095"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a991d65a488fb4e18eda85b415ec616ad">00095</a>                         <span class="comment">// This must be added to any CObject derived class:</span>
<a name="l00096"></a>00096                         <a class="code" href="_c_object_8h.html#a89a1b701b9898005d954af26d92766fe" title="This declaration must be inserted in all CObject classes definition, within the class declaration...">DEFINE_MRPT_OBJECT</a>( <a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html" title="A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.">CDisplayWindow3D</a> )
<a name="l00097"></a>00097 
<a name="l00098"></a>00098                 protected:
<a name="l00099"></a>00099                         friend class C3DWindowDialog;
<a name="l00100"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a68b6c5505a99e263001f0a541bd5d360">00100</a>                         friend class CMyGLCanvas_DisplayWindow3D;
<a name="l00101"></a>00101 
<a name="l00102"></a>00102 
<a name="l00103"></a>00103                         <span class="keywordtype">float</span> m_FOV;
<a name="l00104"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a85ed58091d40a3a381a9d4f92c1ca9e8">00104</a> 
<a name="l00105"></a>00105 <span class="comment"></span>
<a name="l00106"></a>00106 <span class="comment">                        /** Internal OpenGL object (see general discussion in about usage of this object)</span>
<a name="l00107"></a>00107 <span class="comment">                          */</span>
<a name="l00108"></a>00108                         opengl::<a class="code" href="structmrpt_1_1opengl_1_1_c_open_g_l_scene_ptr.html">COpenGLScenePtr</a>                 m_3Dscene;
<a name="l00109"></a>00109 <span class="comment"></span>
<a name="l00110"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#ac1b838528ac1483cc6ddbc6db22d1a03">00110</a> <span class="comment">                        /** Critical section for accesing m_3Dscene</span>
<a name="l00111"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a416d3d265b7661fdda37fd4165d30138">00111</a> <span class="comment">                          */</span>
<a name="l00112"></a>00112                         synch::CCriticalSection         m_csAccess3DScene;
<a name="l00113"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a8ccfc144c2b27b74beb40dddbb60eeb0">00113</a> <span class="comment"></span>
<a name="l00114"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a2fa49c7fdd4fc6d0ffe492ec207c214b">00114</a> <span class="comment">                        /** Throws an exception on initialization error</span>
<a name="l00115"></a>00115 <span class="comment">                          */</span>
<a name="l00116"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#ae4bc81ff03353bd2ed307eeb915f35c7">00116</a>                         <span class="keywordtype">void</span>  createOpenGLContext();
<a name="l00117"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a721f49a3b7b164868965e18810b55bc7">00117</a> 
<a name="l00118"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#aa561e6d4d8b641c0159f9cf970b2a737">00118</a>                         <a class="code" href="structmrpt_1_1utils_1_1non__copiable__ptr__basic.html">void_ptr_noncopy</a>        m_DisplayDeviceContext;
<a name="l00119"></a>00119                         <a class="code" href="structmrpt_1_1utils_1_1non__copiable__ptr__basic.html">void_ptr_noncopy</a>        m_GLRenderingContext;
<a name="l00120"></a>00120 
<a name="l00121"></a>00121                         std::<span class="keywordtype">string</span>             m_grab_imgs_prefix;
<a name="l00122"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#ad227235bebd10d250a73c0e6707e3856">00122</a>                         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>            m_grab_imgs_idx;
<a name="l00123"></a>00123 
<a name="l00124"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#aa655c746d5fbebaf414805e2f43f849d">00124</a>                         <span class="keywordtype">bool</span>                            m_is_capturing_imgs;
<a name="l00125"></a>00125                         <a class="code" href="structmrpt_1_1utils_1_1_c_image_ptr.html">CImagePtr</a>               m_last_captured_img;
<a name="l00126"></a>00126                         synch::CCriticalSection         m_last_captured_img_cs;
<a name="l00127"></a>00127 
<a name="l00128"></a>00128                         <span class="keywordtype">void</span>  doRender();
<a name="l00129"></a>00129 
<a name="l00130"></a>00130                         mrpt::system::<a class="code" href="namespacemrpt_1_1system.html#a42674286d8d56afea013b6329bb7327a" title="A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...">TTimeStamp</a>        m_lastFullScreen;
<a name="l00131"></a>00131 
<a name="l00132"></a>00132                         <span class="keywordtype">double</span>   m_last_FPS; <span class="comment">//!&lt; \sa getRenderingFPS</span>
<a name="l00133"></a>00133 <span class="comment"></span>
<a name="l00134"></a>00134                         <span class="keywordtype">void</span> internalSetMinMaxRange();
<a name="l00135"></a>00135 
<a name="l00136"></a>00136                 public:<span class="comment"></span>
<a name="l00137"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a0962c316dedd404e09c260dfa99c1d84">00137</a> <span class="comment">                        /** Constructor</span>
<a name="l00138"></a>00138 <span class="comment">                         */</span>
<a name="l00139"></a>00139                         <a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html" title="A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.">CDisplayWindow3D</a>(
<a name="l00140"></a>00140                                 const std::<span class="keywordtype">string</span>       &amp;windowCaption = std::<span class="keywordtype">string</span>(),
<a name="l00141"></a>00141                                 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>            initialWindowWidth = 400,
<a name="l00142"></a>00142                                 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>            initialWindowHeight = 300 );
<a name="l00143"></a>00143 <span class="comment"></span>
<a name="l00144"></a>00144 <span class="comment">                        /** Class factory returning a smart pointer */</span>
<a name="l00145"></a>00145                         static <a class="code" href="structmrpt_1_1gui_1_1_c_display_window3_d_ptr.html">CDisplayWindow3DPtr</a> Create(
<a name="l00146"></a>00146                                 const std::<span class="keywordtype">string</span>       &amp;windowCaption = std::<span class="keywordtype">string</span>(),
<a name="l00147"></a>00147                                 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>            initialWindowWidth = 400,
<a name="l00148"></a>00148                                 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>            initialWindowHeight = 300 )
<a name="l00149"></a>00149                         {
<a name="l00150"></a>00150                                 <span class="keywordflow">return</span> <a class="code" href="structmrpt_1_1gui_1_1_c_display_window3_d_ptr.html">CDisplayWindow3DPtr</a>(<span class="keyword">new</span> <a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html" title="A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.">CDisplayWindow3D</a>(windowCaption,initialWindowWidth,initialWindowHeight));
<a name="l00151"></a>00151                         }
<a name="l00152"></a>00152 <span class="comment"></span>
<a name="l00153"></a>00153 <span class="comment">                        /** Destructor</span>
<a name="l00154"></a>00154 <span class="comment">                         */</span>
<a name="l00155"></a>00155                         <span class="keyword">virtual</span> ~<a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html" title="A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.">CDisplayWindow3D</a>();
<a name="l00156"></a>00156 <span class="comment"></span>
<a name="l00157"></a>00157 <span class="comment">                        /** Gets a reference to the smart shared pointer that holds the internal scene (carefuly read introduction in gui::CDisplayWindow3D before use!)</span>
<a name="l00158"></a>00158 <span class="comment">                          *  This also locks the critical section for accesing the scene, thus the window will not be repainted until it is unlocked.</span>
<a name="l00159"></a>00159 <span class="comment">                          */</span>
<a name="l00160"></a>00160                         <a class="code" href="structmrpt_1_1opengl_1_1_c_open_g_l_scene_ptr.html">opengl::COpenGLScenePtr</a> &amp; get3DSceneAndLock( );
<a name="l00161"></a>00161 <span class="comment"></span>
<a name="l00162"></a>00162 <span class="comment">                        /** Unlocks the access to the internal 3D scene.</span>
<a name="l00163"></a>00163 <span class="comment">                          *  Typically user will want to call forceRepaint after updating the scene.</span>
<a name="l00164"></a>00164 <span class="comment">                          */</span>
<a name="l00165"></a>00165                         <span class="keywordtype">void</span>  unlockAccess3DScene();
<a name="l00166"></a>00166 <span class="comment"></span>
<a name="l00167"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#ad7f8e4c6a63a9a6508f987db05083de4">00167</a> <span class="comment">                        /** Repaints the window.</span>
<a name="l00168"></a>00168 <span class="comment">                          * forceRepaint, repaint and updateWindow are all aliases of the same method.</span>
<a name="l00169"></a>00169 <span class="comment">                          */</span>
<a name="l00170"></a>00170                         <span class="keywordtype">void</span>  forceRepaint();
<a name="l00171"></a>00171 <span class="comment"></span>
<a name="l00172"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#a23d25bf3228caf6480ffbafb602504be">00172</a> <span class="comment">                        /** Repaints the window.</span>
<a name="l00173"></a>00173 <span class="comment">                          * forceRepaint, repaint and updateWindow are all aliases of the same method.</span>
<a name="l00174"></a>00174 <span class="comment">                          */</span>
<a name="l00175"></a>00175                         <span class="keywordtype">void</span>  repaint() { forceRepaint(); }
<a name="l00176"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#abf4235fe6f2b6c758ecf49e9e255a166">00176</a> <span class="comment"></span>
<a name="l00177"></a>00177 <span class="comment">                        /** Repaints the window.</span>
<a name="l00178"></a>00178 <span class="comment">                          * forceRepaint, repaint and updateWindow are all aliases of the same method.</span>
<a name="l00179"></a>00179 <span class="comment">                          */</span>
<a name="l00180"></a>00180                         <span class="keywordtype">void</span>  updateWindow() { forceRepaint(); }
<a name="l00181"></a>00181 <span class="comment"></span>
<a name="l00182"></a>00182 <span class="comment">                        /** Return the camera field of view (in degrees) (used for gluPerspective).</span>
<a name="l00183"></a>00183 <span class="comment">                          */</span>
<a name="l00184"></a>00184                         <span class="keywordtype">float</span> getFOV()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_FOV; };
<a name="l00185"></a>00185 <span class="comment"></span>
<a name="l00186"></a>00186 <span class="comment">                        /** Changes the camera min range (z) (used for gluPerspective).</span>
<a name="l00187"></a>00187 <span class="comment">                          *  The window is not updated with this method, call &quot;forceRepaint&quot; to update the 3D view.</span>
<a name="l00188"></a>00188 <span class="comment">                          */</span>
<a name="l00189"></a>00189                         <span class="keywordtype">void</span> setMinRange(<span class="keywordtype">float</span> v);
<a name="l00190"></a>00190 <span class="comment"></span>
<a name="l00191"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#ac5ad9ed8cabf9bde9789ec361eec9460">00191</a> <span class="comment">                        /** Changes the camera max range (z) (used for gluPerspective).</span>
<a name="l00192"></a>00192 <span class="comment">                          *  The window is not updated with this method, call &quot;forceRepaint&quot; to update the 3D view.</span>
<a name="l00193"></a>00193 <span class="comment">                          */</span>
<a name="l00194"></a>00194                         <span class="keywordtype">void</span> setMaxRange(<span class="keywordtype">float</span> v);
<a name="l00195"></a>00195 <span class="comment"></span>
<a name="l00196"></a>00196 <span class="comment">                        /** Changes the camera field of view (in degrees) (used for gluPerspective).</span>
<a name="l00197"></a>00197 <span class="comment">                          *  The window is not updated with this method, call &quot;forceRepaint&quot; to update the 3D view.</span>
<a name="l00198"></a>00198 <span class="comment">                          */</span>
<a name="l00199"></a>00199                         <span class="keywordtype">void</span> setFOV(<span class="keywordtype">float</span> v)  { m_FOV=v; };
<a name="l00200"></a>00200 <span class="comment"></span>
<a name="l00201"></a>00201 <span class="comment">                        /** Resizes the window, stretching the image to fit into the display area.</span>
<a name="l00202"></a>00202 <span class="comment">                         */</span>
<a name="l00203"></a>00203                         <span class="keywordtype">void</span>  resize( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> width, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> height );
<a name="l00204"></a>00204 <span class="comment"></span>
<a name="l00205"></a>00205 <span class="comment">                        /** Changes the position of the window on the screen.</span>
<a name="l00206"></a>00206 <span class="comment">                         */</span>
<a name="l00207"></a>00207                         <span class="keywordtype">void</span>  setPos( <span class="keywordtype">int</span> x, <span class="keywordtype">int</span> <a class="code" href="namespaceinternal.html#a170c9f639220e3eb414362c243c80dee">y</a> );
<a name="l00208"></a>00208 <span class="comment"></span>
<a name="l00209"></a>00209 <span class="comment">                        /** Changes the window title.</span>
<a name="l00210"></a>00210 <span class="comment">                          */</span>
<a name="l00211"></a>00211                         <span class="keywordtype">void</span>  setWindowTitle( <span class="keyword">const</span> std::string &amp;str );
<a name="l00212"></a>00212 <span class="comment"></span>
<a name="l00213"></a>00213 <span class="comment">                        /** Changes the camera parameters programatically</span>
<a name="l00214"></a>00214 <span class="comment">                          */</span>
<a name="l00215"></a>00215                         <span class="keywordtype">void</span> setCameraElevationDeg( <span class="keywordtype">float</span> deg );
<a name="l00216"></a>00216 <span class="comment"></span>
<a name="l00217"></a>00217 <span class="comment">                        /** Changes the camera parameters programatically</span>
<a name="l00218"></a>00218 <span class="comment">                          */</span>
<a name="l00219"></a>00219                         <span class="keywordtype">void</span> setCameraAzimuthDeg( <span class="keywordtype">float</span> deg );
<a name="l00220"></a>00220 <span class="comment"></span>
<a name="l00221"></a>00221 <span class="comment">                        /** Changes the camera parameters programatically</span>
<a name="l00222"></a>00222 <span class="comment">                          */</span>
<a name="l00223"></a>00223                         <span class="keywordtype">void</span> setCameraPointingToPoint( <span class="keywordtype">float</span> x,<span class="keywordtype">float</span> <a class="code" href="namespaceinternal.html#a170c9f639220e3eb414362c243c80dee">y</a>, <span class="keywordtype">float</span> z );
<a name="l00224"></a>00224 <span class="comment"></span>
<a name="l00225"></a>00225 <span class="comment">                        /** Changes the camera parameters programatically</span>
<a name="l00226"></a>00226 <span class="comment">                          */</span>
<a name="l00227"></a>00227                         <span class="keywordtype">void</span> setCameraZoom( <span class="keywordtype">float</span> zoom );
<a name="l00228"></a>00228 <span class="comment"></span>
<a name="l00229"></a>00229 <span class="comment">                        /** Sets the camera as projective, or orthogonal. */</span>
<a name="l00230"></a>00230                         <span class="keywordtype">void</span> setCameraProjective( <span class="keywordtype">bool</span> isProjective );
<a name="l00231"></a>00231 
<a name="l00232"></a>00232 <span class="comment"></span>
<a name="l00233"></a>00233 <span class="comment">                        /** Get camera parameters programatically */</span>
<a name="l00234"></a>00234                         <span class="keywordtype">float</span> getCameraElevationDeg() <span class="keyword">const</span>;
<a name="l00235"></a>00235 <span class="comment"></span>
<a name="l00236"></a>00236 <span class="comment">                        /** Get camera parameters programatically  */</span>
<a name="l00237"></a>00237                         <span class="keywordtype">float</span> getCameraAzimuthDeg() <span class="keyword">const</span>;
<a name="l00238"></a>00238 <span class="comment"></span>
<a name="l00239"></a>00239 <span class="comment">                        /** Get camera parameters programatically  */</span>
<a name="l00240"></a>00240                         <span class="keywordtype">void</span> getCameraPointingToPoint( <span class="keywordtype">float</span> &amp;x,<span class="keywordtype">float</span> &amp;<a class="code" href="namespaceinternal.html#a170c9f639220e3eb414362c243c80dee">y</a>, <span class="keywordtype">float</span> &amp;z ) <span class="keyword">const</span>;
<a name="l00241"></a>00241 <span class="comment"></span>
<a name="l00242"></a>00242 <span class="comment">                        /** Get camera parameters programatically */</span>
<a name="l00243"></a>00243                         <span class="keywordtype">float</span> getCameraZoom() <span class="keyword">const</span>;
<a name="l00244"></a>00244 <span class="comment"></span>
<a name="l00245"></a>00245 <span class="comment">                        /** Sets the camera as projective, or orthogonal. */</span>
<a name="l00246"></a>00246                         <span class="keywordtype">bool</span> isCameraProjective() <span class="keyword">const</span>;
<a name="l00247"></a>00247 <span class="comment"></span>
<a name="l00248"></a>00248 <span class="comment">                        /**  If set to true (default = false), the mouse-based scene navigation will be disabled and the camera position will be determined by the opengl viewports in the 3D scene.</span>
<a name="l00249"></a>00249 <span class="comment">                          */</span>
<a name="l00250"></a>00250                         <span class="keywordtype">void</span> useCameraFromScene(<span class="keywordtype">bool</span> useIt = <span class="keyword">true</span>);
<a name="l00251"></a>00251 <span class="comment"></span>
<a name="l00252"></a>00252 <span class="comment">                        /** Gets the 3D ray for the direction line of the pixel where the mouse cursor is at. \return False if the window is closed. \sa getLastMousePosition */</span>
<a name="l00253"></a>00253                         <span class="keywordtype">bool</span> getLastMousePositionRay(<a class="code" href="structmrpt_1_1math_1_1_t_line3_d.html" title="3D line, represented by a base point and a director vector.">mrpt::math::TLine3D</a> &amp;ray) <span class="keyword">const</span>;
<a name="l00254"></a>00254 <span class="comment"></span>
<a name="l00255"></a>00255 <span class="comment">                        /** Gets the last x,y pixel coordinates of the mouse. \return False if the window is closed. \sa getLastMousePositionRay */</span>
<a name="l00256"></a>00256                         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getLastMousePosition(<span class="keywordtype">int</span> &amp;x, <span class="keywordtype">int</span> &amp;<a class="code" href="namespaceinternal.html#a170c9f639220e3eb414362c243c80dee">y</a>) <span class="keyword">const</span>;
<a name="l00257"></a>00257 <span class="comment"></span>
<a name="l00258"></a>00258 <span class="comment">                        /** Set cursor style to default (cursorIsCross=false) or to a cross (cursorIsCross=true) \sa getLastMousePositionRay */</span>
<a name="l00259"></a>00259                         <span class="keyword">virtual</span> <span class="keywordtype">void</span> setCursorCross(<span class="keywordtype">bool</span> cursorIsCross);
<a name="l00260"></a>00260 <span class="comment"></span>
<a name="l00261"></a>00261 <span class="comment">                        /** Start to save rendered images to disk.</span>
<a name="l00262"></a>00262 <span class="comment">                          *  Images will be saved independently as png files, depending on</span>
<a name="l00263"></a>00263 <span class="comment">                          *   the template path passed to this method. For example:</span>
<a name="l00264"></a>00264 <span class="comment">                          *</span>
<a name="l00265"></a>00265 <span class="comment">                          *  path_prefix: &quot;./video_&quot;</span>
<a name="l00266"></a>00266 <span class="comment">                          *</span>
<a name="l00267"></a>00267 <span class="comment">                          *  Will generate &quot;./video_000001.png&quot;, etc.</span>
<a name="l00268"></a>00268 <span class="comment">                          *</span>
<a name="l00269"></a>00269 <span class="comment">                          *  \sa grabImagesStop</span>
<a name="l00270"></a>00270 <span class="comment">                          */</span>
<a name="l00271"></a>00271                         <span class="keywordtype">void</span> grabImagesStart( <span class="keyword">const</span> std::string &amp;grab_imgs_prefix = std::string(<span class="stringliteral">&quot;video_&quot;</span>) );
<a name="l00272"></a>00272 <span class="comment"></span>
<a name="l00273"></a>00273 <span class="comment">                        /** Stops image grabbing started by grabImagesStart</span>
<a name="l00274"></a>00274 <span class="comment">                          * \sa grabImagesStart</span>
<a name="l00275"></a>00275 <span class="comment">                          */</span>
<a name="l00276"></a>00276                         <span class="keywordtype">void</span> grabImagesStop();
<a name="l00277"></a>00277 <span class="comment"></span>
<a name="l00278"></a>00278 <span class="comment">                        /** Enables the grabbing of CImage objects from screenshots of the window.</span>
<a name="l00279"></a>00279 <span class="comment">                          *  \sa getLastWindowImage</span>
<a name="l00280"></a>00280 <span class="comment">                          */</span>
<a name="l00281"></a>00281                         <span class="keywordtype">void</span> captureImagesStart();
<a name="l00282"></a>00282 <span class="comment"></span>
<a name="l00283"></a>00283 <span class="comment">                        /** Stop image grabbing</span>
<a name="l00284"></a>00284 <span class="comment">                          * \sa captureImagesStart</span>
<a name="l00285"></a>00285 <span class="comment">                          */</span>
<a name="l00286"></a>00286                         <span class="keywordtype">void</span> captureImagesStop();
<a name="l00287"></a>00287 <span class="comment"></span>
<a name="l00288"></a>00288 <span class="comment">                        /** Retrieve the last captured image from the window.</span>
<a name="l00289"></a>00289 <span class="comment">                          *  You MUST CALL FIRST captureImagesStart to enable image grabbing.</span>
<a name="l00290"></a>00290 <span class="comment">                          * \sa captureImagesStart, getLastWindowImagePtr</span>
<a name="l00291"></a>00291 <span class="comment">                          */</span>
<a name="l00292"></a>00292                         <span class="keywordtype">void</span> getLastWindowImage( <a class="code" href="classmrpt_1_1utils_1_1_c_image.html" title="A class for storing images as grayscale or RGB bitmaps.">mrpt::utils::CImage</a> &amp;out_img) <span class="keyword">const</span>;
<a name="l00293"></a>00293 <span class="comment"></span>
<a name="l00294"></a>00294 <span class="comment">                        /** Retrieve the last captured image from the window, as a smart pointer.</span>
<a name="l00295"></a>00295 <span class="comment">                          *  This method is more efficient than getLastWindowImage since only a copy of the pointer is performed, while</span>
<a name="l00296"></a>00296 <span class="comment">                          *   getLastWindowImage would copy the entire image.</span>
<a name="l00297"></a>00297 <span class="comment">                          *</span>
<a name="l00298"></a>00298 <span class="comment">                          *  You MUST CALL FIRST captureImagesStart to enable image grabbing.</span>
<a name="l00299"></a>00299 <span class="comment">                          * \sa captureImagesStart, getLastWindowImage</span>
<a name="l00300"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#abb152d83dceb9e581a7b870c3bd6d85f">00300</a> <span class="comment">                          */</span>
<a name="l00301"></a>00301                         <a class="code" href="structmrpt_1_1utils_1_1_c_image_ptr.html">mrpt::utils::CImagePtr</a> getLastWindowImagePtr() <span class="keyword">const</span>;
<a name="l00302"></a>00302 <span class="comment"></span>
<a name="l00303"></a>00303 <span class="comment">                        /** Increments by one the image counter and return the next image file name (Users normally don&#39;t want to call this method).</span>
<a name="l00304"></a>00304 <span class="comment">                          * \sa grabImagesStart</span>
<a name="l00305"></a>00305 <span class="comment">                          */</span>
<a name="l00306"></a>00306                         std::string grabImageGetNextFile();
<a name="l00307"></a>00307 
<a name="l00308"></a>00308                         <span class="keywordtype">bool</span> isCapturingImgs()<span class="keyword"> const </span>{  <span class="keywordflow">return</span> m_is_capturing_imgs; }
<a name="l00309"></a>00309 
<a name="l00310"></a>00310 <span class="comment"></span>
<a name="l00311"></a>00311 <span class="comment">                        /** Add 2D text messages overlapped to the 3D rendered scene. The string will remain displayed in the 3D window</span>
<a name="l00312"></a>00312 <span class="comment">                          *   until it&#39;s changed with subsequent calls to this same method, or all the texts are cleared with clearTextMessages().</span>
<a name="l00313"></a>00313 <span class="comment">                          *</span>
<a name="l00314"></a>00314 <span class="comment">                          *  \param x The X position, interpreted as absolute pixels from the left if X&gt;=1, absolute pixels from the left if X&lt;0 or as a width factor if in the range [0,1[.</span>
<a name="l00315"></a>00315 <span class="comment">                          *  \param y The Y position, interpreted as absolute pixels from the bottom if Y&gt;=1, absolute pixels from the top if Y&lt;0 or as a height factor if in the range [0,1[.</span>
<a name="l00316"></a>00316 <span class="comment">                          *  \param text The text string to display.</span>
<a name="l00317"></a>00317 <span class="comment">                          *  \param color The text color. For example: TColorf(1.0,1.0,1.0)</span>
<a name="l00318"></a>00318 <span class="comment">                          *  \param unique_index An &quot;index&quot; for this text message, so that subsequent calls with the same index will overwrite this text message instead of creating new ones.</span>
<a name="l00319"></a>00319 <span class="comment">                          *</span>
<a name="l00320"></a>00320 <span class="comment">                          *  You&#39;ll need to refresh the display manually with forceRepaint().</span>
<a name="l00321"></a>00321 <span class="comment">                          *</span>
<a name="l00322"></a>00322 <span class="comment">                          * \sa clearTextMessages</span>
<a name="l00323"></a>00323 <span class="comment">                          */</span>
<a name="l00324"></a>00324                         <span class="keywordtype">void</span> addTextMessage(
<a name="l00325"></a>00325                                 <span class="keyword">const</span> <span class="keywordtype">double</span> x,
<a name="l00326"></a>00326                                 <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="namespaceinternal.html#a170c9f639220e3eb414362c243c80dee">y</a>,
<a name="l00327"></a>00327                                 <span class="keyword">const</span> std::string &amp;text,
<a name="l00328"></a>00328                                 <span class="keyword">const</span> <a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html" title="A RGB color - floats in the range [0,1].">mrpt::utils::TColorf</a> &amp;color = <a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html" title="A RGB color - floats in the range [0,1].">mrpt::utils::TColorf</a>(1.0,1.0,1.0),
<a name="l00329"></a>00329                                 <span class="keyword">const</span> <span class="keywordtype">size_t</span> unique_index = 0,
<a name="l00330"></a>00330                                 <span class="keyword">const</span> <a class="code" href="namespacemrpt_1_1opengl.html#a4e54252970d0b0a6dd251335064a2346" title="Existing fonts for 2D texts in mrpt::opengl methods.">TOpenGLFont</a> font = <a class="code" href="namespacemrpt_1_1opengl.html#a4e54252970d0b0a6dd251335064a2346a31ebbbe2889bcca4760b90bba40385b8">MRPT_GLUT_BITMAP_TIMES_ROMAN_24</a>
<a name="l00331"></a>00331                                 );
<a name="l00332"></a>00332 <span class="comment"></span>
<a name="l00333"></a>00333 <span class="comment">                        /**  Clear all text messages created with addTextMessage().</span>
<a name="l00334"></a>00334 <span class="comment">                          *  You&#39;ll need to refresh the display manually with forceRepaint().</span>
<a name="l00335"></a><a class="code" href="classmrpt_1_1gui_1_1_c_display_window3_d.html#afd69c044e6364fc3341dfa3abd3930b5">00335</a> <span class="comment">                          * \sa addTextMessage</span>
<a name="l00336"></a>00336 <span class="comment">                          */</span>
<a name="l00337"></a>00337                         <span class="keywordtype">void</span> clearTextMessages();
<a name="l00338"></a>00338 <span class="comment"></span>
<a name="l00339"></a>00339 <span class="comment">                        /** Set the rendering FPS (users don&#39;t call this, the method is for internal MRPT objects only) \sa getRenderingFPS */</span>
<a name="l00340"></a>00340                         <span class="keywordtype">void</span> setRenderingFPS(<span class="keywordtype">double</span> FPS);
<a name="l00341"></a>00341 <span class="comment"></span>
<a name="l00342"></a>00342 <span class="comment">                        /** Get the average Frames Per Second (FPS) value from the last 250 rendering events */</span>
<a name="l00343"></a>00343                         <span class="keywordtype">double</span> getRenderingFPS()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_last_FPS; }
<a name="l00344"></a>00344 
<a name="l00345"></a>00345                 }; <span class="comment">// End of class def.</span>
<a name="l00346"></a>00346         } <span class="comment">// End of namespace</span>
<a name="l00347"></a>00347 } <span class="comment">// End of namespace</span>
<a name="l00348"></a>00348 
<a name="l00349"></a>00349 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.7.2</a> for MRPT 0.9.4 SVN: at Mon Jan 10 22:30:30 UTC 2011</td><td></td> <td width="100"> </td> <td width="150">  </td></tr> </table> </body></html>