Class CTexturedPlane

Inheritance Relationships

Base Types

Class Documentation

class CTexturedPlane : public virtual mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Triangles, public mrpt::viz::VisualObjectParams_TexturedTriangles

A 2D plane in the XY plane with a texture image.

Lighting is disabled by default in this class, so the plane color or texture will be independent of its orientation or shadows cast on it. This can be changed calling enableLighting(true)

See also

opengl::Scene

Public Functions

CTexturedPlane(float x_min = -1, float x_max = 1, float y_min = -1, float y_max = 1)
inline void setPlaneCorners(float xMin, float xMax, float yMin, float yMax)

Set the coordinates of the four corners that define the plane on the XY plane.

inline void getPlaneCorners(float &xMin, float &xMax, float &yMin, float &yMax) const

Get the coordinates of the four corners that define the plane on the XY plane.

inline void setTextureRepeat(float repeatX, float repeatY)

Set the number of times the texture repeats in each direction. Default is (1,1), i.e. the texture spans the entire plane once.

inline void enableLighting(bool enable = true)
virtual void updateBuffers() const override

Called by the rendering system to update internal geometry buffers.

Derived classes should override this to populate their data buffers (triangles, points, lines) when the object geometry changes.

This is called automatically when hasToUpdateBuffers() returns true, which happens after notifyChange() was called.

The base implementation does nothing; derived classes should override.

Note

Thread safety: implementations should lock the appropriate mutexes when writing to shared buffers.

virtual bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override

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

inline void cullFaces(const TCullFace &cf)

Control whether to render the FRONT, BACK, or BOTH (default) set of faces. Refer to docs for glCullFace(). Example: If set to cullFaces(TCullFace::BACK);, back faces will not be drawn (“culled”)

inline TCullFace cullFaces() const

Protected Functions

void updatePoly() const
virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const override

Must be implemented by derived classes to provide the updated bounding box in the object local frame of coordinates. This will be called only once after each time the derived class reports to notifyChange() that the object geometry changed.

See also

getBoundingBox(), getBoundingBoxLocal(), getBoundingBoxLocalf()

Protected Attributes

float m_xMin = -1.0f
float m_xMax = 1.0f
float m_yMin = -1.0f
float m_yMax = 1.0f
float m_textureRepeatX = 1.0f
float m_textureRepeatY = 1.0f
mutable bool polygonUpToDate = {false}
mutable std::vector<mrpt::math::TPolygonWithPlane> tmpPoly

Used for ray-tracing