Vp::OrbitCamera
Camera turning around a point using an azimuth and elevation angle. More...
#include "Viewport/camera/OrbitCamera.h"
Inherits from Vp::AbstractOrbitCamera, Vp::AbstractCamera
Public Functions
Name | |
---|---|
float | getRotateSpeed() const |
virtual float | getRotationX() const |
virtual float | getRotationY() const |
bool | getSmoothScroll() const |
float | getTranslateSpeed() const |
float | getZoomSpeed() const |
virtual void | processInput(double dt, glm::vec2 mousePos, glm::ivec2 windowSize) override<br>Updates the internal camera state with user input. |
void | setRotateSpeed(float rotateSpeed) |
virtual void | setRotationX(float rotationX) |
virtual void | setRotationY(float rotationY) |
void | setSmoothScroll(bool b) |
void | setTranslateSpeed(float translateSpeed) |
void | setZoomSpeed(float zoomSpeed) |
virtual void | update() override<br>Recalculates the view and projection matrices based on the internal camera state. |
virtual void | viewpoint(AbstractCamera::Viewpoint viewpoint) override<br>Moves the camera to the specified viewpoint. |
Protected Functions
Name | |
---|---|
virtual void | mouseDrag(float dx, float dy, bool rotate, bool pan) |
virtual void | mouseWheel(float scroll) |
Protected Attributes
Name | |
---|---|
float | m_dScroll |
bool | m_isRotating |
float | m_rotateSpeed |
bool | m_rotateStartedUpsideDown |
float | m_rotationX <br>Horizontal rotation, 0 at +X, positive anti-clockwise. |
float | m_rotationY |
bool | m_smoothScroll |
float | m_translateSpeed |
float | m_zoomSpeed |
Additional inherited members
Public Functions inherited from Vp::AbstractOrbitCamera
Name | |
---|---|
virtual void | centerOnBox(glm::vec3 boxMin, glm::vec3 boxMax, bool interpolate) override<br>Moves camera so that the specified axis aligned bounding box is visible. |
glm::vec3 | getPivot() const |
float | getRadius() const |
void | setPivot(const glm::vec3 & pivot) |
void | setRadius(float radius) |
Protected Attributes inherited from Vp::AbstractOrbitCamera
Name | |
---|---|
glm::vec3 | m_pivot |
float | m_radius |
Public Types inherited from Vp::AbstractCamera
Name | |
---|---|
enum class | Viewpoint { LEFT, RIGHT, TOP, BOTTOM, FRONT, BACK} |
Public Functions inherited from Vp::AbstractCamera
Name | |
---|---|
virtual | ~AbstractCamera() =default |
virtual void | centerOnBox(glm::vec3 boxMin, glm::vec3 boxMax, bool interpolate)<br>Moves camera so that the specified axis aligned bounding box is visible. |
virtual void | centerOnObjects(const std::vector< const GameObject * > objects)<br>Moves camera so that the specified objects are visible. |
virtual void | centerOnScene(const Scene & scene)<br>Moves camera so that all objects in the scene are visible. |
virtual void | centerOnSelection(const Scene & scene)<br>Moves camera so that all selected objects in the scene are visible. |
virtual glm::vec3 | getDirection() const |
virtual float | getFov() const |
virtual int | getHeight() const |
virtual glm::vec3 | getPosition() const |
virtual glm::mat4 | getProjection() const |
virtual glm::vec3 | getRight() const |
virtual glm::vec3 | getUp() const |
virtual glm::mat4 | getView() const |
virtual int | getWidth() const |
virtual float | getZFar() const |
virtual float | getZNear() const |
void | interpolate(glm::mat4 from, glm::mat4 to)<br>Begin interpolation from one view matrix to another, the interpolation will take m_interpolationPeriod seconds in realtime. |
bool | isInterpolating(float & progress) const<br>Checks whether interpolation between view matrices is currently happening. |
virtual void | setFov(float fov) |
virtual void | setZFar(float zFar) |
virtual void | setZNear(float zNear) |
virtual void | size(int width, int height)<br>Sets the camera resolution in pixels. |
Protected Functions inherited from Vp::AbstractCamera
Name | |
---|---|
std::vector< glm::vec3 > | createBoundingBoxWorldPoints(glm::vec3 boxMin, glm::vec3 boxMax, glm::mat4 modelMatrix) |
glm::mat4 | createProjectionMatrix(bool nonShrinking) const |
Protected Attributes inherited from Vp::AbstractCamera
Name | |
---|---|
glm::mat4 | interpolationFrom |
double | interpolationPeriod |
std::chrono::time_point< std::chrono::steady_clock, std::chrono::duration< double > > | interpolationStart |
glm::mat4 | interpolationTo |
glm::vec3 | m_direction |
float | m_fov <br>Vertical field of vision in degrees. |
int | m_height <br>Camera resolution height in pixels. |
glm::vec3 | m_position |
glm::mat4 | m_projection |
glm::vec3 | m_right |
glm::vec3 | m_up |
glm::mat4 | m_view |
int | m_width <br>Camera resolution width in pixels. |
float | m_zFar <br>Distance to the far clipping pane. |
float | m_zNear <br>Distance to the near clipping pane. |
Detailed Description
class Vp::OrbitCamera;
class Vp::OrbitCamera;
Camera turning around a point using an azimuth and elevation angle.
It doesn't roll.
Public Functions Documentation
function getRotateSpeed
float getRotateSpeed() const
float getRotateSpeed() const
function getRotationX
virtual float getRotationX() const
virtual float getRotationX() const
function getRotationY
virtual float getRotationY() const
virtual float getRotationY() const
function getSmoothScroll
bool getSmoothScroll() const
bool getSmoothScroll() const
function getTranslateSpeed
float getTranslateSpeed() const
float getTranslateSpeed() const
function getZoomSpeed
float getZoomSpeed() const
float getZoomSpeed() const
function processInput
virtual void processInput(
double dt,
glm::vec2 mousePos,
glm::ivec2 windowSize
) override
virtual void processInput(
double dt,
glm::vec2 mousePos,
glm::ivec2 windowSize
) override
Updates the internal camera state with user input.
Parameters:
- mousePos Mouse position relative to the window size.
- windowSize The window size in pixels.
Reimplements: Vp::AbstractCamera::processInput
function setRotateSpeed
void setRotateSpeed(
float rotateSpeed
)
void setRotateSpeed(
float rotateSpeed
)
function setRotationX
virtual void setRotationX(
float rotationX
)
virtual void setRotationX(
float rotationX
)
function setRotationY
virtual void setRotationY(
float rotationY
)
virtual void setRotationY(
float rotationY
)
function setSmoothScroll
void setSmoothScroll(
bool b
)
void setSmoothScroll(
bool b
)
function setTranslateSpeed
void setTranslateSpeed(
float translateSpeed
)
void setTranslateSpeed(
float translateSpeed
)
function setZoomSpeed
void setZoomSpeed(
float zoomSpeed
)
void setZoomSpeed(
float zoomSpeed
)
function update
virtual void update() override
virtual void update() override
Recalculates the view and projection matrices based on the internal camera state.
Reimplements: Vp::AbstractCamera::update
Generally this method should build up a new view matrix from scratch using some arbitrary internal variables. From the calculated view matrix, direction, up, right and position information should be updated.
function viewpoint
virtual void viewpoint(
AbstractCamera::Viewpoint viewpoint
) override
virtual void viewpoint(
AbstractCamera::Viewpoint viewpoint
) override
Moves the camera to the specified viewpoint.
Parameters:
- viewpoint
Reimplements: Vp::AbstractCamera::viewpoint
Subclasses need to provide their own implementations.
Protected Functions Documentation
function mouseDrag
virtual void mouseDrag(
float dx,
float dy,
bool rotate,
bool pan
)
virtual void mouseDrag(
float dx,
float dy,
bool rotate,
bool pan
)
function mouseWheel
virtual void mouseWheel(
float scroll
)
virtual void mouseWheel(
float scroll
)
Protected Attributes Documentation
variable m_dScroll
float m_dScroll = 0.0f;
float m_dScroll = 0.0f;
variable m_isRotating
bool m_isRotating = false;
bool m_isRotating = false;
variable m_rotateSpeed
float m_rotateSpeed = 0.29f;
float m_rotateSpeed = 0.29f;
variable m_rotateStartedUpsideDown
bool m_rotateStartedUpsideDown = false;
bool m_rotateStartedUpsideDown = false;
variable m_rotationX
float m_rotationX = -90.0f;
float m_rotationX = -90.0f;
Horizontal rotation, 0 at +X, positive anti-clockwise.
variable m_rotationY
float m_rotationY = 30.0f;
float m_rotationY = 30.0f;
variable m_smoothScroll
bool m_smoothScroll = true;
bool m_smoothScroll = true;
variable m_translateSpeed
float m_translateSpeed = 0.02f;
float m_translateSpeed = 0.02f;
variable m_zoomSpeed
float m_zoomSpeed = 0.8f;
float m_zoomSpeed = 0.8f;
Updated on 2025-01-07 at 13:40:44 +0000