class mrpt::opengl::CArrow

A 3D arrow.

mrpt::opengl::CArrow

See also:

opengl::COpenGLScene

#include <mrpt/opengl/CArrow.h>

class CArrow: public mrpt::opengl::CRenderizableShaderTriangles
{
public:
    // construction

    CArrow(
        float x0 = 0,
        float y0 = 0,
        float z0 = 0,
        float x1 = 1,
        float y1 = 1,
        float z1 = 1,
        float headRatio = 0.2f,
        float smallRadius = 0.05f,
        float largeRadius = 0.2f
        );

    CArrow(
        const mrpt::math::TPoint3Df& from,
        const mrpt::math::TPoint3Df& to,
        float headRatio = 0.2f,
        float smallRadius = 0.05f,
        float largeRadius = 0.2f
        );

    //
methods

    virtual void onUpdateBuffers_Triangles();

    void setArrowEnds(
        float x0,
        float y0,
        float z0,
        float x1,
        float y1,
        float z1
        );

    void setHeadRatio(float rat);
    void setSmallRadius(float rat);
    void setLargeRadius(float rat);
    void setSlicesCount(uint32_t slices);
    uint32_t getSlicesCount() const;
    virtual mrpt::math::TBoundingBox getBoundingBox() const;
    virtual shader_list_t requiredShaders() const;
    virtual void render(const RenderContext& rc) const;
    virtual void renderUpdateBuffers() const;
    virtual void freeOpenGLResources();
    virtual bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const;
};

Inherited Members

public:
    // structs

    struct RenderContext;

    //
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 void onUpdateBuffers_Triangles() = 0;

Construction

CArrow(
    float x0 = 0,
    float y0 = 0,
    float z0 = 0,
    float x1 = 1,
    float y1 = 1,
    float z1 = 1,
    float headRatio = 0.2f,
    float smallRadius = 0.05f,
    float largeRadius = 0.2f
    )

Constructor.

Methods

virtual void onUpdateBuffers_Triangles()

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

void setSlicesCount(uint32_t slices)

Number of radial divisions.

uint32_t getSlicesCount() const

Number of radial divisions.

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

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

virtual shader_list_t requiredShaders() const

Returns the ID of the OpenGL shader program required to render this class.

See also:

DefaultShaderID

virtual void render(const RenderContext& rc) const

Implements the rendering of 3D objects in each class derived from CRenderizable.

This can be called more than once (one per required shader program) if the object registered several shaders.

See also:

renderUpdateBuffers

virtual void renderUpdateBuffers() const

Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers, etc.

before they are sent for rendering in render()

virtual void freeOpenGLResources()

Free opengl 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