#include <camera.h>
Inherits Node.
Inheritance diagram for Camera:
Public Member Functions | |
Camera (Image *img) | |
Default constructor. | |
virtual | ~Camera () |
Destructor. | |
void | setLookAt (const Point &pos, const Point &target, const Vector &up, float fov, float near=1.0f, float far=1000.0f) |
Setup the camera frame by specifying the camera's position, target, and up vector. | |
Ray | getRay (float x, float y) const |
Returns a ray that goes through image plane location (x,y), where the coordinate is given in terms of image pixel dimensions. | |
void | setTransform (Matrix &M) |
Manually set the local transform matrix to M. | |
void | setTranslation (const Vector &T) |
Sets the translation of the node to T. | |
void | setTranslation (float tx, float ty, float tz) |
Sets the translation of the node to (tx,ty,tz). | |
void | setScale (float s) |
Sets the scale uniformly to s. | |
void | setScale (const Vector &S) |
Sets the scale non-uniformly to S. | |
void | setScale (float sx, float sy, float sz) |
Sets the scale non-uniformly to (sx,sy,sz). | |
void | setRotation (const Vector &R) |
Sets the rotation about the x,y,z axes to the components of R. | |
void | setRotation (float rx, float ry, float rz) |
Sets the rotation about the x,y,z axes to (rx,ry,rz) respectively. | |
Protected Types | |
typedef std::list< Node * >::iterator | t_itr |
typedef std::list< Node * >::const_iterator | t_constitr |
Protected Member Functions | |
void | prepare () |
Prepare the camera for use in raytracing by transforming its frame to world coordinates. | |
virtual void | getGeometry (std::vector< Intersectable * > &geometry) |
void | addChild (Node *child) |
Adds a node to the list of children. | |
bool | hasChild (const Node *child) const |
Returns true if a specific node is a child of this node. | |
void | setupTransform (const Matrix &world) |
Setup the local and world transform of the node. | |
Protected Attributes | |
Image * | mImage |
Ptr to the output image. | |
Point | mOrigin |
Position of camera origin. | |
Vector | mForward |
Camera frame forward vector. | |
Vector | mRight |
Camera frame right vector. | |
Vector | mUp |
Camera frame up vector. | |
float | mNearPlane |
Distance to near viewing plane. | |
float | mFarPlane |
Distance to far viewing plane. | |
float | mFieldOfView |
Horizontal field-of-view. | |
float | mImageExtentX |
Extent of image plane in positive x direction. | |
float | mImageExtentY |
Extent of image plane in positive y direction. | |
Vector | mT |
Translation. | |
Vector | mS |
Scale. | |
Vector | mR |
Rotation. | |
bool | mTransformSet |
True if the local transform has been setup. | |
Matrix | mLocalTransform |
Local transform, created from the T,S,R parameters. | |
Matrix | mWorldTransform |
Object->World transform (local + inherited transform). | |
std::list< Node * > | mChildren |
List of children attached to the Node. |
The camera needs to know which Image object is used for the output image in order to extract the image dimensions. The camera can be conveniently setup using the setLookAt() function, which takes a position, target and up vector. The field of view parameter measures the FOV in degrees horizontally.