In file include/csengine/camera.h:

class csCamera : public csOrthoTransform

A camera positioned in the 3D world

Inheritance:


Public Fields

static int aspect
static float inv_aspect

Public Methods

inline csVector3 Camera2World (const csVector3& v)
Transform a camera space point to world space
inline csVector3 Camera2WorldRelative (const csVector3& v)
Transform a camera space point to worldspace, relative to camera position
void Correct (int n)
Eliminate roundoff error by snapping the camera orientation to a grid of density n
csCamera ()
inline csMatrix3 GetC2W ()
Return the camera to world transformation matrix
static int GetFOV ()
Get the FOV for this camera
csPolygon3D* GetHit (csVector3& v)
Check if there is a polygon in front of us in the direction defined by 'v' (world space coordinates)
csSector* GetSector ()
Get the current sector of the camera
inline csMatrix3 GetW2C ()
Return the world to camera transformation matrix
inline csVector3 GetW2CTranslation ()
Return the world to camera translation
bool IsMirrored ()
Returns true if we are in a mirrored world
bool LoadFile (csWorld* world, char* filename)
Load the camera position from a file as saved by SaveFile()
void LookAt (const csVector3& v, const csVector3& up)
Have the camera look at the given (x,y,z) point, using up as the up-vector
void Move (const csVector3& v)
Moves the camera a relative amount in camera coordinates
void MoveUnrestricted (const csVector3& v)
Moves the camera a relative amount in camera coordinates, ignoring portals and walls
void MoveWorld (const csVector3& v)
Moves the camera a relative amount in world coordinates
void MoveWorldUnrestricted (const csVector3& v)
Moves the camera a relative amount in world coordinates, ignoring portals and walls
void Rotate (const csMatrix3& m)
Use the given transformation matrix, in camera space, to reorient the camera
void Rotate (const csVector3& v, float angle)
Rotate the camera by the angle (radians) around the given vector, in camera coordinates
void RotateWorld (const csVector3& v, float angle)
Rotate the camera by the angle (radians) around the given vector, in world coordinates
void RotateWorld (const csMatrix3& m)
Use the given transformation matrix, in worldspace, to reorient the camera
void SaveFile (char* filename)
Save the camera position to a file
inline void SetC2W (const csMatrix3& m)
Set the camera to world transformation matrix
static void SetFOV (int fov)
Set the FOV to use for this camera
void SetMirrored (bool m)
Set the mirrored state of this camera
inline void SetPosition (const csVector3& v)
Sets the absolute position of the camera inside the sector
void SetSector (csSector *s)
Set the sector that the camera resides in
inline void SetW2C (const csMatrix3& m)
Set the world to camera transformation matrix
inline csVector3 World2Camera (const csVector3& v)
Transform a worldspace point to camera space
virtual ~csCamera ()

Private Fields

bool mirror
If true we are in a mirrored world.
csSector* sector
The sector the camera is in.

Private Methods

void Correct (int n, float* vals[])

Inherited from csOrthoTransform:

Public Methods

virtual void SetO2T(const csMatrix3& m)
virtual void SetT2O(const csMatrix3& m)

Inherited from csReversibleTransform:

Public Methods

csReversibleTransform GetInverse()
inline const csMatrix3& GetT2O()
inline csVector3 GetT2OTranslation()
friend csReversibleTransform operator* (const csReversibleTransform& t1, const csReversibleTransform& t2)
friend csTransform operator* (const csTransform& t1, const csReversibleTransform& t2)
friend csReversibleTransform& operator*= (csReversibleTransform& t1, const csReversibleTransform& t2)
friend csPlane operator/ (const csPlane& p, const csReversibleTransform& t)
friend csVector3 operator/ (const csVector3& v, const csReversibleTransform& t)
friend csReversibleTransform operator/ (const csReversibleTransform& t1, const csReversibleTransform& t2)
friend csVector3& operator/= (csVector3& v, const csReversibleTransform& t)
friend csReversibleTransform& operator/= (csReversibleTransform& t1, const csReversibleTransform& t2)
friend csPlane& operator/= (csPlane& p, const csReversibleTransform& t)
csPlane This2Other(const csPlane& p)
void This2Other(const csPlane& p, const csVector3& point, csPlane& result)
csVector3 This2Other(const csVector3& v)
inline csVector3 This2OtherRelative(const csVector3& v)

Protected Fields

csMatrix3 m_t2o

Inherited from csTransform:

Public Methods

inline const csMatrix3& GetO2T()
inline const csVector3& GetO2TTranslation()
inline const csVector3& GetOrigin()
static csTransform GetReflect(const csPlane& pl)
csPlane Other2This(const csPlane& p)
inline csVector3 Other2This(const csVector3& v)
void Other2This(const csPlane& p, const csVector3& point, csPlane& result)
csVector3 Other2ThisRelative(const csVector3& v)
inline void SetO2TTranslation(const csVector3& v)
inline void SetOrigin(const csVector3& v)
inline void Translate(const csVector3& v)

Protected Fields

csMatrix3 m_o2t
csVector3 v_o2t

Documentation

A camera positioned in the 3D world
csSector* sector
The sector the camera is in.

bool mirror
If true we are in a mirrored world.

static int aspect

static float inv_aspect

csCamera()

virtual ~csCamera()

void SaveFile(char* filename)
Save the camera position to a file. The camera can then later be restored by using LoadFile(). This function is mainly useful for debugging.

bool LoadFile(csWorld* world, char* filename)
Load the camera position from a file as saved by SaveFile(). This function is mainly useful for debugging.

csPolygon3D* 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.

static void SetFOV(int fov)
Set the FOV to use for this camera

static int GetFOV()
Get the FOV for this camera

void SetSector(csSector *s)
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.

csSector* GetSector()
Get the current sector of the camera

bool IsMirrored()
Returns true if we are in a mirrored world. Basicly this means that back-face culling will be reversed.

void SetMirrored(bool m)
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.

inline void SetPosition(const csVector3& v)
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.

inline void SetW2C(const csMatrix3& m)
Set the world to camera transformation matrix. This basicly defines the direction that the camera looks.

inline void SetC2W(const csMatrix3& m)
Set the camera to world transformation matrix. This basicly defines the direction that the camera looks.

inline csMatrix3 GetW2C()
Return the world to camera transformation matrix

inline csMatrix3 GetC2W()
Return the camera to world transformation matrix

inline csVector3 GetW2CTranslation()
Return the world to camera translation

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

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

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

void MoveWorld(const csVector3& v)
Moves the camera a relative amount in world coordinates

void Move(const csVector3& v)
Moves the camera a relative amount in camera coordinates

void MoveWorldUnrestricted(const csVector3& v)
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.

void MoveUnrestricted(const csVector3& v)
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.

void RotateWorld(const csVector3& v, float angle)
Rotate the camera by the angle (radians) around the given vector, in world coordinates. Note: this function rotates the camera, not the coordinate system.

void Rotate(const csVector3& v, float angle)
Rotate the camera by the angle (radians) around the given vector, in camera coordinates. Note: this function rotates the camera, not the coordinate system.

void RotateWorld(const csMatrix3& m)
Use the given transformation matrix, in worldspace, to reorient the camera. Note: this function rotates the camera, not the coordinate system.

void Rotate(const csMatrix3& m)
Use the given transformation matrix, in camera space, to reorient the camera. Note: this function rotates the camera, not the coordinate system.

void LookAt(const csVector3& v, const csVector3& up)
Have the camera look at the given (x,y,z) point, using up as the up-vector

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

void Correct(int n, float* vals[])


Direct child classes:
csRenderView

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de