The base class of 3D objects that can be directly rendered through OpenGL.
In this class there are a set of common properties to all 3D objects, mainly:
Definition at line 60 of file CRenderizable.h.
#include <mrpt/opengl/CRenderizable.h>
Classes | |
struct | TRenderInfo |
Information about the rendering process being issued. More... | |
Public Member Functions | |
CRenderizable () | |
Default constructor: | |
virtual | ~CRenderizable () |
CRenderizable * | clone () const |
Interface for the stlplus smart pointer class. | |
virtual void | render () const =0 |
Implements the rendering of 3D objects in each class derived from CRenderizable. | |
virtual bool | traceRay (const mrpt::poses::CPose3D &o, double &dist) const |
Simulation of ray-trace, given a pose. | |
Changes the appearance of the object to render | |
void | setName (const std::string &n) |
Changes the name of the object. | |
std::string | getName () const |
Returns the name of the object. | |
bool | isVisible () const |
Is the object visible? | |
void | setVisibility (bool visible=true) |
Set object visibility (default=true) | |
void | enableShowName (bool showName=true) |
Enables or disables showing the name of the object as a label when rendering. | |
CRenderizable & | setPose (const mrpt::poses::CPose3D &o) |
Set the 3D pose from a mrpt::poses::CPose3D object (return a ref to this) | |
CRenderizable & | setPose (const mrpt::math::TPose3D &o) |
Set the 3D pose from a mrpt::math::TPose3D object (return a ref to this) | |
CRenderizable & | setPose (const mrpt::poses::CPoint3D &o) |
Set the 3D pose from a mrpt::poses::CPose3D object (return a ref to this) | |
CRenderizable & | setPose (const mrpt::poses::CPoint2D &o) |
Set the 3D pose from a mrpt::poses::CPose3D object (return a ref to this) | |
mrpt::math::TPose3D | getPose () const |
Returns the 3D pose of the object. | |
CRenderizable & | setLocation (double x, double y, double z) |
Changes the location of the object, keeping untouched the orientation. | |
CRenderizable & | setLocation (const mrpt::math::TPoint3D &p) |
Changes the location of the object, keeping untouched the orientation. | |
double | getPoseX () const |
Translation relative to parent coordinate origin. | |
double | getPoseY () const |
Translation relative to parent coordinate origin. | |
double | getPoseZ () const |
Translation relative to parent coordinate origin. | |
double | getPoseYaw () const |
Rotation relative to parent coordinate origin, in **DEGREES**. | |
double | getPosePitch () const |
Rotation relative to parent coordinate origin, in **DEGREES**. | |
double | getPoseRoll () const |
Rotation relative to parent coordinate origin, in **DEGREES**. | |
double | getColorR () const |
Color components in the range [0,1]. | |
double | getColorG () const |
Color components in the range [0,1]. | |
double | getColorB () const |
Color components in the range [0,1]. | |
double | getColorA () const |
Color components in the range [0,1]. | |
virtual CRenderizable & | setColorR (const double r) |
Color components in the range [0,1]. | |
virtual CRenderizable & | setColorG (const double g) |
Color components in the range [0,1]. | |
virtual CRenderizable & | setColorB (const double b) |
Color components in the range [0,1]. | |
virtual CRenderizable & | setColorA (const double a) |
Color components in the range [0,1]. | |
CRenderizable & | setScale (float s) |
Scale to apply to the object, in all three axes (default=1) | |
CRenderizable & | setScale (float sx, float sy, float sz) |
Scale to apply to the object in each axis (default=1) | |
float | getScaleX () const |
Get the current scaling factor in one axis. | |
float | getScaleY () const |
Get the current scaling factor in one axis. | |
float | getScaleZ () const |
Get the current scaling factor in one axis. | |
mrpt::utils::TColorf | getColor () const |
Returns the object color property as a TColorf. | |
virtual CRenderizable & | setColor (const mrpt::utils::TColorf &c) |
Changes the default object color. | |
virtual 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) | |
Static Public Member Functions | |
static void | renderTextBitmap (const char *str, void *fontStyle) |
Protected Member Functions | |
void | writeToStreamRender (utils::CStream &out) const |
void | readFromStreamRender (utils::CStream &in) |
void | getCurrentRenderingInfo (TRenderInfo &ri) const |
Gather useful information on the render parameters. | |
Static Protected Member Functions | |
static void | checkOpenGLError () |
Checks glGetError and throws an exception if an error situation is found. | |
static void | renderTriangleWithNormal (const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p3) |
Can be used by derived classes to draw a triangle with a normal vector computed automatically - to be called within a glBegin()-glEnd() block. | |
static unsigned int | getNewTextureNumber () |
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). | |
static void | releaseTextureName (unsigned int i) |
Protected Attributes | |
std::string | m_name |
bool | m_show_name |
double | m_color_R |
double | m_color_G |
double | m_color_B |
double | m_color_A |
Color components in the range [0,1]. | |
double | m_x |
double | m_y |
double | m_z |
Translation relative to parent coordinate origin. | |
double | m_yaw |
double | m_pitch |
double | m_roll |
Rotation relative to parent coordinate origin, in **DEGREES**. | |
float | m_scale_x |
float | m_scale_y |
float | m_scale_z |
Scale components to apply to the object (default=1) | |
bool | m_visible |
Is the object visible? (default=true) | |
Friends | |
class | mrpt::opengl::COpenGLViewport |
class | mrpt::opengl::CSetOfObjects |
RTTI stuff | |
static const mrpt::utils::TRuntimeClassId | classCRenderizable |
class | mrpt::utils::CStream |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const |
Returns information about the class of an object in runtime. |
mrpt::opengl::CRenderizable::CRenderizable | ( | ) |
Default constructor:
virtual mrpt::opengl::CRenderizable::~CRenderizable | ( | ) | [virtual] |
static const mrpt::utils::TRuntimeClassId* mrpt::opengl::CRenderizable::_GetBaseClass | ( | ) | [static, protected] |
Reimplemented from mrpt::utils::CSerializable.
Reimplemented in mrpt::opengl::CAngularObservationMesh, mrpt::opengl::CPlanarLaserScan, mrpt::opengl::C3DSScene, mrpt::opengl::CArrow, mrpt::opengl::CAxis, mrpt::opengl::CBox, mrpt::opengl::CCamera, mrpt::opengl::CCylinder, mrpt::opengl::CDisk, mrpt::opengl::CEllipsoid, mrpt::opengl::CGeneralizedCylinder, mrpt::opengl::CGridPlaneXY, mrpt::opengl::CGridPlaneXZ, mrpt::opengl::CMesh, mrpt::opengl::COpenGLStandardObject, mrpt::opengl::CPointCloud, mrpt::opengl::CPointCloudColoured, mrpt::opengl::CPolyhedron, mrpt::opengl::CRenderizableDisplayList, mrpt::opengl::CSetOfLines, mrpt::opengl::CSetOfObjects, mrpt::opengl::CSetOfTexturedTriangles, mrpt::opengl::CSetOfTriangles, mrpt::opengl::CSimpleLine, mrpt::opengl::CSphere, mrpt::opengl::CText, mrpt::opengl::CTexturedObject, and mrpt::opengl::CTexturedPlane.
static void mrpt::opengl::CRenderizable::checkOpenGLError | ( | ) | [static, protected] |
Checks glGetError and throws an exception if an error situation is found.
CRenderizable* mrpt::opengl::CRenderizable::clone | ( | ) | const [inline] |
Interface for the stlplus smart pointer class.
Reimplemented from mrpt::utils::CObject.
Reimplemented in mrpt::opengl::CRenderizableDisplayList.
Definition at line 139 of file CRenderizable.h.
void mrpt::opengl::CRenderizable::enableShowName | ( | bool | showName = true | ) | [inline] |
Enables or disables showing the name of the object as a label when rendering.
Definition at line 86 of file CRenderizable.h.
mrpt::utils::TColorf mrpt::opengl::CRenderizable::getColor | ( | ) | const [inline] |
Returns the object color property as a TColorf.
Definition at line 125 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::getColorA | ( | ) | const [inline] |
Color components in the range [0,1].
Definition at line 111 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::getColorB | ( | ) | const [inline] |
Color components in the range [0,1].
Definition at line 110 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::getColorG | ( | ) | const [inline] |
Color components in the range [0,1].
Definition at line 109 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::getColorR | ( | ) | const [inline] |
Color components in the range [0,1].
Definition at line 108 of file CRenderizable.h.
void mrpt::opengl::CRenderizable::getCurrentRenderingInfo | ( | TRenderInfo & | ri | ) | const [protected] |
Gather useful information on the render parameters.
It can be called from within the render() method of derived classes, and the returned matrices can be used to determine whether a given point (lx,ly,lz) in local coordinates wrt the object being rendered falls within the screen or not:
TRenderInfo ri; getCurrentRenderingInfo(ri); Eigen::Matrix<float,4,4> M= ri.proj_matrix * ri.model_matrix * HomogeneousMatrix(lx,ly,lz); const float rend_x = M(0,3)/M(3,3); const float rend_y = M(1,3)/M(3,3);
where (rend_x,rend_y) are both in the range [-1,1].
std::string mrpt::opengl::CRenderizable::getName | ( | ) | const [inline] |
Returns the name of the object.
Definition at line 81 of file CRenderizable.h.
static unsigned int mrpt::opengl::CRenderizable::getNewTextureNumber | ( | ) | [static, protected] |
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).
mrpt::math::TPose3D mrpt::opengl::CRenderizable::getPose | ( | ) | const |
Returns the 3D pose of the object.
double mrpt::opengl::CRenderizable::getPosePitch | ( | ) | const [inline] |
Rotation relative to parent coordinate origin, in **DEGREES**.
Definition at line 105 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::getPoseRoll | ( | ) | const [inline] |
Rotation relative to parent coordinate origin, in **DEGREES**.
Definition at line 106 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::getPoseX | ( | ) | const [inline] |
Translation relative to parent coordinate origin.
Definition at line 101 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::getPoseY | ( | ) | const [inline] |
Translation relative to parent coordinate origin.
Definition at line 102 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::getPoseYaw | ( | ) | const [inline] |
Rotation relative to parent coordinate origin, in **DEGREES**.
Definition at line 104 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::getPoseZ | ( | ) | const [inline] |
Translation relative to parent coordinate origin.
Definition at line 103 of file CRenderizable.h.
virtual const mrpt::utils::TRuntimeClassId* mrpt::opengl::CRenderizable::GetRuntimeClass | ( | ) | const [virtual] |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::utils::CSerializable.
Reimplemented in mrpt::opengl::CAngularObservationMesh, mrpt::opengl::CPlanarLaserScan, mrpt::opengl::C3DSScene, mrpt::opengl::CArrow, mrpt::opengl::CAxis, mrpt::opengl::CBox, mrpt::opengl::CCamera, mrpt::opengl::CCylinder, mrpt::opengl::CDisk, mrpt::opengl::CEllipsoid, mrpt::opengl::CGeneralizedCylinder, mrpt::opengl::CGridPlaneXY, mrpt::opengl::CGridPlaneXZ, mrpt::opengl::CMesh, mrpt::opengl::COpenGLStandardObject, mrpt::opengl::CPointCloud, mrpt::opengl::CPointCloudColoured, mrpt::opengl::CPolyhedron, mrpt::opengl::CRenderizableDisplayList, mrpt::opengl::CSetOfLines, mrpt::opengl::CSetOfObjects, mrpt::opengl::CSetOfTexturedTriangles, mrpt::opengl::CSetOfTriangles, mrpt::opengl::CSimpleLine, mrpt::opengl::CSphere, mrpt::opengl::CText, mrpt::opengl::CTexturedObject, and mrpt::opengl::CTexturedPlane.
float mrpt::opengl::CRenderizable::getScaleX | ( | ) | const [inline] |
Get the current scaling factor in one axis.
Definition at line 120 of file CRenderizable.h.
float mrpt::opengl::CRenderizable::getScaleY | ( | ) | const [inline] |
Get the current scaling factor in one axis.
Definition at line 121 of file CRenderizable.h.
float mrpt::opengl::CRenderizable::getScaleZ | ( | ) | const [inline] |
Get the current scaling factor in one axis.
Definition at line 122 of file CRenderizable.h.
bool mrpt::opengl::CRenderizable::isVisible | ( | ) | const [inline] |
void mrpt::opengl::CRenderizable::readFromStreamRender | ( | utils::CStream & | in | ) | [protected] |
Reimplemented in mrpt::opengl::CRenderizableDisplayList.
Referenced by mrpt::opengl::CRenderizableDisplayList::readFromStreamRender().
static void mrpt::opengl::CRenderizable::releaseTextureName | ( | unsigned int | i | ) | [static, protected] |
virtual void mrpt::opengl::CRenderizable::render | ( | ) | const [pure virtual] |
Implements the rendering of 3D objects in each class derived from CRenderizable.
Implemented in mrpt::opengl::CCamera, mrpt::opengl::CPointCloud, mrpt::opengl::CPointCloudColoured, mrpt::opengl::CRenderizableDisplayList, mrpt::opengl::CSetOfObjects, and mrpt::opengl::CText.
static void mrpt::opengl::CRenderizable::renderTextBitmap | ( | const char * | str, |
void * | fontStyle | ||
) | [static] |
static void mrpt::opengl::CRenderizable::renderTriangleWithNormal | ( | const mrpt::math::TPoint3D & | p1, |
const mrpt::math::TPoint3D & | p2, | ||
const mrpt::math::TPoint3D & | p3 | ||
) | [static, protected] |
Can be used by derived classes to draw a triangle with a normal vector computed automatically - to be called within a glBegin()-glEnd() block.
virtual CRenderizable& mrpt::opengl::CRenderizable::setColor | ( | double | R, |
double | G, | ||
double | B, | ||
double | A = 1 |
||
) | [virtual] |
Set the color components of this object (R,G,B,Alpha, in the range 0-1)
Reimplemented in mrpt::opengl::CRenderizableDisplayList, mrpt::opengl::CSetOfObjects, and mrpt::opengl::CSetOfTriangles.
virtual CRenderizable& mrpt::opengl::CRenderizable::setColor | ( | const mrpt::utils::TColorf & | c | ) | [virtual] |
Changes the default object color.
Reimplemented in mrpt::opengl::CRenderizableDisplayList, mrpt::opengl::CSetOfObjects, and mrpt::opengl::CSetOfTriangles.
virtual CRenderizable& mrpt::opengl::CRenderizable::setColorA | ( | const double | a | ) | [inline, virtual] |
Color components in the range [0,1].
Reimplemented in mrpt::opengl::CRenderizableDisplayList, mrpt::opengl::CSetOfObjects, and mrpt::opengl::CSetOfTriangles.
Definition at line 116 of file CRenderizable.h.
virtual CRenderizable& mrpt::opengl::CRenderizable::setColorB | ( | const double | b | ) | [inline, virtual] |
Color components in the range [0,1].
Reimplemented in mrpt::opengl::CRenderizableDisplayList, mrpt::opengl::CSetOfObjects, and mrpt::opengl::CSetOfTriangles.
Definition at line 115 of file CRenderizable.h.
virtual CRenderizable& mrpt::opengl::CRenderizable::setColorG | ( | const double | g | ) | [inline, virtual] |
Color components in the range [0,1].
Reimplemented in mrpt::opengl::CRenderizableDisplayList, mrpt::opengl::CSetOfObjects, and mrpt::opengl::CSetOfTriangles.
Definition at line 114 of file CRenderizable.h.
virtual CRenderizable& mrpt::opengl::CRenderizable::setColorR | ( | const double | r | ) | [inline, virtual] |
Color components in the range [0,1].
Reimplemented in mrpt::opengl::CRenderizableDisplayList, mrpt::opengl::CSetOfObjects, and mrpt::opengl::CSetOfTriangles.
Definition at line 113 of file CRenderizable.h.
CRenderizable& mrpt::opengl::CRenderizable::setLocation | ( | double | x, |
double | y, | ||
double | z | ||
) | [inline] |
Changes the location of the object, keeping untouched the orientation.
Definition at line 96 of file CRenderizable.h.
References internal::y.
CRenderizable& mrpt::opengl::CRenderizable::setLocation | ( | const mrpt::math::TPoint3D & | p | ) | [inline] |
Changes the location of the object, keeping untouched the orientation.
Definition at line 99 of file CRenderizable.h.
References mrpt::math::TPoint3D::x, mrpt::math::TPoint3D::y, and mrpt::math::TPoint3D::z.
void mrpt::opengl::CRenderizable::setName | ( | const std::string & | n | ) | [inline] |
Changes the name of the object.
Definition at line 80 of file CRenderizable.h.
CRenderizable& mrpt::opengl::CRenderizable::setPose | ( | const mrpt::poses::CPoint3D & | o | ) |
Set the 3D pose from a mrpt::poses::CPose3D object (return a ref to this)
CRenderizable& mrpt::opengl::CRenderizable::setPose | ( | const mrpt::math::TPose3D & | o | ) |
Set the 3D pose from a mrpt::math::TPose3D object (return a ref to this)
CRenderizable& mrpt::opengl::CRenderizable::setPose | ( | const mrpt::poses::CPoint2D & | o | ) |
Set the 3D pose from a mrpt::poses::CPose3D object (return a ref to this)
CRenderizable& mrpt::opengl::CRenderizable::setPose | ( | const mrpt::poses::CPose3D & | o | ) |
Set the 3D pose from a mrpt::poses::CPose3D object (return a ref to this)
CRenderizable& mrpt::opengl::CRenderizable::setScale | ( | float | s | ) | [inline] |
Scale to apply to the object, in all three axes (default=1)
Definition at line 118 of file CRenderizable.h.
CRenderizable& mrpt::opengl::CRenderizable::setScale | ( | float | sx, |
float | sy, | ||
float | sz | ||
) | [inline] |
Scale to apply to the object in each axis (default=1)
Definition at line 119 of file CRenderizable.h.
void mrpt::opengl::CRenderizable::setVisibility | ( | bool | visible = true | ) | [inline] |
Set object visibility (default=true)
Definition at line 84 of file CRenderizable.h.
virtual bool mrpt::opengl::CRenderizable::traceRay | ( | const mrpt::poses::CPose3D & | o, |
double & | dist | ||
) | const [virtual] |
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
Reimplemented in mrpt::opengl::CAngularObservationMesh, mrpt::opengl::C3DSScene, mrpt::opengl::CBox, mrpt::opengl::CCylinder, mrpt::opengl::CDisk, mrpt::opengl::CEllipsoid, mrpt::opengl::CGeneralizedCylinder, mrpt::opengl::CMesh, mrpt::opengl::CPolyhedron, mrpt::opengl::CSetOfObjects, mrpt::opengl::CSetOfTexturedTriangles, mrpt::opengl::CSetOfTriangles, mrpt::opengl::CSphere, and mrpt::opengl::CTexturedPlane.
void mrpt::opengl::CRenderizable::writeToStreamRender | ( | utils::CStream & | out | ) | const [protected] |
friend class mrpt::opengl::COpenGLViewport [friend] |
Definition at line 64 of file CRenderizable.h.
friend class mrpt::opengl::CSetOfObjects [friend] |
Definition at line 65 of file CRenderizable.h.
friend class mrpt::utils::CStream [friend] |
Reimplemented from mrpt::utils::CSerializable.
Reimplemented in mrpt::opengl::CRenderizableDisplayList, and mrpt::opengl::CTexturedObject.
Definition at line 62 of file CRenderizable.h.
Definition at line 62 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_color_A [protected] |
Color components in the range [0,1].
Definition at line 70 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_color_B [protected] |
Definition at line 70 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_color_G [protected] |
Definition at line 70 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_color_R [protected] |
Definition at line 70 of file CRenderizable.h.
std::string mrpt::opengl::CRenderizable::m_name [protected] |
Definition at line 68 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_pitch [protected] |
Definition at line 72 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_roll [protected] |
Rotation relative to parent coordinate origin, in **DEGREES**.
Definition at line 72 of file CRenderizable.h.
float mrpt::opengl::CRenderizable::m_scale_x [protected] |
Definition at line 73 of file CRenderizable.h.
float mrpt::opengl::CRenderizable::m_scale_y [protected] |
Definition at line 73 of file CRenderizable.h.
float mrpt::opengl::CRenderizable::m_scale_z [protected] |
Scale components to apply to the object (default=1)
Definition at line 73 of file CRenderizable.h.
bool mrpt::opengl::CRenderizable::m_show_name [protected] |
Definition at line 69 of file CRenderizable.h.
bool mrpt::opengl::CRenderizable::m_visible [protected] |
Is the object visible? (default=true)
Definition at line 74 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_x [protected] |
Definition at line 71 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_y [protected] |
Definition at line 71 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_yaw [protected] |
Definition at line 72 of file CRenderizable.h.
double mrpt::opengl::CRenderizable::m_z [protected] |
Translation relative to parent coordinate origin.
Definition at line 71 of file CRenderizable.h.
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011 |