class mrpt::viz::CTexturedPlane

Overview

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

#include <mrpt/viz/CTexturedPlane.h>

class CTexturedPlane:
    public mrpt::viz::CVisualObject,
    public mrpt::viz::VisualObjectParams_Triangles,
    public mrpt::viz::VisualObjectParams_TexturedTriangles
{
public:
    // typedefs

    typedef std::shared_ptr<mrpt::viz ::CTexturedPlane> Ptr;
    typedef std::shared_ptr<const mrpt::viz ::CTexturedPlane> ConstPtr;
    typedef std::unique_ptr<mrpt::viz ::CTexturedPlane> UniquePtr;
    typedef std::unique_ptr<const mrpt::viz ::CTexturedPlane> ConstUniquePtr;

    // fields

    static constexpr const char* className = "mrpt::viz" "::" "CTexturedPlane";

    // construction

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

    // methods

    static constexpr auto getClassName();
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    static std::shared_ptr<CObject> CreateObject();

    template <typename... Args>
    static Ptr Create(Args&&... args);

    template <typename Alloc, typename... Args>
    static Ptr CreateAlloc(
        const Alloc& alloc,
        Args&&... args
        );

    template <typename... Args>
    static UniquePtr CreateUnique(Args&&... args);

    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    virtual mrpt::rtti::CObject* clone() const;
    void setPlaneCorners(float xMin, float xMax, float yMin, float yMax);
    void getPlaneCorners(float& xMin, float& xMax, float& yMin, float& yMax) const;
    void setTextureRepeat(float repeatX, float repeatY);
    void enableLighting(bool enable = true);
    virtual void updateBuffers() const;
    virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const;
    void cullFaces(const TCullFace& cf);
    TCullFace cullFaces() const;
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<CObject> Ptr;
    typedef std::shared_ptr<const CObject> ConstPtr;
    typedef std::shared_ptr<CSerializable> Ptr;
    typedef std::shared_ptr<const CSerializable> ConstPtr;
    typedef std::shared_ptr<CVisualObject> Ptr;
    typedef std::shared_ptr<const CVisualObject> ConstPtr;
    typedef std::unique_ptr<CObject> UniquePtr;
    typedef std::unique_ptr<const CObject> ConstUniquePtr;

    // structs

    struct PoseAndScale;
    struct State;

    // methods

    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    const auto& shaderTrianglesBuffer() const;
    auto& shaderTrianglesBufferMutex() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    PoseAndScale getPoseAndScale() const;
    virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c);
    bool isLightEnabled() const;
    void enableLight(bool enable = true);
    TCullFace cullFaces() const;
    void notifyBBoxChange() const;
    auto getBoundingBoxLocalf() const;
    const auto& shaderTexturedTrianglesBuffer() const;
    auto& shaderTexturedTrianglesBufferMutex() 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;
    const mrpt::img::CImage& getNormalMapImage() const;
    bool normalMapHasBeenAssigned() const;
    bool textureLinearInterpolation() const;
    void enableTextureMipMap(bool enable);
    bool textureMipMap() const;

Typedefs

typedef std::shared_ptr<mrpt::viz ::CTexturedPlane> Ptr

A type for the associated smart pointer.

Methods

virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const

Returns information about the class of an object in runtime.

virtual mrpt::rtti::CObject* clone() const

Returns a deep copy (clone) of the object, indepently of its class.

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.

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.

virtual void updateBuffers() const

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.

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

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

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”)