class mrpt::opengl::CAxis

Draw a 3D world axis, with coordinate marks at some regular interval.

See also:

opengl::COpenGLScene

#include <mrpt/opengl/CAxis.h>

class CAxis: public mrpt::opengl::CRenderizableShaderWireFrame
{
public:
    // construction

    CAxis(
        float xmin = -1.0f,
        float ymin = -1.0f,
        float zmin = -1.0f,
        float xmax = 1.0f,
        float ymax = 1.0f,
        float zmax = 1.0f,
        float frecuency = 1.f,
        float lineWidth = 3.0f,
        bool marks = true
        );

    //
methods

    virtual void onUpdateBuffers_Wireframe();
    virtual void render(const RenderContext& rc) const;

    void enqueForRenderRecursive(
        const mrpt::opengl::TRenderMatrices& state,
        RenderQueue& rq
        ) const;

    void setAxisLimits(
        float xmin,
        float ymin,
        float zmin,
        float xmax,
        float ymax,
        float zmax
        );

    void setFrequency(float f);
    float getFrequency() const;
    void setTextScale(float f);
    float getTextScale() const;
    void setTextLabelOrientation(int axis, float yaw_deg, float pitch_deg, float roll_deg);
    void getTextLabelOrientation(int axis, float& yaw_deg, float& pitch_deg, float& roll_deg) const;
    void enableTickMarks(bool v = true);

    void enableTickMarks(
        bool show_x,
        bool show_y,
        bool show_z
        );

    void setTickMarksLength(float len);
    float getTickMarksLength(float len);
    virtual void getBoundingBox(mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const;
    virtual shader_list_t requiredShaders() const;
    virtual void renderUpdateBuffers() const;
    virtual void freeOpenGLResources();
};

Inherited Members

public:
    // structs

    struct RenderContext;

    //
methods

    virtual void render(const RenderContext& rc) const = 0;
    virtual void renderUpdateBuffers() const = 0;
    virtual void getBoundingBox(mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const = 0;
    virtual void freeOpenGLResources() = 0;
    virtual void onUpdateBuffers_Wireframe() = 0;

Construction

CAxis(
    float xmin = -1.0f,
    float ymin = -1.0f,
    float zmin = -1.0f,
    float xmax = 1.0f,
    float ymax = 1.0f,
    float zmax = 1.0f,
    float frecuency = 1.f,
    float lineWidth = 3.0f,
    bool marks = true
    )

Constructor.

Methods

virtual void onUpdateBuffers_Wireframe()

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

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

void setFrequency(float f)

Changes the frequency of the “ticks”.

void setTextScale(float f)

Changes the size of text labels (default:0.25)

void setTextLabelOrientation(
    int axis,
    float yaw_deg,
    float pitch_deg,
    float roll_deg
    )

axis: {0,1,2}=>{X,Y,Z}

void getTextLabelOrientation(
    int axis,
    float& yaw_deg,
    float& pitch_deg,
    float& roll_deg
    ) const

axis: {0,1,2}=>{X,Y,Z}

void setTickMarksLength(float len)

As a ratio of “marks frequency” (default: 0.05)

virtual void getBoundingBox(mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) 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 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.