![]() |
Inviwo 0.9.12-pre
Inviwo documentation
|
Base class for cameras. Override this class to set your own projection matrix. More...
#include <inviwo/core/datastructures/camera/camera.h>
Public Member Functions | |
| Camera (Camera &&other) noexcept=default | |
| Camera (const Camera &other)=default | |
| Camera (vec3 lookFrom, vec3 lookTo, vec3 lookUp, float nearPlane, float farPlane, float aspectRatio) | |
| Create a camera. | |
| virtual Camera * | clone () const =0 |
| virtual void | configureProperties (CameraProperty &cameraProperty, bool attach) |
| virtual void | deserialize (Deserializer &d) override |
| virtual float | getAspectRatio () const |
| virtual std::string_view | getClassIdentifier () const =0 |
| virtual vec4 | getClipPosFromNormalizedDeviceCoords (const vec3 &ndcCoords) const |
| Convert from normalized device coordinates (xyz in [-1 1]) to clip coordinates, where z value of -1 correspond to the near plane and 1 to the far plane. Coordinates outside of the [-1 1]^3 range will be clipped. | |
| vec3 | getDirection () const |
| Get unnormalized direction of camera: lookTo - lookFrom. | |
| float | getFarPlaneDist () const |
| const mat4 & | getInverseProjectionMatrix () const |
| const mat4 & | getInverseViewMatrix () const |
| const vec3 & | getLookFrom () const |
| vec3 | getLookRight () const |
| const vec3 & | getLookTo () const |
| const vec3 & | getLookUp () const |
| float | getNearPlaneDist () const |
| vec3 | getNormalizedDeviceFromNormalizedScreenAtFocusPointDepth (const vec2 &normalizedScreenCoord) const |
| const mat4 & | getProjectionMatrix () const |
| const mat4 & | getViewMatrix () const |
| vec3 | getWorldPosFromNormalizedDeviceCoords (const vec3 &ndcCoords) const |
| Convert from normalized device coordinates (xyz in [-1 1]) to world coordinates. | |
| Camera & | operator= (Camera &&other) noexcept=default |
| Camera & | operator= (const Camera &other)=default |
| virtual void | serialize (Serializer &s) const override |
| virtual void | setAspectRatio (float val) |
| virtual void | setFarPlaneDist (float distance) |
| Set distance to the far plane from lookFrom. | |
| void | setLook (vec3 lookFrom, vec3 lookTo, vec3 lookUp) |
| virtual void | setLookFrom (vec3 val) |
| virtual void | setLookTo (vec3 val) |
| virtual void | setLookUp (vec3 val) |
| virtual void | setNearPlaneDist (float distance) |
| Set distance to the near plane from lookFrom. | |
| virtual void | updateFrom (const Camera &source) |
| virtual void | zoom (const ZoomOptions &opts)=0 |
Protected Member Functions | |
| virtual mat4 | calculateProjectionMatrix () const =0 |
| Calculate and return the projection matrix for the camera. | |
| virtual mat4 | calculateViewMatrix () const |
| virtual bool | equal (const Camera &other) const =0 |
| bool | equalTo (const Camera &other) const |
| void | invalidateProjectionMatrix () |
| void | invalidateViewMatrix () |
Protected Attributes | |
| float | aspectRatio_ |
| CameraProperty * | camprop_ = nullptr |
| float | farPlaneDist_ |
| Distance to the far plane from lookFrom. | |
| bool | invalidProjectionMatrix_ |
| bool | invalidViewMatrix_ |
| mat4 | inverseProjectionMatrix_ |
| mat4 | inverseViewMatrix_ |
| vec3 | lookFrom_ |
| vec3 | lookTo_ |
| vec3 | lookUp_ |
| float | nearPlaneDist_ |
| Distance to the near plane from lookFrom. | |
| mat4 | projectionMatrix_ |
| mat4 | viewMatrix_ |
Friends | |
| bool | operator!= (const Camera &lhs, const Camera &rhs) |
| bool | operator== (const Camera &lhs, const Camera &rhs) |
Base class for cameras. Override this class to set your own projection matrix.
| inviwo::Camera::Camera | ( | vec3 | lookFrom, |
| vec3 | lookTo, | ||
| vec3 | lookUp, | ||
| float | nearPlane, | ||
| float | farPlane, | ||
| float | aspectRatio ) |
Create a camera.
Default parameters creates a right handed coordinate system with camera looking towards the negative z-axis. with X = (1, 0, 0), Y = (0, 1, 0), Z = (0, 0, -1)
|
protectedpure virtual |
Calculate and return the projection matrix for the camera.
Implement this function to provide your own projection computation functionality. For example orthogonal or perspective projection. This function will be called when the projection matrix is invalid.
Implemented in inviwo::OrthographicCamera, inviwo::PerspectiveCamera, inviwo::PlotCamera, inviwo::SGCTCamera, and inviwo::SkewedPerspectiveCamera.
|
overridevirtual |
Implements inviwo::Serializable.
|
virtual |
Convert from normalized device coordinates (xyz in [-1 1]) to clip coordinates, where z value of -1 correspond to the near plane and 1 to the far plane. Coordinates outside of the [-1 1]^3 range will be clipped.
| ndcCoords | xyz clip-coordinates in [-1 1]^3, and the clip w-coordinate used for perspective division. |
Reimplemented in inviwo::OrthographicCamera, and inviwo::PlotCamera.
| vec3 inviwo::Camera::getWorldPosFromNormalizedDeviceCoords | ( | const vec3 & | ndcCoords | ) | const |
Convert from normalized device coordinates (xyz in [-1 1]) to world coordinates.
| ndcCoords | Coordinates in [-1 1] |
|
overridevirtual |
Implements inviwo::Serializable.