Om
1.0.0
A universal framework for multimedia simulation
|
A class that represents a viewpoint in 3D space with a projection transformation. More...
#include <omGraphicsCamera.h>
Public Member Functions | |
Camera (const ProjectionType &projectionType=ProjectionType::PERSPECTIVE, Real aspectRatio=Real(1)) | |
Create a new perspective camera with the specified aspect ratio. More... | |
const Vector3 & | getPosition () const |
Get the position of the camera. More... | |
void | setPosition (const Vector3 &newPosition) |
Set the position of the camera. More... | |
const Matrix3 & | getOrientation () const |
Get the orientation of the camera. More... | |
void | setOrientation (const Matrix3 &newOrientation) |
Set the orientation of the camera. More... | |
Vector3 | getViewDirection () const |
Get a unit vector along the camera's view direction. More... | |
const Vector3 & | getUpDirection () const |
Get a unit vector pointing to the camera's up direction. More... | |
Vector3 | getLeftDirection () const |
Get a unit vector pointing to the camera's left. More... | |
const Vector3 & | getRightDirection () const |
Get a unit vector pointing to the camera's left. More... | |
Real | getNearPlaneDistance () const |
Get the distance to the near clipping plane. More... | |
void | setNearPlaneDistance (Real newNearPlaneDistance) |
Set the distance to the near clipping plane. More... | |
Real | getFarPlaneDistance () const |
Get the distance to the far clipping plane. More... | |
void | setFarPlaneDistance (Real newFarPlaneDistance) |
Set the distance to the far clipping plane. More... | |
Real | getAspectRatio () const |
Return the aspect ratio of this camera (the ratio of the view's width to its height). More... | |
void | setAspectRatio (Real newAspectRatio) |
Set the aspect ratio of this camera (the ratio of the view's width to its height). More... | |
Real | getFieldOfView () const |
Get the horizontal field of view of the camera's view frustum. More... | |
void | setFieldOfView (Real newFieldOfViewX) |
Set the horizontal field of view of the camera's view frustum. More... | |
Real | getFieldOfViewX () const |
Get the horizontal field of view of the camera's view frustum. More... | |
void | setFieldOfViewX (Real newFieldOfViewX) |
Set the horizontal field of view of the camera's view frustum. More... | |
Real | getFieldOfViewY () const |
Get the vertical field of view of the camera's view frustum. More... | |
void | setFieldOfViewY (Real newFieldOfViewY) |
Get the vertical field of view of the camera's view frustum. More... | |
const AABB2 & | getViewBounds () const |
Return the camera-space bounding box of this camera's view if it has an orthographic projection. More... | |
void | setViewBounds (const AABB2 &newViewBounds) |
Set the 2D camera-space bounding box of this camera's view if it has an orthographic projection. More... | |
void | setViewBounds (const AABB3 &newViewBounds) |
Set the 3D camera-space bounding box of this camera's view if it has an orthographic projection. More... | |
const ProjectionType & | getProjectionType () const |
Return a reference to the projection type for this camera. More... | |
void | setProjectionType (const ProjectionType &newProjectionType) |
Set the projection type for this camera. More... | |
CameraFlags & | getFlags () |
Return a reference to an object that contains boolean parameters of the camera. More... | |
const CameraFlags & | getFlags () const |
Return an object that contains boolean parameters of the camera. More... | |
void | setFlags (const CameraFlags &newFlags) |
Set an object that contains boolean parameters of the camera. More... | |
Bool | flagIsSet (CameraFlags::Flag flag) const |
Return whether or not the specified boolan flag is set for this camera. More... | |
void | setFlag (CameraFlags::Flag flag, Bool newIsSet=true) |
Set whether or not the specified boolan flag is set for this camera. More... | |
void | lookAt (const Vector3 &point) |
Rotate the camera at its current position so that the specified point is in the center of its view. More... | |
void | lookAt (const Vector3 &point, const Vector3 &up) |
Rotate the camera at its current position so that the specified point is in the center of its view. More... | |
virtual Matrix4 | getProjectionMatrix () const |
Get a matrix which projects points in camera space onto the near plane of the camera. More... | |
virtual Matrix4 | getDepthBiasProjectionMatrix (Real depth, Real bias) const |
Return a depth-biased projection matrix for this camera for the given depth and bias distance. More... | |
virtual ViewVolume | getViewVolume () const |
Return an object specifying the volume of this camera's view. More... | |
virtual void | getViewVolumeCorners (StaticArray< Vector3, 8 > &corners) const |
Compute the 8 corners of this camera's view volume and place them in the output array. More... | |
virtual Bool | canViewDirection (const Vector3f &direction) const |
Return whether or not the specified direction is within the camera's field of view. More... | |
virtual Vector2 | getScreenSpaceRadius (const Sphere3 &sphere) const |
Return the screen-space radius in pixels of the specified world-space bounding sphere. More... | |
Real | getDepth (const Vector3 &point) const |
Return the distance to the specified point along the view direction. More... | |
virtual Ray3 | getViewRay (const Vector2 &viewportPosition) const |
Return the ray along this camera's view direction passing through the specified viewport position. More... | |
Public Member Functions inherited from om::graphics::base::Transformable | |
Transformable () | |
Create a new transformable with the identity transformation. More... | |
Transformable (const Transform3 &newTransform) | |
Create a new transformable with the specified transformation. More... | |
virtual | ~Transformable () |
Destroy this transformable, releasing all associated resources. More... | |
const Vector3 & | getPosition () const |
Return the position of this transformable. More... | |
void | setPosition (const Vector3 &newPosition) |
Set the position of this transformable. More... | |
const Matrix3 & | getOrientation () const |
Return the orientation of this transformable. More... | |
void | setOrientation (const Matrix3 &newOrientation) |
Set the orientation of this transformable. More... | |
const Vector3 & | getScale () const |
Get the scale of the transformable. More... | |
void | setScale (Real newScale) |
Set the scale of the transformable uniformly for all dimensions. More... | |
void | setScale (const Vector3 &newScale) |
Set the scale of the transformable. More... | |
const Transform3 & | getTransform () const |
Return the transformation for this transformable between its local and parent coordinate frame. More... | |
void | setTransform (const Transform3 &newTransform) |
Set the transformation for this transformable between its local and parent coordinate frame. More... | |
Matrix4 | getTransformMatrix () const |
Return a 4x4 matrix representing the transformation from object to world space. More... | |
Matrix4 | getTransformMatrixInverse () const |
Return a 4x4 matrix which transforms points from world space to object space. More... | |
Sphere3 | getBoundingSphere () const |
Return a bounding sphere for this transformable in its parent coordinate space. More... | |
Sphere3 | getLocalBoundingSphere () const |
Return a bounding sphere for this transformable in its local coordinate space. More... | |
const AABB3 & | getBoundingBox () const |
Return an axis-aligned bounding box that encompases this entire transformable in its parent coordinate space. More... | |
const AABB3 & | getLocalBoundingBox () const |
Return an axis-aligned bounding box that encompases this entire transformable in its local coordinate space. More... | |
virtual void | updateBoundingBox () |
Update the transformable's bounding box based on its current geometric representation. More... | |
Static Public Attributes | |
static const ResourceType | RESOURCE_TYPE |
The resource type for a graphics camera. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from om::graphics::base::Transformable | |
void | setLocalBoundingBox (const AABB3 &newLocalBoundingBox) |
Set the local axis-aligned bounding box for this shape. More... | |
Protected Attributes inherited from om::graphics::base::Transformable | |
Transform3 | transform |
The transformation for this transformable between its local and parent coordinate frame. More... | |
A class that represents a viewpoint in 3D space with a projection transformation.
om::graphics::cameras::Camera::Camera | ( | const ProjectionType & | projectionType = ProjectionType::PERSPECTIVE , |
Real | aspectRatio = Real(1) |
||
) |
Create a new perspective camera with the specified aspect ratio.
|
inline |
Get the position of the camera.
|
inline |
Set the position of the camera.
|
inline |
Get the orientation of the camera.
|
inline |
Set the orientation of the camera.
This method ensures that the new camera orientation matrix is orthonormal.
|
inline |
Get a unit vector along the camera's view direction.
|
inline |
Get a unit vector pointing to the camera's up direction.
|
inline |
Get a unit vector pointing to the camera's left.
|
inline |
Get a unit vector pointing to the camera's left.
|
inline |
Get the distance to the near clipping plane.
|
inline |
Set the distance to the near clipping plane.
|
inline |
Get the distance to the far clipping plane.
|
inline |
Set the distance to the far clipping plane.
|
inline |
Return the aspect ratio of this camera (the ratio of the view's width to its height).
The default aspect ratio is 1.
|
inline |
Set the aspect ratio of this camera (the ratio of the view's width to its height).
The default aspect ratio is 1.
|
inline |
Get the horizontal field of view of the camera's view frustum.
This value is specified in degrees.
|
inline |
Set the horizontal field of view of the camera's view frustum.
This value, specified in degrees, is clamped between 0 and 180.
|
inline |
Get the horizontal field of view of the camera's view frustum.
This value is specified in degrees.
|
inline |
Set the horizontal field of view of the camera's view frustum.
This value, specified in degrees, is clamped between 0 and 180.
|
inline |
Get the vertical field of view of the camera's view frustum.
This value is specified in degrees.
|
inline |
Get the vertical field of view of the camera's view frustum.
This value, specified in degrees, is clamped between 0 and 180.
|
inline |
Return the camera-space bounding box of this camera's view if it has an orthographic projection.
|
inline |
Set the 2D camera-space bounding box of this camera's view if it has an orthographic projection.
|
inline |
Set the 3D camera-space bounding box of this camera's view if it has an orthographic projection.
|
inline |
Return a reference to the projection type for this camera.
|
inline |
Set the projection type for this camera.
|
inline |
Return a reference to an object that contains boolean parameters of the camera.
|
inline |
Return an object that contains boolean parameters of the camera.
|
inline |
Set an object that contains boolean parameters of the camera.
|
inline |
Return whether or not the specified boolan flag is set for this camera.
|
inline |
Set whether or not the specified boolan flag is set for this camera.
void om::graphics::cameras::Camera::lookAt | ( | const Vector3 & | point | ) |
Rotate the camera at its current position so that the specified point is in the center of its view.
This method uses the camera's current up vector in determining the camera's new orientation.
Rotate the camera at its current position so that the specified point is in the center of its view.
This method uses the specified up vector in determining the camera's new orientation.
|
virtual |
Get a matrix which projects points in camera space onto the near plane of the camera.
|
virtual |
Return a depth-biased projection matrix for this camera for the given depth and bias distance.
|
virtual |
Return an object specifying the volume of this camera's view.
|
virtual |
Compute the 8 corners of this camera's view volume and place them in the output array.
The corners are stored in the following order: near bottom left, near bottom right, near top left, near top right, far bottom left, far bottom right, far top left, far top right.
|
virtual |
Return whether or not the specified direction is within the camera's field of view.
|
virtual |
Return the screen-space radius in pixels of the specified world-space bounding sphere.
Return the distance to the specified point along the view direction.
|
virtual |
Return the ray along this camera's view direction passing through the specified viewport position.
The viewport position is specified where (0,0) is the lower left corner of the screen and (1,1) is the upper right corner. The ray's origin is the viewport position on the camera's near plane in world space.
|
static |
The resource type for a graphics camera.