class mrpt::opengl::CAxis

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

mrpt::opengl::CAxis mrpt::opengl::CAxis mrpt::opengl::CAxis mrpt::opengl::CAxis

See also:

opengl::Scene

#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 enqueueForRenderRecursive(
        const mrpt::opengl::TRenderMatrices& state,
        RenderQueue& rq,
        bool wholeInView,
        bool is1stShadowMapPass
        ) const;

    virtual bool isCompositeObject() 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 mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const;
    virtual shader_list_t requiredShaders() const;
    virtual void renderUpdateBuffers() const;
    virtual void freeOpenGLResources();
};

Inherited Members

public:
    // structs

    struct OutdatedState;
    struct RenderContext;
    struct State;

    //
methods

    virtual void render(const RenderContext& rc) const = 0;
    virtual void renderUpdateBuffers() const = 0;
    virtual shader_list_t requiredShaders() const;
    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

virtual bool isCompositeObject() const

Should return true if enqueueForRenderRecursive() is defined since the object has inner children.

Examples: CSetOfObjects, CAssimpModel.

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 mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const

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

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.