A viewport within a COpenGLScene, containing a set of OpenGL objects to render. More...
#include <mrpt/opengl/COpenGLViewport.h>
Public Member Functions | |
void | setCloneView (const std::string &clonedViewport) |
Set this view as a clone of some other viewport, given its name - as a side effect, current list of internal OpenGL objects is cleared. | |
void | resetCloneView () |
Reset the viewport to normal mode: rendering its own objects. | |
void | setCloneCamera (bool enable) |
If set to true, and setCloneView() has been called, this viewport will be rendered using the camera of the cloned viewport. | |
void | clear () |
Delete all internal obejcts. | |
void | insert (const CRenderizablePtr &newObject) |
Insert a new object into the list. | |
std::string | getName () |
Returns the name of the viewport. | |
void | setViewportPosition (const double &x, const double &y, const double &width, const double &height) |
Change the viewport position and dimension on the rendering window. | |
void | getViewportPosition (double &x, double &y, double &width, double &height) |
Get the current viewport position and dimension on the rendering window. | |
void | setBorderSize (unsigned int lineWidth) |
Set the border size ("frame") of the viewport (default=0). | |
bool | isTransparent () |
Return whether the viewport will be rendered transparent over previous viewports. | |
void | setTransparent (bool trans) |
Set the transparency, that is, whether the viewport will be rendered transparent over previous viewports (default=false). | |
virtual | ~COpenGLViewport () |
Destructor: clears all objects. | |
CRenderizablePtr | getByName (const std::string &str) |
Returns the first object with a given name, or NULL if not found. | |
template<typename T > | |
T::SmartPtr | getByClass (const size_t &ith=0) const |
Returns the i'th object of a given class (or of a descendant class), or NULL (an empty smart pointer) if not found. | |
void | removeObject (const CRenderizablePtr &obj) |
Removes the given object from the scene (it also deletes the object to free its memory). | |
size_t | size () const |
Number of objects contained. | |
opengl::CCamera & | getCamera () |
Get a reference to the camera associated with this viewport. | |
const opengl::CCamera & | getCamera () const |
Get a reference to the camera associated with this viewport. | |
Protected Member Functions | |
COpenGLViewport (COpenGLScene *parent=NULL, const std::string &name=std::string("")) | |
Constructor, invoked from COpenGLScene only. | |
void | initializeAllTextures () |
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL). | |
void | dumpListOfObjects (utils::CStringList &lst) |
Retrieves a list of all objects in text form. | |
void | render (const int &render_width, const int &render_height) const |
Render the objects in this viewport (called from COpenGLScene only). | |
Protected Attributes | |
opengl::CCamera | m_camera |
The camera associated to the viewport. | |
utils::safe_ptr< COpenGLScene > | m_parent |
The scene that contains this viewport. | |
bool | m_isCloned |
Set by setCloneView. | |
bool | m_isClonedCamera |
Set by setCloneCamera. | |
std::string | m_clonedViewport |
Only if m_isCloned=true. | |
std::string | m_name |
The viewport's name. | |
bool | m_isTransparent |
Whether to clear color buffer. | |
uint32_t | m_borderWidth |
Default=0, the border around the viewport. | |
double | m_view_x |
double | m_view_y |
double | m_view_width |
double | m_view_height |
The viewport position [0,1]. | |
opengl::CListOpenGLObjects | m_objects |
The list of objects that comprise the 3D scene. | |
Friends | |
class | COpenGLScene |
A viewport within a COpenGLScene, containing a set of OpenGL objects to render.
This class has protected constuctor, thus it cannot be created by users. Use COpenGLScene::createViewport instead. Refer to opengl::COpenGLScene for further details.
Definition at line 54 of file COpenGLViewport.h.
virtual mrpt::opengl::COpenGLViewport::~COpenGLViewport | ( | ) | [virtual] |
Destructor: clears all objects.
mrpt::opengl::COpenGLViewport::COpenGLViewport | ( | COpenGLScene * | parent = NULL , |
|
const std::string & | name = std::string("") | |||
) | [protected] |
Constructor, invoked from COpenGLScene only.
void mrpt::opengl::COpenGLViewport::clear | ( | ) |
Delete all internal obejcts.
void mrpt::opengl::COpenGLViewport::dumpListOfObjects | ( | utils::CStringList & | lst | ) | [protected] |
Retrieves a list of all objects in text form.
T::SmartPtr mrpt::opengl::COpenGLViewport::getByClass | ( | const size_t & | ith = 0 |
) | const [inline] |
Returns the i'th object of a given class (or of a descendant class), or NULL (an empty smart pointer) if not found.
Example:
CSpherePtr obs = view.getByClass<CSphere>();
By default (ith=0), the first observation is returned.
Definition at line 139 of file COpenGLViewport.h.
References CLASS_ID_NAMESPACE, MRPT_TRY_END, and MRPT_TRY_START.
CRenderizablePtr mrpt::opengl::COpenGLViewport::getByName | ( | const std::string & | str | ) |
Returns the first object with a given name, or NULL if not found.
const opengl::CCamera& mrpt::opengl::COpenGLViewport::getCamera | ( | ) | const [inline] |
Get a reference to the camera associated with this viewport.
Definition at line 173 of file COpenGLViewport.h.
opengl::CCamera& mrpt::opengl::COpenGLViewport::getCamera | ( | ) | [inline] |
Get a reference to the camera associated with this viewport.
Definition at line 171 of file COpenGLViewport.h.
std::string mrpt::opengl::COpenGLViewport::getName | ( | ) | [inline] |
Returns the name of the viewport.
Definition at line 87 of file COpenGLViewport.h.
void mrpt::opengl::COpenGLViewport::getViewportPosition | ( | double & | x, | |
double & | y, | |||
double & | width, | |||
double & | height | |||
) |
Get the current viewport position and dimension on the rendering window.
Coordinates here are alwasys in the range [0,1], relative to the actual window sizes (i.e. width=1 means the entire width of the rendering window).
void mrpt::opengl::COpenGLViewport::initializeAllTextures | ( | ) | [protected] |
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL).
void mrpt::opengl::COpenGLViewport::insert | ( | const CRenderizablePtr & | newObject | ) |
Insert a new object into the list.
The object MUST NOT be deleted, it will be deleted automatically by this object when not required anymore.
bool mrpt::opengl::COpenGLViewport::isTransparent | ( | ) | [inline] |
Return whether the viewport will be rendered transparent over previous viewports.
Definition at line 119 of file COpenGLViewport.h.
void mrpt::opengl::COpenGLViewport::removeObject | ( | const CRenderizablePtr & | obj | ) |
Removes the given object from the scene (it also deletes the object to free its memory).
void mrpt::opengl::COpenGLViewport::render | ( | const int & | render_width, | |
const int & | render_height | |||
) | const [protected] |
Render the objects in this viewport (called from COpenGLScene only).
void mrpt::opengl::COpenGLViewport::resetCloneView | ( | ) | [inline] |
Reset the viewport to normal mode: rendering its own objects.
Definition at line 69 of file COpenGLViewport.h.
void mrpt::opengl::COpenGLViewport::setBorderSize | ( | unsigned int | lineWidth | ) | [inline] |
Set the border size ("frame") of the viewport (default=0).
Definition at line 115 of file COpenGLViewport.h.
void mrpt::opengl::COpenGLViewport::setCloneCamera | ( | bool | enable | ) | [inline] |
If set to true, and setCloneView() has been called, this viewport will be rendered using the camera of the cloned viewport.
Definition at line 73 of file COpenGLViewport.h.
void mrpt::opengl::COpenGLViewport::setCloneView | ( | const std::string & | clonedViewport | ) |
Set this view as a clone of some other viewport, given its name - as a side effect, current list of internal OpenGL objects is cleared.
By default, only the objects are cloned, not the camera. See
void mrpt::opengl::COpenGLViewport::setTransparent | ( | bool | trans | ) | [inline] |
Set the transparency, that is, whether the viewport will be rendered transparent over previous viewports (default=false).
Definition at line 123 of file COpenGLViewport.h.
void mrpt::opengl::COpenGLViewport::setViewportPosition | ( | const double & | x, | |
const double & | y, | |||
const double & | width, | |||
const double & | height | |||
) |
Change the viewport position and dimension on the rendering window.
Coordinates here are alwasys in the range [0,1], relative to the actual window sizes (i.e. width=1 means the entire width of the rendering window).
size_t mrpt::opengl::COpenGLViewport::size | ( | ) | const [inline] |
Number of objects contained.
Definition at line 169 of file COpenGLViewport.h.
friend class COpenGLScene [friend] |
Definition at line 58 of file COpenGLViewport.h.
uint32_t mrpt::opengl::COpenGLViewport::m_borderWidth [protected] |
Default=0, the border around the viewport.
Definition at line 204 of file COpenGLViewport.h.
The camera associated to the viewport.
Definition at line 192 of file COpenGLViewport.h.
std::string mrpt::opengl::COpenGLViewport::m_clonedViewport [protected] |
Only if m_isCloned=true.
Definition at line 198 of file COpenGLViewport.h.
bool mrpt::opengl::COpenGLViewport::m_isCloned [protected] |
Set by setCloneView.
Definition at line 196 of file COpenGLViewport.h.
bool mrpt::opengl::COpenGLViewport::m_isClonedCamera [protected] |
Set by setCloneCamera.
Definition at line 197 of file COpenGLViewport.h.
bool mrpt::opengl::COpenGLViewport::m_isTransparent [protected] |
Whether to clear color buffer.
Definition at line 202 of file COpenGLViewport.h.
std::string mrpt::opengl::COpenGLViewport::m_name [protected] |
The viewport's name.
Definition at line 200 of file COpenGLViewport.h.
The list of objects that comprise the 3D scene.
Objects are automatically deleted when calling "clear" or in the destructor.
Definition at line 211 of file COpenGLViewport.h.
The scene that contains this viewport.
Definition at line 194 of file COpenGLViewport.h.
double mrpt::opengl::COpenGLViewport::m_view_height [protected] |
The viewport position [0,1].
Definition at line 206 of file COpenGLViewport.h.
double mrpt::opengl::COpenGLViewport::m_view_width [protected] |
Definition at line 206 of file COpenGLViewport.h.
double mrpt::opengl::COpenGLViewport::m_view_x [protected] |
Definition at line 206 of file COpenGLViewport.h.
double mrpt::opengl::COpenGLViewport::m_view_y [protected] |
Definition at line 206 of file COpenGLViewport.h.
Page generated by Doxygen 1.6.1 for MRPT 0.7.1 SVN: at Tue Dec 22 08:29:35 CET 2009 |