class mrpt::opengl::CCamera
Defines the intrinsic and extrinsic camera coordinates from which to render a 3D scene.
By default, each viewport has its own camera, accesible via COpenGLViewport::getCamera(), but if a CCamera object is added as an object to be rendered, it will override the internal viewport camera.
Projection models:
Projective model, parameterized via setProjectiveFOVdeg() (vertical field of view, in degrees), or
Projective model, by means of a computer vision pinhole intrinsic parameter set (see
setProjectiveFromPinhole()
), orOrthogonal projection model (use
setProjectiveModel(false)
, orsetOrthogonal()
).
Placing cameras can be done:
Using an “orbit” model: defined by a “pointing to” point, a distance to object, and azimuth + elevation angles; or
Directly giving the SE(3) camera pose, setting the set6DOFMode() to
true
and storing the desired pose with CRenderizable::setPose(). Pose axis convention is +Z pointing forwards, +X right, +Y down.
See also:
#include <mrpt/opengl/CCamera.h> class CCamera: public mrpt::opengl::CRenderizable { public: // construction CCamera(); // methods void setProjectiveModel(bool v = true); void setOrthogonal(bool v = true); void setProjectiveFromPinhole(const mrpt::img::TCamera& camIntrinsics); void setProjectiveFOVdeg(float ang); float getProjectiveFOVdeg() const; bool hasPinholeModel() const; const std::optional<mrpt::img::TCamera>& getPinholeModel() const; bool isProjective() const; bool isOrthogonal() 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; mrpt::math::TPoint3Df getPointingAt() const; void setZoomDistance(float z); float getZoomDistance() const; float getAzimuthDegrees() const; float getElevationDegrees() const; void setAzimuthDegrees(float ang); void setElevationDegrees(float ang); void set6DOFMode(bool v); bool is6DOFMode() const; virtual shader_list_t requiredShaders() const; virtual void render(const RenderContext& rc) const; virtual void renderUpdateBuffers() const; virtual mrpt::math::TBoundingBox getBoundingBox() 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 auto getBoundingBox() const = 0; virtual void freeOpenGLResources() = 0;
Methods
void setProjectiveModel(bool v = true)
Enable/Disable projective mode (vs.
orthogonal).
void setOrthogonal(bool v = true)
Enable/Disable orthogonal mode (vs.
projective)
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).
void set6DOFMode(bool v)
Set 6DOFMode, if enabled camera is set according to its pose, set via CRenderizable::setPose().
(default=false). Conventionally, eye is set looking towards +Z axis, “down” is the +Y axis, right is “+X” axis. In this mode azimuth/elevation are ignored.
virtual shader_list_t requiredShaders() const
Returns the ID of the OpenGL shader program required to render this class.
See also:
virtual void render(const RenderContext& rc) const
Render does nothing here.
virtual void renderUpdateBuffers() const
Render does nothing here.
virtual mrpt::math::TBoundingBox getBoundingBox() const
In this class, returns a fixed box (max,max,max), (-max,-max,-max).
virtual void freeOpenGLResources()
Free opengl buffers.