Go to the documentation of this file.
9 #ifndef opengl_CRenderizable_H
10 #define opengl_CRenderizable_H
25 class COpenGLViewport;
54 mrpt::utils::TColor m_color;
55 mrpt::poses::CPose3D m_pose;
56 float m_scale_x, m_scale_y, m_scale_z;
63 void setName(const std::
string &n) { m_name=n; }
64 const std::string &getName()
const {
return m_name; }
69 inline void enableShowName(
bool showName=
true) { m_show_name=showName; }
70 inline bool isShowNameEnabled()
const {
return m_show_name; }
87 inline double getPoseX()
const {
return m_pose.x(); }
88 inline double getPoseY()
const {
return m_pose.y(); }
89 inline double getPoseZ()
const {
return m_pose.z(); }
93 inline double getPoseYawRad()
const {
return m_pose.yaw(); }
94 inline double getPosePitchRad()
const {
return m_pose.pitch(); }
95 inline double getPoseRollRad()
const {
return m_pose.roll(); }
97 inline double getColorR()
const {
return m_color.R/255.; }
98 inline double getColorG()
const {
return m_color.G/255.; }
99 inline double getColorB()
const {
return m_color.B/255.; }
100 inline double getColorA()
const {
return m_color.A/255.; }
102 inline uint8_t getColorR_u8()
const {
return m_color.R; }
103 inline uint8_t getColorG_u8()
const {
return m_color.G; }
104 inline uint8_t getColorB_u8()
const {
return m_color.B; }
105 inline uint8_t getColorA_u8()
const {
return m_color.A; }
107 CRenderizable& setColorR(
const double r) {
return setColorR_u8(
static_cast<uint8_t
>(255*r));}
108 CRenderizable& setColorG(
const double g) {
return setColorG_u8(
static_cast<uint8_t
>(255*g));}
109 CRenderizable& setColorB(
const double b) {
return setColorB_u8(
static_cast<uint8_t
>(255*b));}
110 CRenderizable& setColorA(
const double a) {
return setColorA_u8(
static_cast<uint8_t
>(255*a));}
112 virtual CRenderizable& setColorR_u8(
const uint8_t r) {m_color.R=r;
return *
this;}
113 virtual CRenderizable& setColorG_u8(
const uint8_t g) {m_color.G=g;
return *
this;}
114 virtual CRenderizable& setColorB_u8(
const uint8_t b) {m_color.B=b;
return *
this;}
115 virtual CRenderizable& setColorA_u8(
const uint8_t a) {m_color.A=a;
return *
this;}
117 inline CRenderizable& setScale(
float s) { m_scale_x=m_scale_y=m_scale_z = s;
return *
this; }
118 inline CRenderizable& setScale(
float sx,
float sy,
float sz) { m_scale_x=sx; m_scale_y=sy; m_scale_z = sz;
return *
this; }
119 inline float getScaleX()
const {
return m_scale_x; }
120 inline float getScaleY()
const {
return m_scale_y; }
121 inline float getScaleZ()
const {
return m_scale_z; }
131 inline CRenderizable&
setColor(
double R,
double G,
double B,
double A=1) {
return setColor_u8(R*255,G*255,B*255,A*255); }
155 virtual void render()
const = 0;
169 const std::string &str,
180 const std::string &str,
198 static unsigned int getNewTextureNumber();
199 static void releaseTextureName(
unsigned int i);
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
CRenderizable & setColor_u8(uint8_t R, uint8_t G, uint8_t B, uint8_t A=255)
Set the color components of this object (R,G,B,Alpha, in the range 0-1)
The base class of 3D objects that can be directly rendered through OpenGL.
double z
X,Y,Z coordinates.
CRenderizable * clone() const
Interface for the stlplus smart pointer class.
CRenderizable & setLocation(const mrpt::math::TPoint3D &p)
Changes the location of the object, keeping untouched the orientation.
std::deque< CRenderizablePtr > CListOpenGLObjects
A list of objects pointers, automatically managing memory free at destructor, and managing copies cor...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CRenderizable & setColor(const mrpt::utils::TColorf &c)
CRenderizable & setLocation(double x, double y, double z)
Changes the location of the object, keeping untouched the orientation.
void OPENGL_IMPEXP checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
A set of object, which are referenced to the coordinates framework established in this object.
void OPENGL_IMPEXP renderTextBitmap(const char *str, void *fontStyle)
This method is safe for calling from within ::render() methods.
const mrpt::poses::CPose3D & getPoseRef() const
Returns a const ref to the 3D pose of the object as mrpt::poses::CPose3D (which explicitly contains t...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
CRenderizable & setColor(double R, double G, double B, double A=1)
Set the color components of this object (R,G,B,Alpha, in the range 0-1)
void setVisibility(bool visible=true)
Set object visibility (default=true)
int OPENGL_IMPEXP textBitmapWidth(const std::string &str, mrpt::opengl::TOpenGLFont font=mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24)
Return the exact width in pixels for a given string, as will be rendered by renderTextBitmap().
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
The virtual base class which provides a unified interface for all persistent objects in MRPT.
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
A RGB color - floats in the range [0,1].
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A viewport within a COpenGLScene, containing a set of OpenGL objects to render.
double RAD2DEG(const double x)
Radians to degrees.
bool BASE_IMPEXP traceRay(const vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
A class used to store a 2D point.
A class used to store a 3D point.
bool isVisible() const
Is the object visible?
@ MRPT_GLUT_BITMAP_TIMES_ROMAN_24
Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Sat Jan 18 22:37:07 UTC 2020 | | |