class mrpt::opengl::CCamera

A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camera parameters set in COpenGLViewport::m_camera.

A camera can be defined to provide a projective or orthogonal view of the world by setting the member CCamera::m_projectiveModel.

Alternatively, a camera pose and orientation can be given as a CPose3D object if set6DOFMode() is set to true, then the pose can be changed with CRenderizable::setPose(). Pose axis convention is +X pointing forwards, +Z up.

See also:

opengl::COpenGLScene

#include <mrpt/opengl/CCamera.h>

class CCamera: public mrpt::opengl::CRenderizable
{
public:
    //
methods

    virtual shader_list_t requiredShaders() const;

    void setPointingAt(
        float x,
        float y,
        float z
        );

    template <class POSEORPOINT>
    void setPointingAt(const POSEORPOINT& p);

    void setPointingAt(const mrpt::math::TPoint3D& p);
    float getPointingAtX() const;
    float getPointingAtY() const;
    float getPointingAtZ() const;
    void setZoomDistance(float z);
    float getZoomDistance() const;
    float getAzimuthDegrees() const;
    float getElevationDegrees() const;
    void setAzimuthDegrees(float ang);
    void setElevationDegrees(float ang);
    void setProjectiveModel(bool v = true);
    void setOrthogonal(bool v = true);
    void set6DOFMode(bool v);
    bool isProjective() const;
    bool isOrthogonal() const;
    bool is6DOFMode() const;
    void setProjectiveFOVdeg(float ang);
    float getProjectiveFOVdeg() const;
    virtual void render(const RenderContext& rc) const;
    virtual void renderUpdateBuffers() const;
    virtual void getBoundingBox(mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) 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 shader_list_t requiredShaders() const;
    virtual void getBoundingBox(mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const = 0;
    virtual void freeOpenGLResources() = 0;

Methods

virtual shader_list_t requiredShaders() const

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

See also:

DefaultShaderID

void setProjectiveModel(bool v = true)

Enable/Disable projective mode (vs.

orthogonal)

void setOrthogonal(bool v = true)

Enable/Disable orthogonal mode (vs.

projective)

void set6DOFMode(bool v)

Set 6DOFMode, if enabled camera is set according to its pose (default=false).

Conventionally, eye is set looking towards the positive direction of Z axis. Up is set as the Y axis. In this mode azimuth/elevation are ignored.

void setProjectiveFOVdeg(float ang)

Vertical field-of-View in degs, only when projectiveModel=true (default=30 deg).

float getProjectiveFOVdeg() const

Field-of-View in degs, only when projectiveModel=true (default=30 deg).

virtual void render(const RenderContext& rc) const

Render does nothing here.

virtual void renderUpdateBuffers() const

Render does nothing here.

virtual void getBoundingBox(mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const

In this class, returns a fixed box (max,max,max), (-max,-max,-max).

virtual void freeOpenGLResources()

Free opengl buffers.