class mrpt::opengl::CTexturedPlane

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

Lighting is disabled by default in this class.

See also:

opengl::COpenGLScene

#include <mrpt/opengl/CTexturedPlane.h>

class CTexturedPlane: public mrpt::opengl::CRenderizableShaderTexturedTriangles
{
public:
    // construction

    CTexturedPlane(
        float x_min = -1,
        float x_max = 1,
        float y_min = -1,
        float y_max = 1
        );

    //
methods

    const auto& shaderTexturedTrianglesBuffer() const;
    virtual void onUpdateBuffers_TexturedTriangles();
    void setPlaneCorners(float xMin, float xMax, float yMin, float yMax);
    void getPlaneCorners(float& xMin, float& xMax, float& yMin, float& yMax) const;
    virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const;
    virtual mrpt::math::TBoundingBox getBoundingBox() const;
    bool isLightEnabled() const;
    void enableLight(bool enable = true);
    TCullFace cullFaces() const;
    const mrpt::img::CImage& getTextureImage() const;
    const mrpt::img::CImage& getTextureAlphaImage() const;
    bool textureImageHasBeenAssigned() const;
};

Inherited Members

public:
    // structs

    struct RenderContext;
    struct texture_name_unit_t;

    //
methods

    virtual void render(const RenderContext& rc) const = 0;
    virtual void renderUpdateBuffers() const = 0;
    virtual shader_list_t requiredShaders() const;
    virtual auto getBoundingBox() const = 0;
    virtual void freeOpenGLResources() = 0;
    virtual shader_list_t requiredShaders() const;
    virtual void render(const RenderContext& rc) const;
    virtual void renderUpdateBuffers() const;
    virtual void onUpdateBuffers_TexturedTriangles() = 0;
    virtual void freeOpenGLResources();
    void assignImage(const mrpt::img::CImage& img);

Methods

virtual void onUpdateBuffers_TexturedTriangles()

Must be implemented in derived classes to update the geometric entities to be drawn in “m_*_buffer” fields.

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.

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.

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

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

virtual mrpt::math::TBoundingBox getBoundingBox() const

Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent.