GClasses
|
This camera assumes the canvas is specified in cartesian coordinates. The 3D space is based on a right-handed coordinate system. (So if x goes to the right and y goes up, then z comes out of the screen toward you.) More...
#include <G3D.h>
Public Member Functions | |
GCamera (int width, int height) | |
width and height specify the size of the image that this camera will produce | |
GCamera (GDomNode *pNode) | |
deserializing constructor | |
virtual | ~GCamera () |
virtual GDomNode * | serialize (GDom *pDoc) |
serializes this object | |
void | setImageSize (int width, int height) |
Specifies the size of the 2-D image this camera will produce. | |
int | imageWidth () |
Returns the width of the 2-D image this camera will produce. | |
int | imageHeight () |
Returns the height of the 2-D image this camera will produce. | |
G3DVector * | lookFromPoint () |
Returns a reference to the location of this camera. (You can set the values in the vector this returns to move the camera.) | |
void | setDirection (G3DVector *pDirection, G3DReal rollRads) |
Specifies the direction that the camera faces, and the roll in radians. (If rollRads is zero, then the horizon of the XZ-plane would appear as a horizontal line with positive Y above and negative Y below.) | |
void | setDirection (G3DVector *pDirection, G3DVector *pUpVector) |
If pUpVector is not orthogonal to pDirection, it will be changed to the nearest vector that is orthogonal to pDirection. | |
const G3DVector * | lookDirection () |
Returns the direction in which this camera is facing. | |
const G3DVector * | viewUpVector () |
Returns the up vector with respect to this camera. | |
const G3DVector * | viewSideVector () |
Returns the right side vector with respect to this camera. | |
void | setViewAngle (G3DReal val) |
This is the vertical view angle in radians. | |
G3DReal | halfViewHeight () |
Returns tan(viewAngle / 2) | |
void | project (const G3DVector *pPoint, G3DVector *pOut) |
Projects the 3D point onto the canvas. The x and y position in the output vector specify the location where the point projects onto the camera's canvas (positive x goes to the right with 0 at the left side, positive y goes up with 0 at the bottom). The z position specifies the distance from the camera. If the z position is <= 0, then x and y are set to 0. | |
void | computeRayDirection (int x, int y, G3DVector *pOutRay) |
Computes the direction that a ray must travel from lookFromPoint() for the specified pixel coordinates (relative to the bottom-left corner of the view image). Note that the ray is not normalized. | |
Protected Attributes | |
G3DVector | m_lookFromPoint |
G3DVector | m_viewSideVector |
G3DVector | m_viewUpVector |
G3DVector | m_lookDirection |
G3DReal | m_halfViewHeight |
int | m_nWidth |
int | m_nHeight |
This camera assumes the canvas is specified in cartesian coordinates. The 3D space is based on a right-handed coordinate system. (So if x goes to the right and y goes up, then z comes out of the screen toward you.)
GClasses::GCamera::GCamera | ( | int | width, |
int | height | ||
) | [inline] |
width and height specify the size of the image that this camera will produce
GClasses::GCamera::GCamera | ( | GDomNode * | pNode | ) |
deserializing constructor
virtual GClasses::GCamera::~GCamera | ( | ) | [inline, virtual] |
void GClasses::GCamera::computeRayDirection | ( | int | x, |
int | y, | ||
G3DVector * | pOutRay | ||
) |
Computes the direction that a ray must travel from lookFromPoint() for the specified pixel coordinates (relative to the bottom-left corner of the view image). Note that the ray is not normalized.
G3DReal GClasses::GCamera::halfViewHeight | ( | ) | [inline] |
Returns tan(viewAngle / 2)
int GClasses::GCamera::imageHeight | ( | ) | [inline] |
Returns the height of the 2-D image this camera will produce.
int GClasses::GCamera::imageWidth | ( | ) | [inline] |
Returns the width of the 2-D image this camera will produce.
const G3DVector* GClasses::GCamera::lookDirection | ( | ) | [inline] |
Returns the direction in which this camera is facing.
G3DVector* GClasses::GCamera::lookFromPoint | ( | ) | [inline] |
Returns a reference to the location of this camera. (You can set the values in the vector this returns to move the camera.)
Projects the 3D point onto the canvas. The x and y position in the output vector specify the location where the point projects onto the camera's canvas (positive x goes to the right with 0 at the left side, positive y goes up with 0 at the bottom). The z position specifies the distance from the camera. If the z position is <= 0, then x and y are set to 0.
serializes this object
Reimplemented in GClasses::GRayTraceCamera.
Specifies the direction that the camera faces, and the roll in radians. (If rollRads is zero, then the horizon of the XZ-plane would appear as a horizontal line with positive Y above and negative Y below.)
If pUpVector is not orthogonal to pDirection, it will be changed to the nearest vector that is orthogonal to pDirection.
void GClasses::GCamera::setImageSize | ( | int | width, |
int | height | ||
) | [inline] |
Specifies the size of the 2-D image this camera will produce.
void GClasses::GCamera::setViewAngle | ( | G3DReal | val | ) |
This is the vertical view angle in radians.
const G3DVector* GClasses::GCamera::viewSideVector | ( | ) | [inline] |
Returns the right side vector with respect to this camera.
const G3DVector* GClasses::GCamera::viewUpVector | ( | ) | [inline] |
Returns the up vector with respect to this camera.
G3DReal GClasses::GCamera::m_halfViewHeight [protected] |
G3DVector GClasses::GCamera::m_lookDirection [protected] |
G3DVector GClasses::GCamera::m_lookFromPoint [protected] |
int GClasses::GCamera::m_nHeight [protected] |
int GClasses::GCamera::m_nWidth [protected] |
G3DVector GClasses::GCamera::m_viewSideVector [protected] |
G3DVector GClasses::GCamera::m_viewUpVector [protected] |