CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csCamera Class Reference

A camera positioned in the 3D world. More...

#include <camera.h>

Inheritance diagram for csCamera:

csOrthoTransform iBase csReversibleTransform csTransform List of all members.

Public Methods

 csCamera (csCamera *c)
 Copy constructor. More...

 csCamera (const csCamera &c)
 Copy constructor. More...

long GetCameraNumber () const
 Get the camera number. More...

iPolygon3DGetHit (csVector3 &v)
 Check if there is a polygon in front of us in the direction defined by 'v' (world space coordinates). More...

void SetFOV (int a, int width)
 Set the FOV for this camera. More...

int GetFOV () const
 Get the FOV for this camera. More...

float GetInvFOV () const
 Get the inverse FOV for this camera. More...

void SetFOVAngle (float a, int width)
 Set the FOV in angles (degrees). More...

float GetFOVAngle () const
 Get the FOV in angles (degrees). More...

float GetShiftX () const
 Get the X shift value. More...

float GetShiftY () const
 Get the Y shift value. More...

void SetFarPlane (const csPlane3 *farplane)
 Set farplane, everything behind this will be cut. More...

csPlane3GetFarPlane () const
 Get the Farplane. More...

void SetSector (iSector *s)
 Set the sector that the camera resides in. More...

iSectorGetSector () const
 Get the current sector of the camera. More...

bool IsMirrored () const
 Returns true if we are in a mirrored world. More...

void SetMirrored (bool m)
 Set the mirrored state of this camera. More...

virtual void SetO2T (const csMatrix3 &m)
 Set 'other' to 'this' transformation matrix. More...

virtual void SetT2O (const csMatrix3 &m)
 Set 'this' to 'other' transformation matrix. More...

virtual void SetO2TTranslation (const csVector3 &v)
 Set 'world' to 'this' translation. More...

virtual void SetPosition (const csVector3 &v)
 Sets the absolute position of the camera inside the sector. More...

void SetW2C (const csMatrix3 &m)
 Set the world to camera transformation matrix. More...

void SetC2W (const csMatrix3 &m)
 Set the camera to world transformation matrix. More...

csMatrix3 GetW2C () const
 Return the world to camera transformation matrix. More...

csMatrix3 GetC2W () const
 Return the camera to world transformation matrix. More...

csVector3 GetW2CTranslation () const
 Return the world to camera translation. More...

csVector3 World2Camera (const csVector3 &v) const
 Transform a worldspace point to camera space. More...

csVector3 Camera2World (const csVector3 &v) const
 Transform a camera space point to world space. More...

csVector3 Camera2WorldRelative (const csVector3 &v) const
 Transform a camera space point to worldspace, relative to camera position. More...

virtual void MoveWorld (const csVector3 &v, bool cd=true)
 Moves the camera a relative amount in world coordinates. More...

virtual void Move (const csVector3 &v, bool cd=true)
 Moves the camera a relative amount in camera coordinates. More...

virtual void MoveWorldUnrestricted (const csVector3 &v)
 Moves the camera a relative amount in world coordinates, ignoring portals and walls. More...

virtual void MoveUnrestricted (const csVector3 &v)
 Moves the camera a relative amount in camera coordinates, ignoring portals and walls. More...

void Correct (int n)
 Eliminate roundoff error by snapping the camera orientation to a grid of density n. More...

void SetPerspectiveCenter (float x, float y)
 Change the shift for perspective correction. More...

void Perspective (const csVector3 &v, csVector2 &p) const
 Calculate perspective corrected point for this camera. More...

void InvPerspective (const csVector2 &p, float z, csVector3 &v) const
 Calculate inverse perspective corrected point for this camera. More...


Static Public Methods

void SetDefaultFOV (int fov, int width)
 Set the default FOV for new cameras. More...

int GetDefaultFOV ()
 Get the default FOV for new cameras. More...

float GetDefaultInvFOV ()
 Get the default inverse FOV for new cameras. More...

float GetDefaultFOVAngle ()
 Get the default FOV in angles (degrees). More...


Public Attributes

csCamera::Camera scfiCamera
 iCamera implementation. More...


Detailed Description

A camera positioned in the 3D world.

Definition at line 34 of file csengine/camera.h.


Constructor & Destructor Documentation

csCamera::csCamera csCamera *    c
 

