<!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>CRenderizable.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> > <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.5 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related 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> <div id="MSearchBox" class="MSearchBoxInactive"> <div 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> </div><div class="right"></div> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">CRenderizable.h</div> </div> </div> <div class="contents"> <a href="_c_renderizable_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://www.mrpt.org/ |</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 <jlblanco@ctima.uma.es> |</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 <http://www.gnu.org/licenses/>. |</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 opengl_CRenderizable_H</span> <a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define opengl_CRenderizable_H</span> <a name="l00030"></a>00030 <span class="preprocessor"></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <<a class="code" href="utils__defs_8h.html">mrpt/utils/utils_defs.h</a>></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <<a class="code" href="_c_serializable_8h.html">mrpt/utils/CSerializable.h</a>></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <<a class="code" href="_t_color_8h.html">mrpt/utils/TColor.h</a>></span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="preprocessor">#include <<a class="code" href="_c_pose3_d_8h.html">mrpt/poses/CPose3D.h</a>></span> <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="preprocessor">#include <<a class="code" href="_c_critical_section_8h.html">mrpt/synch/CCriticalSection.h</a>></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <<a class="code" href="lightweight__geom__data_8h.html">mrpt/math/lightweight_geom_data.h</a>></span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#include <<a class="code" href="opengl__fonts_8h.html">mrpt/opengl/opengl_fonts.h</a>></span> <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="preprocessor">#include <<a class="code" href="opengl_2include_2mrpt_2opengl_2link__pragmas_8h.html">mrpt/opengl/link_pragmas.h</a>></span> <a name="l00043"></a>00043 <a name="l00044"></a>00044 <span class="keyword">namespace </span>mrpt <a name="l00045"></a>00045 { <a name="l00046"></a>00046 <span class="keyword">namespace </span>poses { <span class="keyword">class </span>CPoint3D; <span class="keyword">class </span>CPoint2D; } <a name="l00047"></a>00047 <span class="keyword">namespace </span>utils { <span class="keyword">class </span>CStringList; } <a name="l00048"></a>00048 <a name="l00049"></a>00049 <span class="keyword">namespace </span>opengl <a name="l00050"></a>00050 { <a name="l00051"></a>00051 <span class="keyword">class </span>COpenGLViewport; <a name="l00052"></a>00052 <span class="keyword">class </span><a class="code" href="namespacemrpt_1_1opengl.html#a1e04013345790c52d31b81cb561147be">CSetOfObjects</a>; <a name="l00053"></a>00053 <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="comment">// This must be added to any CSerializable derived class:</span> <a name="l00056"></a><a class="code" href="structmrpt_1_1opengl_1_1_c_renderizable_ptr.html#ac05f86d2895634ea27f0cf07fb37f998">00056</a> <a class="code" href="_c_serializable_8h.html#a9ef523d787f6cb837a0585b790882588" title="This declaration must be inserted in all CSerializable classes definition, before the class declarati...">DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE</a>( <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>, <a class="code" href="classmrpt_1_1utils_1_1_c_serializable.html" title="The virtual base class which provides a unified interface for all persistent objects in MRPT...">mrpt::utils::CSerializable</a>, <a class="code" href="opengl_2include_2mrpt_2opengl_2link__pragmas_8h.html#af6a1c8d5d6b3c8c0af00dbeef88ce269">OPENGL_IMPEXP</a> ) <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="comment">/** A list of objects pointers, automatically managing memory free at destructor, and managing copies correctly. */</span> <a name="l00059"></a><a class="code" href="namespacemrpt_1_1opengl.html#a2a98ed1cbee2bf526d35d6d3cc8ae9f6">00059</a> typedef std::<a class="code" href="classstd_1_1deque.html" title="STL class.">deque</a><<a class="code" href="structmrpt_1_1opengl_1_1_c_renderizable_ptr.html">CRenderizablePtr</a>> <a class="code" href="classstd_1_1deque.html">CListOpenGLObjects</a>; <a name="l00060"></a>00060 <span class="comment"></span> <a name="l00061"></a>00061 <span class="comment"> /** The base class of 3D objects that can be directly rendered through OpenGL.</span> <a name="l00062"></a>00062 <span class="comment"> * In this class there are a set of common properties to all 3D objects, mainly:</span> <a name="l00063"></a>00063 <span class="comment"> * - A name (m_name): A name that can be optionally asigned to objects for easing its reference.</span> <a name="l00064"></a>00064 <span class="comment"> * - 6D coordinates (x,y,z,yaw,pitch,roll), relative to the "current" reference framework. By default, any object is referenced to global scene coordinates.</span> <a name="l00065"></a>00065 <span class="comment"> * - A RGB color: This field will be used in simple elements (points, lines, text,...) but is ignored in more complex objects that carry their own color information (triangle sets,...)</span> <a name="l00066"></a>00066 <span class="comment"> * See the main class opengl::COpenGLScene</span> <a name="l00067"></a>00067 <span class="comment"> * \sa opengl::COpenGLScene, mrpt::opengl</span> <a name="l00068"></a>00068 <span class="comment"> * \ingroup mrpt_opengl_grp</span> <a name="l00069"></a>00069 <span class="comment"> */</span> <a name="l00070"></a>00070 class <a class="code" href="opengl_2include_2mrpt_2opengl_2link__pragmas_8h.html#af6a1c8d5d6b3c8c0af00dbeef88ce269">OPENGL_IMPEXP</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a> : public mrpt::utils::<a class="code" href="classmrpt_1_1utils_1_1_c_serializable.html" title="The virtual base class which provides a unified interface for all persistent objects in MRPT...">CSerializable</a> <a name="l00071"></a>00071 { <a name="l00072"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a6fec28a53e20dfc1c4d046c26f9f7b48">00072</a> <a class="code" href="_c_serializable_8h.html#a5876f72cf51bfb66a82bf81cc493febc" title="This declaration must be inserted in virtual CSerializable classes definition:">DEFINE_VIRTUAL_SERIALIZABLE</a>( <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a> ) <a name="l00073"></a>00073 <a name="l00074"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac50eaea2662d8a8d6653161f329ec9dc">00074</a> friend class mrpt::opengl::<a class="code" href="classmrpt_1_1opengl_1_1_c_open_g_l_viewport.html" title="A viewport within a COpenGLScene, containing a set of OpenGL objects to render.">COpenGLViewport</a>; <a name="l00075"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a9c9d1e367181d87af8c01ae5d17ccbd8">00075</a> friend class mrpt::opengl::<a class="code" href="classmrpt_1_1opengl_1_1_c_set_of_objects.html" title="A set of object, which are referenced to the coordinates framework established in this object...">CSetOfObjects</a>; <a name="l00076"></a>00076 <a name="l00077"></a>00077 protected: <a name="l00078"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac60facc9c53d7319b87e82c8e6730c27">00078</a> std::<span class="keywordtype">string</span> m_name; <a name="l00079"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a437eafa450aaa90601803507599260d7">00079</a> <span class="keywordtype">bool</span> m_show_name; <a name="l00080"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#af98af9094c896da6b94a06b4793c788b">00080</a> mrpt::utils::<a class="code" href="structmrpt_1_1utils_1_1_t_color.html" title="A RGB color - 8bit.">TColor</a> m_color; <span class="comment">//!< Color components in the range [0,255]</span> <a name="l00081"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a5b6a2612a9a58ce6a38ae8e583269ac4">00081</a> <span class="comment"></span> mrpt::poses::<a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">CPose3D</a> m_pose; <span class="comment">//!< 6D pose wrt the parent coordinate reference. This class automatically holds the cached 3x3 rotation matrix for quick load into opengl stack.</span> <a name="l00082"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a1994bcb30363d854a83fa2e85480ed0d">00082</a> <span class="comment"></span> <span class="keywordtype">float</span> m_scale_x, m_scale_y, m_scale_z; <span class="comment">//!< Scale components to apply to the object (default=1)</span> <a name="l00083"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a710f324d115817edceed185fc584f1e2">00083</a> <span class="comment"></span> <span class="keywordtype">bool</span> m_visible; <span class="comment">//!< Is the object visible? (default=true)</span> <a name="l00084"></a>00084 <span class="comment"></span> <a name="l00085"></a>00085 public:<span class="comment"></span> <a name="l00086"></a>00086 <span class="comment"> /** @name Changes the appearance of the object to render</span> <a name="l00087"></a>00087 <span class="comment"> @{ */</span> <a name="l00088"></a>00088 <a name="l00089"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#aef8ee6b259e755d686f38178982bf138">00089</a> <span class="keywordtype">void</span> setName(const std::<span class="keywordtype">string</span> &n) { m_name=n; } <span class="comment">//!< Changes the name of the object</span> <a name="l00090"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a6a1f9dd6551d1437ba63c712dce80110">00090</a> <span class="comment"></span> <span class="keyword">const</span> std<a class="code" href="classstd_1_1string.html" title="STL class.">::string</a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a6a1f9dd6551d1437ba63c712dce80110" title="Returns the name of the object.">getName</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_name; } <span class="comment">//!< Returns the name of the object</span> <a name="l00091"></a>00091 <span class="comment"></span> <a name="l00092"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a5b648ce8cde3ac142d8d062edbc81fee">00092</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a5b648ce8cde3ac142d8d062edbc81fee" title="Is the object visible?">isVisible</a>() const <span class="comment">/** Is the object visible? \sa setVisibility */</span> { <span class="keywordflow">return</span> m_visible; } <a name="l00093"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a26a0f88efc4fa587ce6bae52577a7354">00093</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a26a0f88efc4fa587ce6bae52577a7354" title="Set object visibility (default=true)">setVisibility</a>(<span class="keywordtype">bool</span> visible=<span class="keyword">true</span>) <span class="comment">/** Set object visibility (default=true) \sa isVisible */</span> { m_visible=visible; } <a name="l00094"></a>00094 <a name="l00095"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac0579ae5563d5f2c13e2e03c79f71257">00095</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac0579ae5563d5f2c13e2e03c79f71257" title="Enables or disables showing the name of the object as a label when rendering.">enableShowName</a>(<span class="keywordtype">bool</span> showName=<span class="keyword">true</span>) { m_show_name=showName; } <span class="comment">//!< Enables or disables showing the name of the object as a label when rendering</span> <a name="l00096"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a66baeb37cd774b76207e4d8e96871f61">00096</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a66baeb37cd774b76207e4d8e96871f61">isShowNameEnabled</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_show_name; } <span class="comment">//!< \sa enableShowName</span> <a name="l00097"></a>00097 <span class="comment"></span> <a name="l00098"></a>00098 <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& setPose( <span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">mrpt::poses::CPose3D</a> &o ); <span class="comment">//!< Set the 3D pose from a mrpt::poses::CPose3D object (return a ref to this)</span> <a name="l00099"></a>00099 <span class="comment"></span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& setPose( <span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">mrpt::math::TPose3D</a> &o ); <span class="comment">//!< Set the 3D pose from a mrpt::math::TPose3D object (return a ref to this)</span> <a name="l00100"></a>00100 <span class="comment"></span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& setPose( <span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_point3_d.html" title="A class used to store a 3D point.">mrpt::poses::CPoint3D</a> &o ); <span class="comment">//!< Set the 3D pose from a mrpt::poses::CPose3D object (return a ref to this)</span> <a name="l00101"></a>00101 <span class="comment"></span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& setPose( <span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_point2_d.html" title="A class used to store a 2D point.">mrpt::poses::CPoint2D</a> &o ); <span class="comment">//!< Set the 3D pose from a mrpt::poses::CPose3D object (return a ref to this)</span> <a name="l00102"></a>00102 <span class="comment"></span> <a name="l00103"></a>00103 mrpt<a class="code" href="structmrpt_1_1math_1_1_t_pose3_d.html" title="Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).">::math::TPose3D</a> getPose() <span class="keyword">const</span>; <span class="comment">//!< Returns the 3D pose of the object as TPose3D</span> <a name="l00104"></a>00104 <span class="comment"></span><span class="comment"> /** Returns a const ref to the 3D pose of the object as CPose3D (which explicitly contains the 3x3 rotation matrix) */</span> <a name="l00105"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ae508ae04f460443c484935fcdfc8ee3a">00105</a> <span class="keyword">inline</span> <span class="keyword">const</span> mrpt<a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">::poses::CPose3D</a> & <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ae508ae04f460443c484935fcdfc8ee3a" title="Returns a const ref to the 3D pose of the object as CPose3D (which explicitly contains the 3x3 rotati...">getPoseRef</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pose; } <a name="l00106"></a>00106 <span class="comment"></span> <a name="l00107"></a>00107 <span class="comment"> /** Changes the location of the object, keeping untouched the orientation \return a ref to this */</span> <a name="l00108"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a9d715bc6ec58cdd70a29aef45b2e1338">00108</a> <span class="keyword">inline</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a9d715bc6ec58cdd70a29aef45b2e1338" title="Changes the location of the object, keeping untouched the orientation.">setLocation</a>(<span class="keywordtype">double</span> x,<span class="keywordtype">double</span> <a class="code" href="namespace_eigen_1_1internal.html#a3d7a581aeb951248dc6fe114e9e05f07">y</a>,<span class="keywordtype">double</span> z) { m_pose.x(x); m_pose.y(y); m_pose.z(z); <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00109"></a>00109 <span class="comment"></span> <a name="l00110"></a>00110 <span class="comment"> /** Changes the location of the object, keeping untouched the orientation \return a ref to this */</span> <a name="l00111"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a44cf2579e949206f535b25228526a8a6">00111</a> <span class="keyword">inline</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a44cf2579e949206f535b25228526a8a6" title="Changes the location of the object, keeping untouched the orientation.">setLocation</a>(<span class="keyword">const</span> <a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html" title="Lightweight 3D point.">mrpt::math::TPoint3D</a> &p ) { m_pose.x(p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a5014ee49d97866d293568300b619a7e2" title="X coordinate.">x</a>); m_pose.y(p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#aec879c0d61d8446e93b7d09344931d37" title="Y coordinate.">y</a>); m_pose.z(p.<a class="code" href="structmrpt_1_1math_1_1_t_point3_d.html#a61df04839b9146696e696fc7af3bc307" title="Z coordinate.">z</a>); <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <a name="l00112"></a>00112 <a name="l00113"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a0755e54ced9652afa3d8d608c5ab07e5">00113</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a0755e54ced9652afa3d8d608c5ab07e5" title="Translation relative to parent coordinate origin.">getPoseX</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pose.x(); } <span class="comment">//!< Translation relative to parent coordinate origin.</span> <a name="l00114"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a51605f842fe3c65ef29c8b6f9c70bbea">00114</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a51605f842fe3c65ef29c8b6f9c70bbea" title="Translation relative to parent coordinate origin.">getPoseY</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pose.y(); } <span class="comment">//!< Translation relative to parent coordinate origin.</span> <a name="l00115"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a1c8ec31d9b8d2614ae993d361c1075be">00115</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a1c8ec31d9b8d2614ae993d361c1075be" title="Translation relative to parent coordinate origin.">getPoseZ</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pose.z(); } <span class="comment">//!< Translation relative to parent coordinate origin.</span> <a name="l00116"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a259175514327566d480b5d476538332f">00116</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a259175514327566d480b5d476538332f" title="Rotation relative to parent coordinate origin, in **DEGREES**.">getPoseYaw</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="namespacemrpt_1_1utils.html#a62aea6de6157d52c54ae4251c871cfc1" title="Radians to degrees.">mrpt::utils::RAD2DEG</a>(m_pose.yaw()); } <span class="comment">//!< Rotation relative to parent coordinate origin, in **DEGREES**.</span> <a name="l00117"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a00a7da15bc55e5bda90e56b268547b17">00117</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a00a7da15bc55e5bda90e56b268547b17" title="Rotation relative to parent coordinate origin, in **DEGREES**.">getPosePitch</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="namespacemrpt_1_1utils.html#a62aea6de6157d52c54ae4251c871cfc1" title="Radians to degrees.">mrpt::utils::RAD2DEG</a>(m_pose.pitch()); } <span class="comment">//!< Rotation relative to parent coordinate origin, in **DEGREES**.</span> <a name="l00118"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a5e33a3f3f26c51891d4c5c55030a695d">00118</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a5e33a3f3f26c51891d4c5c55030a695d" title="Rotation relative to parent coordinate origin, in **DEGREES**.">getPoseRoll</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="namespacemrpt_1_1utils.html#a62aea6de6157d52c54ae4251c871cfc1" title="Radians to degrees.">mrpt::utils::RAD2DEG</a>(m_pose.roll()); } <span class="comment">//!< Rotation relative to parent coordinate origin, in **DEGREES**.</span> <a name="l00119"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a786c10928768ac5ba28db725a3d3139e">00119</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a786c10928768ac5ba28db725a3d3139e" title="Rotation relative to parent coordinate origin, in radians.">getPoseYawRad</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pose.yaw(); } <span class="comment">//!< Rotation relative to parent coordinate origin, in radians.</span> <a name="l00120"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a0f53bc42eee756e472ee722ca8ef4ccd">00120</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a0f53bc42eee756e472ee722ca8ef4ccd" title="Rotation relative to parent coordinate origin, in radians.">getPosePitchRad</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pose.pitch(); } <span class="comment">//!< Rotation relative to parent coordinate origin, in radians.</span> <a name="l00121"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#aaea6e3654c0304b32cc8892aecf6cae2">00121</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#aaea6e3654c0304b32cc8892aecf6cae2" title="Rotation relative to parent coordinate origin, in radians.">getPoseRollRad</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_pose.roll(); } <span class="comment">//!< Rotation relative to parent coordinate origin, in radians.</span> <a name="l00122"></a>00122 <span class="comment"></span> <a name="l00123"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a6b0f2c12af070fe2277518295c70d1d8">00123</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a6b0f2c12af070fe2277518295c70d1d8" title="Color components in the range [0,1].">getColorR</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_color.R/255.; } <span class="comment">//!< Color components in the range [0,1]</span> <a name="l00124"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a110b12b0f417543e5ca4c1058f70ecc6">00124</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a110b12b0f417543e5ca4c1058f70ecc6" title="Color components in the range [0,1].">getColorG</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_color.G/255.; } <span class="comment">//!< Color components in the range [0,1]</span> <a name="l00125"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ab89afd8f753f9ec8b514c213cae93a56">00125</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ab89afd8f753f9ec8b514c213cae93a56" title="Color components in the range [0,1].">getColorB</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_color.B/255.; } <span class="comment">//!< Color components in the range [0,1]</span> <a name="l00126"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a9abefacfc7c1d50d95d923f02b3eda5d">00126</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a9abefacfc7c1d50d95d923f02b3eda5d" title="Color components in the range [0,1].">getColorA</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_color.A/255.; } <span class="comment">//!< Color components in the range [0,1]</span> <a name="l00127"></a>00127 <span class="comment"></span> <a name="l00128"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a805cf035db65a17c3e0f07e50d37e570">00128</a> <span class="keyword">inline</span> uint8_t <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a805cf035db65a17c3e0f07e50d37e570" title="Color components in the range [0,255].">getColorR_u8</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_color.R; } <span class="comment">//!< Color components in the range [0,255]</span> <a name="l00129"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a1111b134b4b50b7f2c244880256c9455">00129</a> <span class="comment"></span> <span class="keyword">inline</span> uint8_t <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a1111b134b4b50b7f2c244880256c9455" title="Color components in the range [0,255].">getColorG_u8</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_color.G; } <span class="comment">//!< Color components in the range [0,255]</span> <a name="l00130"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#af536b5eb76557c43fdda68ea428d79fe">00130</a> <span class="comment"></span> <span class="keyword">inline</span> uint8_t <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#af536b5eb76557c43fdda68ea428d79fe" title="Color components in the range [0,255].">getColorB_u8</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_color.B; } <span class="comment">//!< Color components in the range [0,255]</span> <a name="l00131"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a241fe097fab37493815a9f96e7d36508">00131</a> <span class="comment"></span> <span class="keyword">inline</span> uint8_t <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a241fe097fab37493815a9f96e7d36508" title="Color components in the range [0,255].">getColorA_u8</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_color.A; } <span class="comment">//!< Color components in the range [0,255]</span> <a name="l00132"></a>00132 <span class="comment"></span> <a name="l00133"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac2d4d9059afa28d17072bd5d76e60cb2">00133</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac2d4d9059afa28d17072bd5d76e60cb2" title="Color components in the range [0,1].">setColorR</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> r) {<span class="keywordflow">return</span> setColorR_u8(static_cast<uint8_t>(255*r));} <span class="comment">//!<Color components in the range [0,1] \return a ref to this</span> <a name="l00134"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a3df6303cd71abdefb2889ec9a310fbea">00134</a> <span class="comment"></span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a3df6303cd71abdefb2889ec9a310fbea" title="Color components in the range [0,1].">setColorG</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> g) {<span class="keywordflow">return</span> setColorG_u8(static_cast<uint8_t>(255*g));} <span class="comment">//!<Color components in the range [0,1] \return a ref to this</span> <a name="l00135"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#abcd5c2ca91d0a18f7188a90f60309b5b">00135</a> <span class="comment"></span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#abcd5c2ca91d0a18f7188a90f60309b5b" title="Color components in the range [0,1].">setColorB</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> b) {<span class="keywordflow">return</span> setColorB_u8(static_cast<uint8_t>(255*b));} <span class="comment">//!<Color components in the range [0,1] \return a ref to this</span> <a name="l00136"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac7db4eaa48259e7d859291fabddf6e22">00136</a> <span class="comment"></span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac7db4eaa48259e7d859291fabddf6e22" title="Color components in the range [0,1].">setColorA</a>(<span class="keyword">const</span> <span class="keywordtype">double</span> a) {<span class="keywordflow">return</span> setColorA_u8(static_cast<uint8_t>(255*a));} <span class="comment">//!<Color components in the range [0,1] \return a ref to this</span> <a name="l00137"></a>00137 <span class="comment"></span> <a name="l00138"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a22a7f5a0a4e00f7a6b4d31c0dc61f2ca">00138</a> <span class="keyword">virtual</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a22a7f5a0a4e00f7a6b4d31c0dc61f2ca" title="Color components in the range [0,255].">setColorR_u8</a>(<span class="keyword">const</span> uint8_t r) {m_color.R=r; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <span class="comment">//!<Color components in the range [0,255] \return a ref to this</span> <a name="l00139"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a1c8867be88ef590c44861c240c07ea5e">00139</a> <span class="comment"></span> <span class="keyword">virtual</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a1c8867be88ef590c44861c240c07ea5e" title="Color components in the range [0,255].">setColorG_u8</a>(<span class="keyword">const</span> uint8_t g) {m_color.G=g; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <span class="comment">//!<Color components in the range [0,255] \return a ref to this</span> <a name="l00140"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#aaaac77a1d54b35c6654ac490bf8a5792">00140</a> <span class="comment"></span> <span class="keyword">virtual</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#aaaac77a1d54b35c6654ac490bf8a5792" title="Color components in the range [0,255].">setColorB_u8</a>(<span class="keyword">const</span> uint8_t b) {m_color.B=b; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <span class="comment">//!<Color components in the range [0,255] \return a ref to this</span> <a name="l00141"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a5a035f3fc59300547e27fe1a27bccf0d">00141</a> <span class="comment"></span> <span class="keyword">virtual</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a5a035f3fc59300547e27fe1a27bccf0d" title="Color components in the range [0,255].">setColorA_u8</a>(<span class="keyword">const</span> uint8_t a) {m_color.A=a; <span class="keywordflow">return</span> *<span class="keyword">this</span>;} <span class="comment">//!<Color components in the range [0,255] \return a ref to this</span> <a name="l00142"></a>00142 <span class="comment"></span> <a name="l00143"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#afd1dd27b9f326d4f73135c461eafa717">00143</a> <span class="keyword">inline</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#afd1dd27b9f326d4f73135c461eafa717" title="Scale to apply to the object, in all three axes (default=1)">setScale</a>(<span class="keywordtype">float</span> s) { m_scale_x=m_scale_y=m_scale_z = s; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <span class="comment">//!< Scale to apply to the object, in all three axes (default=1) \return a ref to this</span> <a name="l00144"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#adb65e73fe36db2b9d5161a2262422735">00144</a> <span class="comment"></span> <span class="keyword">inline</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#adb65e73fe36db2b9d5161a2262422735" title="Scale to apply to the object in each axis (default=1)">setScale</a>(<span class="keywordtype">float</span> sx,<span class="keywordtype">float</span> sy,<span class="keywordtype">float</span> sz) { m_scale_x=sx; m_scale_y=sy; m_scale_z = sz; <span class="keywordflow">return</span> *<span class="keyword">this</span>; } <span class="comment">//!< Scale to apply to the object in each axis (default=1) \return a ref to this</span> <a name="l00145"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a53b902abadee37cbd869f052e7f68af8">00145</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">float</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a53b902abadee37cbd869f052e7f68af8" title="Get the current scaling factor in one axis.">getScaleX</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_scale_x; } <span class="comment">//!< Get the current scaling factor in one axis</span> <a name="l00146"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a381a0e7c4c8e1bd728c0e22d2aa5d34f">00146</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">float</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a381a0e7c4c8e1bd728c0e22d2aa5d34f" title="Get the current scaling factor in one axis.">getScaleY</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_scale_y; } <span class="comment">//!< Get the current scaling factor in one axis</span> <a name="l00147"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ae0c3a93eaa4d2d6e2136beb149013db6">00147</a> <span class="comment"></span> <span class="keyword">inline</span> <span class="keywordtype">float</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ae0c3a93eaa4d2d6e2136beb149013db6" title="Get the current scaling factor in one axis.">getScaleZ</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_scale_z; } <span class="comment">//!< Get the current scaling factor in one axis</span> <a name="l00148"></a>00148 <span class="comment"></span> <a name="l00149"></a>00149 <a name="l00150"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#af49a6cb168418408372434e269d89b52">00150</a> <span class="keyword">inline</span> mrpt<a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html" title="A RGB color - floats in the range [0,1].">::utils::TColorf</a> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#af49a6cb168418408372434e269d89b52" title="Returns the object color property as a TColorf.">getColor</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</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>(m_color); } <span class="comment">//!< Returns the object color property as a TColorf</span> <a name="l00151"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a4586196e85a91b39b2ef4ba07105839f">00151</a> <span class="comment"></span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& setColor( <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> &c) <span class="comment">//!< Changes the default object color \return a ref to this</span> <a name="l00152"></a>00152 <span class="comment"></span> { <a name="l00153"></a>00153 <span class="keywordflow">return</span> setColor_u8(<a class="code" href="structmrpt_1_1utils_1_1_t_color.html" title="A RGB color - 8bit.">mrpt::utils::TColor</a>(c.<a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html#ac1941d15140c3f22cced86c45050aaef">R</a>*255.f,c.<a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html#a49c6f1a9fe53f5d9618f9660fc19d498">G</a>*255.f,c.<a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html#abd3067144a754d3bb08b786d7ce1757f">B</a>*255.f,c.<a class="code" href="structmrpt_1_1utils_1_1_t_colorf.html#a4d07b92468313d471c58e94aa5f898c7">A</a>*255.f)); <a name="l00154"></a>00154 } <a name="l00155"></a>00155 <span class="comment"></span> <a name="l00156"></a>00156 <span class="comment"> /** Set the color components of this object (R,G,B,Alpha, in the range 0-1) \return a ref to this */</span> <a name="l00157"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a227cd19e15ce20a48e503efd280a2f78">00157</a> <span class="keyword">inline</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a227cd19e15ce20a48e503efd280a2f78" title="Set the color components of this object (R,G,B,Alpha, in the range 0-1)">setColor</a>( <span class="keywordtype">double</span> R, <span class="keywordtype">double</span> G, <span class="keywordtype">double</span> B, <span class="keywordtype">double</span> A=1) { <span class="keywordflow">return</span> setColor_u8(R*255,G*255,B*255,A*255); } <a name="l00158"></a>00158 <a name="l00159"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac4d2d5a7aea53506bc4748d0324abf7d">00159</a> <span class="keyword">inline</span> <span class="keyword">const</span> mrpt<a class="code" href="structmrpt_1_1utils_1_1_t_color.html" title="A RGB color - 8bit.">::utils::TColor</a> &<a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#ac4d2d5a7aea53506bc4748d0324abf7d" title="Returns the object color property as a TColor.">getColor_u8</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_color; } <span class="comment">//!< Returns the object color property as a TColor</span> <a name="l00160"></a>00160 <span class="comment"></span> <span class="comment">/*** Changes the default object color \return a ref to this */</span> <a name="l00161"></a>00161 <span class="keyword">virtual</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& setColor_u8( <span class="keyword">const</span> <a class="code" href="structmrpt_1_1utils_1_1_t_color.html" title="A RGB color - 8bit.">mrpt::utils::TColor</a> &c); <a name="l00162"></a>00162 <span class="comment"></span> <a name="l00163"></a>00163 <span class="comment"> /** Set the color components of this object (R,G,B,Alpha, in the range 0-1) \return a ref to this */</span> <a name="l00164"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a9a91576a6cabb53b87ee5bbf352ef388">00164</a> <span class="keyword">inline</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>& <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a9a91576a6cabb53b87ee5bbf352ef388" title="Set the color components of this object (R,G,B,Alpha, in the range 0-1)">setColor_u8</a>( uint8_t R, uint8_t G, uint8_t B, uint8_t A=255) { <span class="keywordflow">return</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#a9a91576a6cabb53b87ee5bbf352ef388" title="Set the color components of this object (R,G,B,Alpha, in the range 0-1)">setColor_u8</a>(<a class="code" href="structmrpt_1_1utils_1_1_t_color.html" title="A RGB color - 8bit.">mrpt::utils::TColor</a>(R,G,B,A)); } <a name="l00165"></a>00165 <span class="comment"></span> <a name="l00166"></a>00166 <span class="comment"> /** @} */</span> <a name="l00167"></a>00167 <a name="l00168"></a>00168 <span class="comment"></span> <a name="l00169"></a>00169 <span class="comment"> /** Default constructor: */</span> <a name="l00170"></a>00170 <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>(); <a name="l00171"></a>00171 <span class="keyword">virtual</span> ~<a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>(); <a name="l00172"></a>00172 <span class="comment"></span> <a name="l00173"></a>00173 <span class="comment"> /** Interface for the stlplus smart pointer class. */</span> <a name="l00174"></a><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html#acb2597d6d93b406501d9f3530eb56adf">00174</a> <span class="keyword">inline</span> <a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a> * clone()<span class="keyword"> const</span> <a name="l00175"></a>00175 <span class="keyword"> </span>{ <a name="l00176"></a>00176 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><a class="code" href="classmrpt_1_1opengl_1_1_c_renderizable.html" title="The base class of 3D objects that can be directly rendered through OpenGL.">CRenderizable</a>*<span class="keyword">></span>( this->duplicate() ); <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <span class="comment"></span> <a name="l00179"></a>00179 <span class="comment"> /** Implements the rendering of 3D objects in each class derived from CRenderizable.</span> <a name="l00180"></a>00180 <span class="comment"> */</span> <a name="l00181"></a>00181 <span class="keyword">virtual</span> <span class="keywordtype">void</span> render() <span class="keyword">const</span> = 0; <a name="l00182"></a>00182 <span class="comment"></span> <a name="l00183"></a>00183 <span class="comment"> /** Simulation of ray-trace, given a pose. Returns true if the ray effectively collisions with the object (returning the distance to the origin of the ray in "dist"), or false in other case. "dist" variable yields undefined behaviour when false is returned</span> <a name="l00184"></a>00184 <span class="comment"> */</span> <a name="l00185"></a>00185 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="group__geometry__grp.html#ga363e00600f9c000dd774e6c721faba7d" title="Fast ray tracing method using polygons' properties.">traceRay</a>(<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">mrpt::poses::CPose3D</a> &o,<span class="keywordtype">double</span> &dist) <span class="keyword">const</span>; <a name="l00186"></a>00186 <a name="l00187"></a>00187 <span class="comment"></span> <a name="l00188"></a>00188 <span class="comment"> /** This method is safe for calling from within ::render() methods \sa renderTextBitmap, mrpt::opengl::gl_utils */</span> <a name="l00189"></a>00189 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a765b951c5dfac68de0300b0884327444" title="This method is safe for calling from within ::render() methods.">renderTextBitmap</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *str, <span class="keywordtype">void</span> *fontStyle ); <a name="l00190"></a>00190 <span class="comment"></span> <a name="l00191"></a>00191 <span class="comment"> /** Return the exact width in pixels for a given string, as will be rendered by renderTextBitmap().</span> <a name="l00192"></a>00192 <span class="comment"> * \sa renderTextBitmap, mrpt::opengl::gl_utils</span> <a name="l00193"></a>00193 <span class="comment"> */</span> <a name="l00194"></a>00194 <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a9eaa1ac5fcd5347d6a34f257a20bb5db" title="Return the exact width in pixels for a given string, as will be rendered by renderTextBitmap().">textBitmapWidth</a>( <a name="l00195"></a>00195 <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &str, <a name="l00196"></a>00196 <a class="code" href="group__mrpt__opengl__grp.html#ga4e54252970d0b0a6dd251335064a2346" title="Existing fonts for 2D texts in mrpt::opengl methods.">mrpt::opengl::TOpenGLFont</a> font = <a class="code" href="group__mrpt__opengl__grp.html#gga4e54252970d0b0a6dd251335064a2346a31ebbbe2889bcca4760b90bba40385b8">mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24</a> ); <a name="l00197"></a>00197 <span class="comment"></span> <a name="l00198"></a>00198 <span class="comment"> /** Render a text message in the current rendering context, creating a glViewport in the way (do not call within ::render() methods)</span> <a name="l00199"></a>00199 <span class="comment"> * - Coordinates (x,y) are 2D pixels, starting at bottom-left of the viewport. Negative numbers will wrap to the opposite side of the viewport (e.g. x=-10 means 10px fromt the right).</span> <a name="l00200"></a>00200 <span class="comment"> * - The text color is defined by (color_r,color_g,color_b), each float numbers in the range [0,1].</span> <a name="l00201"></a>00201 <span class="comment"> * \sa renderTextBitmap, textBitmapWidth, mrpt::opengl::gl_utils</span> <a name="l00202"></a>00202 <span class="comment"> */</span> <a name="l00203"></a>00203 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a765b951c5dfac68de0300b0884327444" title="This method is safe for calling from within ::render() methods.">renderTextBitmap</a>( <a name="l00204"></a>00204 <span class="keywordtype">int</span> screen_x, <a name="l00205"></a>00205 <span class="keywordtype">int</span> screen_y, <a name="l00206"></a>00206 <span class="keyword">const</span> <a class="code" href="classstd_1_1string.html" title="STL class.">std::string</a> &str, <a name="l00207"></a>00207 <span class="keywordtype">float</span> color_r=1, <a name="l00208"></a>00208 <span class="keywordtype">float</span> color_g=1, <a name="l00209"></a>00209 <span class="keywordtype">float</span> color_b=1, <a name="l00210"></a>00210 <a class="code" href="group__mrpt__opengl__grp.html#ga4e54252970d0b0a6dd251335064a2346" title="Existing fonts for 2D texts in mrpt::opengl methods.">mrpt::opengl::TOpenGLFont</a> font = <a class="code" href="group__mrpt__opengl__grp.html#gga4e54252970d0b0a6dd251335064a2346a31ebbbe2889bcca4760b90bba40385b8">mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24</a> <a name="l00211"></a>00211 ); <a name="l00212"></a>00212 <a name="l00213"></a>00213 <span class="keyword">protected</span>:<span class="comment"></span> <a name="l00214"></a>00214 <span class="comment"> /** Checks glGetError and throws an exception if an error situation is found */</span> <a name="l00215"></a>00215 <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a364a7dbde49db4815f8b930d4114871a" title="Checks glGetError and throws an exception if an error situation is found.">checkOpenGLError</a>(); <a name="l00216"></a>00216 <a name="l00217"></a>00217 <span class="keywordtype">void</span> writeToStreamRender(<a class="code" href="classmrpt_1_1utils_1_1_c_stream.html" title="This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...">utils::CStream</a> &out) <span class="keyword">const</span>; <a name="l00218"></a>00218 <span class="keywordtype">void</span> readFromStreamRender(<a class="code" href="classmrpt_1_1utils_1_1_c_stream.html" title="This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...">utils::CStream</a> &in); <a name="l00219"></a>00219 <span class="comment"></span> <a name="l00220"></a>00220 <span class="comment"> /** Returns the lowest next free texture name (avoid using OpenGL's own function since we may call them from different threads and seem it's not cool). */</span> <a name="l00221"></a>00221 <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> getNewTextureNumber(); <a name="l00222"></a>00222 <span class="keyword">static</span> <span class="keywordtype">void</span> releaseTextureName(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i); <a name="l00223"></a>00223 <a name="l00224"></a>00224 };<span class="comment"></span> <a name="l00225"></a>00225 <span class="comment"> /**</span> <a name="l00226"></a>00226 <span class="comment"> * Applies a CPose3D transformation to the object. Note that this method doesn't <i>set</i> the pose to the given value, but <i>combines</i> it with the existing one.</span> <a name="l00227"></a>00227 <span class="comment"> * \sa setPose</span> <a name="l00228"></a>00228 <span class="comment"> */</span> <a name="l00229"></a>00229 <a class="code" href="opengl_2include_2mrpt_2opengl_2link__pragmas_8h.html#af6a1c8d5d6b3c8c0af00dbeef88ce269">OPENGL_IMPEXP</a> CRenderizablePtr & <a class="code" href="namespacemrpt_1_1opengl.html#a12e49154ca3af8dcb06d847404a0d4ea" title="Inserts an openGL object into a scene.">operator<<</a>(CRenderizablePtr &r,<span class="keyword">const</span> <a class="code" href="classmrpt_1_1poses_1_1_c_pose3_d.html" title="A class used to store a 3D pose (a 3D translation + a rotation in 3D).">mrpt::poses::CPose3D</a> &p); <a name="l00230"></a>00230 <a name="l00231"></a>00231 } <span class="comment">// end namespace</span> <a name="l00232"></a>00232 <a name="l00233"></a>00233 } <span class="comment">// End of namespace</span> <a name="l00234"></a>00234 <a name="l00235"></a>00235 <span class="comment">// This header goes here so there we can use "CRenderizablePtr"</span> <a name="l00236"></a>00236 <span class="preprocessor">#include <<a class="code" href="gl__utils_8h.html">mrpt/opengl/gl_utils.h</a>></span> <a name="l00237"></a>00237 <a name="l00238"></a>00238 <a name="l00239"></a>00239 <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.5</a> for MRPT 0.9.5 SVN: at Sun Sep 25 17:20:18 UTC 2011</td><td></td> <td width="100"> </td> <td width="150"> </td></tr> </table> </body></html>