Go to the documentation of this file.
174 const double x,
const double y,
const double width,
244 const double x_coord,
const double y_coord,
289 template <
typename T>
293 size_t foundCount = 0;
294 const auto* class_ID = &T::GetRuntimeClassIdStatic();
296 if (o && o->GetRuntimeClass()->derivedFrom(class_ID))
297 if (foundCount++ == ith)
return std::dynamic_pointer_cast<T>(o);
303 o->GetRuntimeClass() ==
306 typename T::Ptr
obj = std::dynamic_pointer_cast<T>(
307 std::dynamic_pointer_cast<CSetOfObjects>(o)
308 ->
template getByClass<T>(ith));
312 return typename T::Ptr();
356 void render(
const int render_width,
const int render_height)
const;
The basic event type for the observer-observable pattern in MRPT.
const CLight & getLight(const size_t i) const
size_t size() const
Number of objects contained.
void do_nothing() override
Just to allow this class to be polymorphic.
bool m_isImageView
Set by setImageView.
mrpt::math::TPoint3D eye
The camera is here.
void setImageView(const mrpt::img::CImage &img)
Set this viewport into "image view"-mode, where an image is efficiently drawn (fitting the viewport a...
const Scalar * const_iterator
std::vector< CLight > m_lights
mrpt::safe_ptr< COpenGLScene > m_parent
The scene that contains this viewport.
std::string m_name
The viewport's name.
void getCurrentCameraPose(mrpt::poses::CPose3D &out_cameraPose) const
Compute the current 3D camera pose.
CListOpenGLObjects::iterator iterator
bool isPolygonNicestEnabled() const
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives.
void addLight(const CLight &l)
Append a new light to the scene.
void setNormalMode()
Resets the viewport to a normal 3D viewport.
void setBorderSize(unsigned int lineWidth)
Set the border size ("frame") of the viewport (default=0).
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
An event sent by an mrpt::opengl::COpenGLViewport after calling the scene OpenGL drawing primitives a...
opengl::CCamera m_camera
The camera associated to the viewport.
uint32_t m_borderWidth
Default=0, the border around the viewport.
bool m_custom_backgb_color
mrpt::img::TColorf m_background_color
used only if m_custom_backgb_color
GLsizei GLsizei GLuint * obj
double m_view_x
The viewport position [0,1].
const_iterator end() const
CLight & getLight(const size_t i)
void setImageView_fast(mrpt::img::CImage &img)
Just like setImageView but moves the internal image memory instead of making a copy,...
double m_clip_min
The min/max clip depth distances (default: 0.1 - 10000)
void getViewportClipDistances(double &clip_min, double &clip_max) const
Get the current min/max clip depth distances of the rendering frustum (default: 0....
std::shared_ptr< CRenderizable > Ptr
mrpt::img::TColorf getCustomBackgroundColor() const
Each of the possible lights of a 3D scene.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void insert(const CRenderizable::Ptr &newObject)
Insert a new object into the list.
void clear()
Delete all internal obejcts.
void render(const int render_width, const int render_height) const
Render the objects in this viewport (called from COpenGLScene only)
void dumpListOfObjects(std::vector< std::string > &lst)
Retrieves a list of all objects in text form.
opengl::CCamera & getCamera()
Get a reference to the camera associated with this viewport.
void initializeAllTextures()
Initializes all textures in the scene (See opengl::CTexturedPlane::loadTextureInOpenGL)
GLuint const GLchar * name
void lightsClearAll()
Removes all lights (and disables the global "GL_LIGHTING")
void internal_setImageView_fast(const mrpt::img::CImage &img, bool is_fast)
mrptEventGLPostRender(const COpenGLViewport *obj)
bool m_isCloned
Set by setCloneView.
GLdouble GLdouble GLdouble r
void getViewportPosition(double &x, double &y, double &width, double &height)
Get the current viewport position and dimension on the rendering window.
void do_nothing() override
Just to allow this class to be polymorphic.
mrpt::math::TPoint3D pointing
The camera points to here.
TLastProjectiveMatrixInfo m_lastProjMat
Info updated with each "render()" and used in "get3DRayForPixelCoord".
#define ASSERT_BELOW_(__A, __B)
A set of object, which are referenced to the coordinates framework established in this object.
An event sent by an mrpt::opengl::COpenGLViewport just after clearing the viewport and setting the GL...
void setCustomBackgroundColor(const mrpt::img::TColorf &color)
Set a background color different from that of the parent GUI window.
const COpenGLViewport *const source_viewport
size_t viewport_width
In pixels.
void setTransparent(bool trans)
Set the transparency, that is, whether the viewport will be rendered transparent over previous viewpo...
opengl::CListOpenGLObjects m_objects
The list of objects that comprise the 3D scene.
mrpt::math::TPoint3D up
Up vector of the camera.
TLastProjectiveMatrixInfo()
void resetCloneView()
Reset the viewport to normal mode: rendering its own objects.
void setViewportClipDistances(const double clip_min, const double clip_max)
Set the min/max clip depth distances of the rendering frustum (default: 0.1 - 10000)
CRenderizable::Ptr getByName(const std::string &str)
Returns the first object with a given name, or nullptr if not found.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
std::string getName()
Returns the name of the viewport.
A RGB color - floats in the range [0,1].
mrptEventGLPreRender(const COpenGLViewport *obj)
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
#define CLASS_ID_NAMESPACE(class_name, namespaceName)
The virtual base class which provides a unified interface for all persistent objects in MRPT.
const_iterator begin() const
GLenum GLsizei GLsizei height
mrpt::img::CImage::Ptr m_imageview_img
The image to display, after calling setImageView()
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 enablePolygonNicest(bool enable=true)
Sets glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST) is enabled, or GL_FASTEST otherwise.
A class for storing images as grayscale or RGB bitmaps.
virtual ~COpenGLViewport()
Destructor: clears all objects.
mrpt::serialization::CArchive & operator<<(mrpt::serialization::CArchive &out, const mrpt::opengl::CLight &o)
std::string m_clonedViewport
Only if m_isCloned=true.
bool m_isClonedCamera
Set by setCloneCamera.
bool m_isTransparent
Whether to clear color buffer.
float azimuth
Camera elev & azimuth, in radians.
const COpenGLViewport *const source_viewport
std::shared_ptr< CImage > Ptr
COpenGLViewport(COpenGLScene *parent=nullptr, const std::string &name=std::string(""))
Constructor, invoked from COpenGLScene only.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
CListOpenGLObjects::const_iterator const_iterator
std::deque< CRenderizable::Ptr > CListOpenGLObjects
A list of objects pointers, automatically managing memory free at destructor, and managing copies cor...
bool m_OpenGL_enablePolygonNicest
A viewport within a COpenGLScene, containing a set of OpenGL objects to render.
void setCloneCamera(bool enable)
If set to true, and setCloneView() has been called, this viewport will be rendered using the camera o...
3D line, represented by a base point and a director vector.
GLsizei const GLchar ** string
void setCloneView(const std::string &clonedViewport)
Set this viewport as a clone of some other viewport, given its name - as a side effect,...
T::Ptr getByClass(const size_t &ith=0) const
Returns the i'th object of a given class (or of a descendant class), or nullptr (an empty smart point...
The namespace for 3D scene representation and rendering.
void get3DRayForPixelCoord(const double x_coord, const double y_coord, mrpt::math::TLine3D &out_ray, mrpt::poses::CPose3D *out_cameraPose=nullptr) const
Compute the 3D ray corresponding to a given pixel; this can be used to allow the user to pick and sel...
std::shared_ptr< COpenGLViewport > Ptr
bool isTransparent()
Return whether the viewport will be rendered transparent over previous viewports.
const opengl::CCamera & getCamera() const
Get a reference to the camera associated with this viewport.
Inherit from this class for those objects capable of being observed by a CObserver class.
unsigned __int32 uint32_t
A wrapper class for pointers that can be safely copied with "=" operator without problems.
void removeObject(const CRenderizable::Ptr &obj)
Removes the given object from the scene (it also deletes the object to free its memory).
void setNumberOfLights(const size_t N)
Allocates a number of lights, which must be correctly defined via getLight(i), etc.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |