![]() |
PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
|
Camera class. More...
Camera class.
Camera is the eye from where the scene is rendered onto the screen.
Definition at line 45 of file PureCamera.h.
#include <PureCamera.h>
Classes | |
class | PureCameraImpl |
Public Member Functions | |
PureCamera () | |
Creates camera with default settings. | |
PureCamera (const PureCamera &) | |
PureCamera & | operator= (const PureCamera &) |
Assignment operator. | |
virtual | ~PureCamera () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
const TRECT & | getViewport () const |
Gets camera viewport. | |
void | SetViewport (TPureUInt vx, TPureUInt vy, TPureUInt vsx, TPureUInt vsy) |
Sets viewport position and size. | |
TPureFloat | getNearPlane () const |
Gets camera near plane distance from eye position. | |
void | SetNearPlane (TPureFloat value) |
Sets camera near plane distance from eye position. | |
TPureFloat | getFarPlane () const |
Gets camera far plane distance from eye position. | |
void | SetFarPlane (TPureFloat value) |
Sets camera far plane distance from eye position. | |
TPureFloat | getFieldOfView () const |
Gets camera field of view angle on Y direction in degrees. | |
void | SetFieldOfView (TPureFloat value) |
Sets camera field of view angle on Y direction in degrees. | |
TPureFloat | getAspectRatio () const |
Gets the camera's aspect ratio (usually viewport width / height). | |
void | SetAspectRatio (TPureFloat value) |
Sets the camera's aspect ratio (usually viewport width / height). | |
TPURE_CLEAR_MODE | getClearMode () const |
Gets clear mode. | |
void | SetClearMode (TPURE_CLEAR_MODE mode) |
Sets clear mode. | |
TPURE_ASPECTRATIO_MODE | getAspectRatioMode () const |
Gets aspect ratio mode. | |
void | SetAspectRatioMode (TPURE_ASPECTRATIO_MODE mode) |
Sets aspect ratio mode. | |
PureColor & | getBackgroundColor () |
Gets camera background color. | |
const PureColor & | getBackgroundColor () const |
Gets camera background color. | |
bool | project3dTo2d (TPureFloat fWorldX, TPureFloat fWorldY, TPureFloat fWorldZ, PureVector &vecProjected) const |
Makes a projection from world-space to window/screen-space. | |
bool | project2dTo3d (TPureUInt nScreenX, TPureUInt nScreenY, TPureFloat nScreenDepth, PureVector &vecUnprojected) const |
Makes a projection from window/screen-space to world-space. | |
![]() | |
PurePosUpTarget () | |
Initializes the position vector to [0,0,0], the up vector to [0,1,0] and the target vector to [0,0,1]. | |
PurePosUpTarget (const PurePosUpTarget &cm) | |
PurePosUpTarget (const PureVector &pos, const PureVector &target, const PureVector &up) | |
Initializes the position, up and target vectors with the given vectors. | |
PureVector & | getPosVec () |
Gets Position vector. | |
const PureVector & | getPosVec () const |
Gets Position vector. | |
PureVector & | getTargetVec () |
Gets Target vector. | |
const PureVector & | getTargetVec () const |
Gets Target vector. | |
PureVector & | getUpVec () |
Gets Up vector. | |
const PureVector & | getUpVec () const |
Gets Up vector. | |
void | Move (TPureFloat amount) |
Moves forward or backward by the specified amount based on current direction. | |
void | Strafe (TPureFloat amount) |
Moves horizontally by the specified amount based on current direction. | |
void | Elevate (TPureFloat amount) |
Changes Y-position by the specified amount. | |
void | SetRotation (TPureFloat x, TPureFloat y, TPureFloat z) |
Sets direction. | |
TPureBool | operator== (const PurePosUpTarget &clr) const |
Equals to operator. | |
TPureBool | operator!= (const PurePosUpTarget &clr) const |
Not equals to operator. | |
PurePosUpTarget & | operator= (const PurePosUpTarget &vec) |
Assignment operator. | |
Static Public Member Functions | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
Private Attributes | |
PureCameraImpl * | pImpl |
PureCamera::PureCamera | ( | ) |
Creates camera with default settings.
Default settings:
std::bad_alloc | - This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller. |
Definition at line 276 of file PureCamera.cpp.
PureCamera::PureCamera | ( | const PureCamera & | other | ) |
std::bad_alloc | - This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller. |
Definition at line 284 of file PureCamera.cpp.
|
virtual |
Definition at line 318 of file PureCamera.cpp.
TPureFloat PureCamera::getAspectRatio | ( | ) | const |
Gets the camera's aspect ratio (usually viewport width / height).
Definition at line 431 of file PureCamera.cpp.
TPURE_ASPECTRATIO_MODE PureCamera::getAspectRatioMode | ( | ) | const |
Gets aspect ratio mode.
Aspect ratio mode defines what aspect ratio to be used when viewport size changes. Default is PURE_AM_FIX.
Definition at line 474 of file PureCamera.cpp.
PureColor & PureCamera::getBackgroundColor | ( | ) |
Gets camera background color.
Camera background color defines with what color to clear the color buffer at the beginning of rendering. Note that color buffer is cleared with background color only if clear mode is PURE_CLEAR_ZBUFFER_COLORBUFFER.
Definition at line 495 of file PureCamera.cpp.
const PureColor & PureCamera::getBackgroundColor | ( | ) | const |
Gets camera background color.
Camera background color defines with what color to clear the color buffer at the beginning of rendering. Note that color buffer is cleared with background color only if clear mode is PURE_CLEAR_ZBUFFER_COLORBUFFER.
Definition at line 506 of file PureCamera.cpp.
TPURE_CLEAR_MODE PureCamera::getClearMode | ( | ) | const |
Gets clear mode.
Clear mode defines which buffers to clear when rendering starts. Default is PURE_CLEAR_ZBUFFER_COLORBUFFER.
Definition at line 453 of file PureCamera.cpp.
CConsole & PureCamera::getConsole | ( | ) | const |
Returns access to console preset with logger module name as this class.
Intentionally not virtual, so the getConsole() in derived class should hide this instead of overriding.
Definition at line 330 of file PureCamera.cpp.
TPureFloat PureCamera::getFarPlane | ( | ) | const |
Gets camera far plane distance from eye position.
Definition at line 390 of file PureCamera.cpp.
TPureFloat PureCamera::getFieldOfView | ( | ) | const |
Gets camera field of view angle on Y direction in degrees.
Default value is 80�.
Definition at line 411 of file PureCamera.cpp.
|
static |
Returns the logger module name of this class.
Intentionally not virtual, so derived class should hide this instead of overriding. Not even private, so user can also access this from outside, for any reason like controlling log filtering per logger module name.
Definition at line 343 of file PureCamera.cpp.
TPureFloat PureCamera::getNearPlane | ( | ) | const |
Gets camera near plane distance from eye position.
Definition at line 371 of file PureCamera.cpp.
const TRECT & PureCamera::getViewport | ( | ) | const |
Gets camera viewport.
Definition at line 351 of file PureCamera.cpp.
PureCamera & PureCamera::operator= | ( | const PureCamera & | other | ) |
Assignment operator.
Definition at line 295 of file PureCamera.cpp.
bool PureCamera::project2dTo3d | ( | TPureUInt | nScreenX, |
TPureUInt | nScreenY, | ||
TPureFloat | nScreenDepth, | ||
PureVector & | vecUnprojected ) const |
Makes a projection from window/screen-space to world-space.
Makes an unprojection from window/screen-space to world-space.
Basically it calls PureProjection::project2dTo3d() will this camera's properties.
nScreenX,nScreenY | nScreenDepth The window/screen-space position coordinates to be unprojected to world-space. |
vecUnprojected | The unprojected 3D world-space coordinates. Valid only if the function returned true. |
Definition at line 549 of file PureCamera.cpp.
bool PureCamera::project3dTo2d | ( | TPureFloat | fWorldX, |
TPureFloat | fWorldY, | ||
TPureFloat | fWorldZ, | ||
PureVector & | vecProjected ) const |
Makes a projection from world-space to window/screen-space.
Basically it calls PureProjection::project3dTo2d() will this camera's properties. Note that for the projected coordinates, vecProjected = (0,0,z) represents the lower left corner of the window/screen, so if you want to have this projected coordinate vecProjected to be in the same coordinate system as the sticked objects, you need to subtract the half of the viewport's width from vecProjected.getX() and the half of the viewport's height from vecProjected.getY() because sticked objects have (0,0) as the center of the window/screen as the origin.
fWorldX,fWorldY,fWorldZ | The world-space position coordinates to be projected to window/screen-space. |
vecProjected | The projected 2D window/screen space coordinates. Valid only if the function returned true. |
Definition at line 528 of file PureCamera.cpp.
void PureCamera::SetAspectRatio | ( | TPureFloat | value | ) |
Sets the camera's aspect ratio (usually viewport width / height).
This is similar to setting the field of view angle on X direction in degrees. Must be positive. No effect if invalid value is specified.
Definition at line 442 of file PureCamera.cpp.
void PureCamera::SetAspectRatioMode | ( | TPURE_ASPECTRATIO_MODE | mode | ) |
Sets aspect ratio mode.
Aspect ratio mode defines what aspect ratio to be used when viewport size changes. Default is PURE_AM_FIX.
Definition at line 484 of file PureCamera.cpp.
void PureCamera::SetClearMode | ( | TPURE_CLEAR_MODE | mode | ) |
Sets clear mode.
Clear mode defines which buffers to clear when rendering starts. Default is PURE_CLEAR_ZBUFFER_COLORBUFFER.
Definition at line 463 of file PureCamera.cpp.
void PureCamera::SetFarPlane | ( | TPureFloat | value | ) |
Sets camera far plane distance from eye position.
Only positive value is accepted. Cannot be less than or equal to the current near plane. No effect if invalid value is specified.
Definition at line 401 of file PureCamera.cpp.
void PureCamera::SetFieldOfView | ( | TPureFloat | value | ) |
Sets camera field of view angle on Y direction in degrees.
Must be positive, cannot be greater than 180. No effect if invalid value is specified. Default value is 80�.
Definition at line 422 of file PureCamera.cpp.
void PureCamera::SetNearPlane | ( | TPureFloat | value | ) |
Sets camera near plane distance from eye position.
Only positive value is accepted. Cannot be greater than or equal to the current far plane. No effect if invalid value is specified.
Definition at line 381 of file PureCamera.cpp.
Sets viewport position and size.
Position values cannot be negative. Size values must be positive. No effect if invalid value is specified.
Definition at line 362 of file PureCamera.cpp.
|
private |
Definition at line 109 of file PureCamera.h.