Copy constructor.

Referenced by csCamera::Camera::Clone.

csCamera::csCamera const csCamera &    c
 

Copy constructor.


Member Function Documentation

csVector3 csCamera::Camera2World const csVector3   v const [inline]
 

Transform a camera space point to world space.

Definition at line 268 of file csengine/camera.h.

References csReversibleTransform::This2Other.

csVector3 csCamera::Camera2WorldRelative const csVector3   v const [inline]
 

Transform a camera space point to worldspace, relative to camera position.

Definition at line 274 of file csengine/camera.h.

References csReversibleTransform::This2OtherRelative.

void csCamera::Correct int    n
 

Eliminate roundoff error by snapping the camera orientation to a grid of density n.

csMatrix3 csCamera::GetC2W   const [inline]
 

Return the camera to world transformation matrix.

Definition at line 252 of file csengine/camera.h.

References csReversibleTransform::GetT2O.

long csCamera::GetCameraNumber   const [inline]
 

Get the camera number.

This number is changed for every new camera instance and it is also updated whenever the camera transformation changes. This number can be used to cache camera vertex arrays, for example.

Definition at line 97 of file csengine/camera.h.

int csCamera::GetDefaultFOV   [inline, static]
 

Get the default FOV for new cameras.

Definition at line 117 of file csengine/camera.h.

float csCamera::GetDefaultFOVAngle   [inline, static]
 

Get the default FOV in angles (degrees).

Definition at line 121 of file csengine/camera.h.

float csCamera::GetDefaultInvFOV   [inline, static]
 

Get the default inverse FOV for new cameras.

Definition at line 119 of file csengine/camera.h.

csPlane3* csCamera::GetFarPlane   const [inline]
 

Get the Farplane.

Definition at line 151 of file csengine/camera.h.

int csCamera::GetFOV   const [inline]
 

Get the FOV for this camera.

Definition at line 131 of file csengine/camera.h.

float csCamera::GetFOVAngle   const [inline]
 

Get the FOV in angles (degrees).

Definition at line 138 of file csengine/camera.h.

iPolygon3D* csCamera::GetHit csVector3   v
 

Check if there is a polygon in front of us in the direction defined by 'v' (world space coordinates).

Return the nearest polygon.

float csCamera::GetInvFOV   const [inline]
 

Get the inverse FOV for this camera.

Definition at line 133 of file csengine/camera.h.

iSector* csCamera::GetSector   const [inline]
 

Get the current sector of the camera.

Definition at line 169 of file csengine/camera.h.

float csCamera::GetShiftX   const [inline]
 

Get the X shift value.

Definition at line 144 of file csengine/camera.h.

float csCamera::GetShiftY   const [inline]
 

Get the Y shift value.

Definition at line 146 of file csengine/camera.h.

csMatrix3 csCamera::GetW2C   const [inline]
 

Return the world to camera transformation matrix.

Definition at line 247 of file csengine/camera.h.

References csTransform::GetO2T.

csVector3 csCamera::GetW2CTranslation   const [inline]
 

Return the world to camera translation.

Definition at line 257 of file csengine/camera.h.

References csTransform::GetO2TTranslation.

void csCamera::InvPerspective const csVector2   p,
float    z,
csVector3   v
const [inline]
 

Calculate inverse perspective corrected point for this camera.

Definition at line 327 of file csengine/camera.h.

References csVector2::x, csVector3::x, csVector2::y, csVector3::y, and csVector3::z.

bool csCamera::IsMirrored   const [inline]
 

Returns true if we are in a mirrored world.

Basicly this means that back-face culling will be reversed.

Definition at line 176 of file csengine/camera.h.

virtual void csCamera::Move const csVector3   v,
bool    cd = true
[inline, virtual]
 

Moves the camera a relative amount in camera coordinates.

Definition at line 288 of file csengine/camera.h.

References csReversibleTransform::m_t2o, and MoveWorld.

virtual void csCamera::MoveUnrestricted const csVector3   v [inline, virtual]
 

Moves the camera a relative amount in camera coordinates, ignoring portals and walls.

This is used by the wireframe class. In general this is useful by any camera model that doesn't want to restrict its movement by portals and sector boundaries.

Definition at line 307 of file csengine/camera.h.

References csReversibleTransform::m_t2o, and csTransform::Translate.

virtual void csCamera::MoveWorld const csVector3   v,
bool    cd = true
[virtual]
 

Moves the camera a relative amount in world coordinates.

If 'cd' is true then collision detection with objects and things inside the sector is active. Otherwise you can walk through objects (but portals will still be correctly checked).

Referenced by Move.

virtual void csCamera::MoveWorldUnrestricted const csVector3   v [inline, virtual]
 

Moves the camera a relative amount in world coordinates, ignoring portals and walls.

This is used by the wireframe class. In general this is useful by any camera model that doesn't want to restrict its movement by portals and sector boundaries.

Definition at line 298 of file csengine/camera.h.

References csTransform::Translate.

void csCamera::Perspective const csVector3   v,
csVector2   p
const [inline]
 

Calculate perspective corrected point for this camera.

Definition at line 319 of file csengine/camera.h.

References csVector3::x, csVector2::x, csVector3::y, csVector2::y, and csVector3::z.

void csCamera::SetC2W const csMatrix3   m [inline]
 

Set the camera to world transformation matrix.

This basicly defines the direction that the camera looks.

Definition at line 242 of file csengine/camera.h.

References SetT2O.

void csCamera::SetDefaultFOV int    fov,
int    width
[inline, static]
 

Set the default FOV for new cameras.

Definition at line 109 of file csengine/camera.h.

void csCamera::SetFarPlane const csPlane3   farplane
 

Set farplane, everything behind this will be cut.

void csCamera::SetFOV int    a,
int    width
[inline]
 

Set the FOV for this camera.

Definition at line 124 of file csengine/camera.h.

void csCamera::SetFOVAngle float    a,
int    width
 

Set the FOV in angles (degrees).

void csCamera::SetMirrored bool    m [inline]
 

Set the mirrored state of this camera.

The effect of this is mainly that back-face culling will be reversed. This is useful if you are stepping into a mirrored sector.

Definition at line 184 of file csengine/camera.h.

virtual void csCamera::SetO2T const csMatrix3   m [inline, virtual]
 

Set 'other' to 'this' transformation matrix.

csCamera overrides this in order to be able to update the camera number.

Reimplemented from csOrthoTransform.

Definition at line 195 of file csengine/camera.h.

References csOrthoTransform::SetO2T.

Referenced by SetW2C.

virtual void csCamera::SetO2TTranslation const csVector3   v [inline, virtual]
 

Set 'world' to 'this' translation.

csCamera overrides this in order to be able to update the camera number.

Reimplemented from csTransform.

Definition at line 217 of file csengine/camera.h.

References csTransform::SetO2TTranslation.

void csCamera::SetPerspectiveCenter float    x,
float    y
[inline]
 

Change the shift for perspective correction.

Definition at line 316 of file csengine/camera.h.

virtual void csCamera::SetPosition const csVector3   v [inline, virtual]
 

Sets the absolute position of the camera inside the sector.

Vector 'v' is in world space coordinates. This function does not check if the vector is really in the current sector. In fact it is legal to set the position outside the sector boundaries.

Definition at line 230 of file csengine/camera.h.

References csTransform::SetOrigin.

void csCamera::SetSector iSector   s [inline]
 

Set the sector that the camera resides in.

Note that this function does not check if the current camera location is really in that sector. In fact it is legal to have a camera which is viewing the current sector from outside.

Definition at line 160 of file csengine/camera.h.

virtual void csCamera::SetT2O const csMatrix3   m [inline, virtual]
 

Set 'this' to 'other' transformation matrix.

csCamera overrides this in order to be able to update the camera number.

Reimplemented from csOrthoTransform.

Definition at line 206 of file csengine/camera.h.

References csOrthoTransform::SetT2O.

Referenced by SetC2W.

void csCamera::SetW2C const csMatrix3   m [inline]
 

Set the world to camera transformation matrix.

This basicly defines the direction that the camera looks.

Definition at line 236 of file csengine/camera.h.

References SetO2T.

csVector3 csCamera::World2Camera const csVector3   v const [inline]
 

Transform a worldspace point to camera space.

Definition at line 262 of file csengine/camera.h.

References csTransform::Other2This.


Member Data Documentation

csCamera::Camera csCamera::scfiCamera
 

iCamera implementation.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14