CrystalSpace

Public API Reference

iCamera Struct Reference
[Views & Cameras]

Camera class. More...

#include <iengine/camera.h>

Inheritance diagram for iCamera:

List of all members.

Public Member Functions

virtual void AddCameraListener (iCameraListener *listener)=0
 Add a listener to this camera.
virtual void AddCameraSectorListener (iCameraSectorListener *listener)=0
 Add a listener to this camera.
virtual csPtr< iCameraClone () const =0
 Create a clone of this camera.
virtual void Correct (int n)=0
 Eliminate roundoff error by snapping the camera orientation to a grid of density n.
virtual long GetCameraNumber () const =0
 Get the camera number.
virtual csPlane3GetFarPlane () const =0
 Get the 3D far plane that should be used to clip all geometry.
virtual int GetFOV () const =0
 Return the FOV (field of view) in pixels.
virtual float GetFOVAngle () const =0
 Return the FOV (field of view) in degrees.
virtual float GetInvFOV () const =0
 Return the inverse flield of view (1/FOV) in pixels.
virtual const CS::Math::Matrix4GetInvProjectionMatrix ()=0
 Get the inverse projection matrix for this camera.
virtual bool GetOnlyPortals ()=0
 Get the hit-only-portals flag.
virtual const CS::Math::Matrix4GetProjectionMatrix ()=0
 Get the projection matrix for this camera.
virtual iSectorGetSector () const =0
 Get the current sector.
virtual float GetShiftX () const =0
 Get the X shift amount.
virtual float GetShiftY () const =0
 Get the Y shift amount.
virtual const csOrthoTransformGetTransform () const =0
 'const' version of GetTransform ()
virtual csOrthoTransformGetTransform ()=0
 Get the transform corresponding to this camera.
virtual const csPlane3GetVisibleVolume (uint32 &mask)=0
 Return the planes limiting the visible volume (as specified by the projection).
virtual csVector3 InvPerspective (const csVector2 &p, float z) const =0
 Calculate an inverse perspective corrected point for this camera, that is the inverse projection of a 2D point expressed in screen space into the 3D camera space.
virtual csVector3 InvProject (const csVector2 &p, float z) const =0
 Calculate an inverse projection corrected point for this camera, that is the inverse projection of a 2D point expressed in normalized screen coordinates into the 3D camera space.
virtual bool IsMirrored () const =0
 Return true if space is mirrored.
virtual void Move (const csVector3 &v, bool cd=true)=0
 Moves the camera a relative amount in camera coordinates.
virtual void MoveUnrestricted (const csVector3 &v)=0
 Moves the camera a relative amount in camera coordinates, ignoring portals and walls.
virtual void MoveWorld (const csVector3 &v, bool cd=true)=0
 Moves the camera a relative amount in world coordinates.
virtual void MoveWorldUnrestricted (const csVector3 &v)=0
 Moves the camera a relative amount in world coordinates, ignoring portals and walls.
virtual void OnlyPortals (bool hop)=0
 If the hit-only-portals flag is true then only portals will be checked with the 'MoveWorld()' function.
virtual csVector2 Perspective (const csVector3 &v) const =0
 Calculate a perspective corrected point for this camera, that is the projection of a 3D point expressed in camera space into the 2D camera screen.
virtual csVector2 Project (const csVector3 &v) const =0
 Calculate a projection corrected point for this camera, that is the projection of a 3D point expressed in camera space into the 2D camera screen.
virtual iSceneNodeQuerySceneNode ()=0
 Get the scene node that this object represents.
virtual void RemoveCameraListener (iCameraListener *listener)=0
 Remove a listener from this camera.
virtual void RemoveCameraSectorListener (iCameraSectorListener *listener)=0
 Remove a listener from this camera.
virtual void SetFarPlane (csPlane3 *fp)=0
 Set the 3D far plane used to clip all geometry.
virtual void SetFOV (int fov, int width)=0
 Set the FOV in pixels.
virtual void SetFOVAngle (float fov, int width)=0
 Set the FOV in degrees.
virtual void SetMirrored (bool m)=0
 Set mirrored state.
virtual void SetPerspectiveCenter (float x, float y)=0
 Set the shift amount.
virtual void SetSector (iSector *)=0
 Move to another sector.
virtual void SetTransform (const csOrthoTransform &tr)=0
 Set the transform corresponding to this camera.
virtual void SetViewportSize (int width, int height)=0
 Set the size of the viewport this camera is associated with.

Detailed Description

Camera class.

This class represents camera objects which can be used to render a world in the engine.

A camera has the following properties:

iCamera is the base abstract interface for all camera types. Practically, all cameras will also implement either the iPerspectiveCamera or the iCustomMatrixCamera interfaces depending on the desired camera projection.

The cameras work in normalized screen coordinates, that is, with the visible portion of the screen being mapped in the range [-1, 1], with the top-left corner of the screen being at the coordinates (-1, 1), and the bottom-right corner being at (1, -1).

Normalized screen coordinates are independant on the size of the viewport (that is, the iView). If you want to manipulate coordinates expressed in pixels (that is, in screen space coordinates), then you can use the methods iView::Project(), iView::InvProject(), csEngineTools::NormalizedToScreen() and csEngineTools::ScreenToNormalized().

Main ways to create instances implementing this interface:

Main ways to get pointers to this interface:

Main users of this interface:

See also:
iCameraPosition

Definition at line 151 of file camera.h.


Member Function Documentation

virtual void iCamera::AddCameraListener ( iCameraListener listener  )  [pure virtual]

Add a listener to this camera.

virtual void iCamera::AddCameraSectorListener ( iCameraSectorListener listener  )  [pure virtual]

Add a listener to this camera.

virtual csPtr<iCamera> iCamera::Clone (  )  const [pure virtual]

Create a clone of this camera.

Note that the array of listeners is not cloned.

virtual void iCamera::Correct ( int  n  )  [pure virtual]

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

Deprecated:
Don't use it anymore
virtual long iCamera::GetCameraNumber (  )  const [pure virtual]

Get the camera number.

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

virtual csPlane3* iCamera::GetFarPlane (  )  const [pure virtual]

Get the 3D far plane that should be used to clip all geometry.

If this function returns 0 then no far clipping is required. Otherwise it must be used to clip the object before drawing.

virtual int iCamera::GetFOV (  )  const [pure virtual]

Return the FOV (field of view) in pixels.

Deprecated:
Deprecated in 1.3. Use iPerspectiveCamera instead
virtual float iCamera::GetFOVAngle (  )  const [pure virtual]

Return the FOV (field of view) in degrees.

Deprecated:
Deprecated in 1.3. Use iPerspectiveCamera instead
virtual float iCamera::GetInvFOV (  )  const [pure virtual]

Return the inverse flield of view (1/FOV) in pixels.

Deprecated:
Deprecated in 1.3. Use iPerspectiveCamera instead
virtual const CS::Math::Matrix4& iCamera::GetInvProjectionMatrix (  )  [pure virtual]

Get the inverse projection matrix for this camera.

This matrix will project points in normalized screen coordinates (that is, with the visible portion of the screen being mapped in the range [-1, 1]) into 3D camera space.

See also:
GetProjectionMatrix() csEngineTools::ScreenToNormalized()
virtual bool iCamera::GetOnlyPortals (  )  [pure virtual]

Get the hit-only-portals flag.

virtual const CS::Math::Matrix4& iCamera::GetProjectionMatrix (  )  [pure virtual]

Get the projection matrix for this camera.

This matrix will project points in 3D camera space into normalized screen coordinates (that is, with the visible portion of the screen being mapped in the range [-1, 1]).

See also:
GetInvProjectionMatrix() csEngineTools::NormalizedToScreen()
virtual iSector* iCamera::GetSector (  )  const [pure virtual]

Get the current sector.

virtual float iCamera::GetShiftX (  )  const [pure virtual]

Get the X shift amount.

The parameter specified the desired X coordinate on screen of the projection center of the camera.

Deprecated:
Deprecated in 1.3. Use iPerspectiveCamera instead
virtual float iCamera::GetShiftY (  )  const [pure virtual]

Get the Y shift amount.

The parameter specified the desired Y coordinate on screen of the projection center of the camera.

Deprecated:
Deprecated in 1.3. Use iPerspectiveCamera instead
virtual const csOrthoTransform& iCamera::GetTransform (  )  const [pure virtual]

'const' version of GetTransform ()

virtual csOrthoTransform& iCamera::GetTransform (  )  [pure virtual]

Get the transform corresponding to this camera.

In this transform, 'other' is world space and 'this' is camera space. WARNING! It is illegal to directly assign to the given transform in order to modify it. To change the entire transform you have to use SetTransform(). Note that it is legal to modify the returned transform otherwise. Just do not assign to it.

virtual const csPlane3* iCamera::GetVisibleVolume ( uint32 &  mask  )  [pure virtual]

Return the planes limiting the visible volume (as specified by the projection).

The returned planes are in camera space.

virtual csVector3 iCamera::InvPerspective ( const csVector2 p,
float  z 
) const [pure virtual]

Calculate an inverse perspective corrected point for this camera, that is the inverse projection of a 2D point expressed in screen space into the 3D camera space.

Parameters:
p The 2D point on the screen, in pixels.
z The Z component of the projection point, that is the distance between the camera and the plane where the point was projected from.
Returns:
The 3D projection point, in camera space coordinates.
See also:
Perspective()
Deprecated:
Deprecated in 2.2. Use InvProject() instead
virtual csVector3 iCamera::InvProject ( const csVector2 p,
float  z 
) const [pure virtual]

Calculate an inverse projection corrected point for this camera, that is the inverse projection of a 2D point expressed in normalized screen coordinates into the 3D camera space.

Parameters:
p The 2D point on the screen, in normalized screen coordinates.
z The Z component of the projection point, that is the distance between the camera and the plane where the point is projected.
Returns:
The 3D projection point, in camera space coordinates.
See also:
Project() csEngineTools::ScreenToNormalized()
virtual bool iCamera::IsMirrored (  )  const [pure virtual]

Return true if space is mirrored.

virtual void iCamera::Move ( const csVector3 v,
bool  cd = true 
) [pure virtual]

Moves the camera a relative amount in camera coordinates.

Warning:
The cd parameter is not used
virtual void iCamera::MoveUnrestricted ( const csVector3 v  )  [pure 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.

virtual void iCamera::MoveWorld ( const csVector3 v,
bool  cd = true 
) [pure virtual]

Moves the camera a relative amount in world coordinates.

Warning:
The cd parameter is not used
virtual void iCamera::MoveWorldUnrestricted ( const csVector3 v  )  [pure 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.

virtual void iCamera::OnlyPortals ( bool  hop  )  [pure virtual]

If the hit-only-portals flag is true then only portals will be checked with the 'MoveWorld()' function.

This is a lot faster but it does mean that you will have to do collision detection with non-portal polygons using another technique. The default for this flag is true.

virtual csVector2 iCamera::Perspective ( const csVector3 v  )  const [pure virtual]

Calculate a perspective corrected point for this camera, that is the projection of a 3D point expressed in camera space into the 2D camera screen.

Parameters:
v The 3D point to be projected, in camera space coordinates.
Returns:
The 2D projection into the screen, in pixels.
See also:
InvPerspective()
Deprecated:
Deprecated in 2.2. Use Project() instead
virtual csVector2 iCamera::Project ( const csVector3 v  )  const [pure virtual]

Calculate a projection corrected point for this camera, that is the projection of a 3D point expressed in camera space into the 2D camera screen.

Parameters:
v The 3D point to be projected, in camera space coordinates.
Returns:
The 2D projection into the screen, in normalized screen coordinates.
See also:
InvProject() csEngineTools::NormalizedToScreen()
virtual iSceneNode* iCamera::QuerySceneNode (  )  [pure virtual]

Get the scene node that this object represents.

Todo:
iCamera doesn't yet support iMovable so scene nodes are not properly working yet.
virtual void iCamera::RemoveCameraListener ( iCameraListener listener  )  [pure virtual]

Remove a listener from this camera.

virtual void iCamera::RemoveCameraSectorListener ( iCameraSectorListener listener  )  [pure virtual]

Remove a listener from this camera.

virtual void iCamera::SetFarPlane ( csPlane3 fp  )  [pure virtual]

Set the 3D far plane used to clip all geometry.

If the pointer is 0 then far plane clipping will be disabled. Otherwise it will be enabled and the plane will be copied (so you can free or reuse the pointer you give here). Note that the far-plane will cull away geometry which is on the negative side of the plane (with csPlane3::Classify() function).

virtual void iCamera::SetFOV ( int  fov,
int  width 
) [pure virtual]

Set the FOV in pixels.

'fov' is the desired FOV in pixels. 'width' is the display width, also in pixels.

Deprecated:
Deprecated in 1.3. Use iPerspectiveCamera instead
virtual void iCamera::SetFOVAngle ( float  fov,
int  width 
) [pure virtual]

Set the FOV in degrees.

'fov' is the desired FOV in degrees. 'width' is the display width in pixels.

Deprecated:
Deprecated in 1.3. Use iPerspectiveCamera instead
virtual void iCamera::SetMirrored ( bool  m  )  [pure virtual]

Set mirrored state.

virtual void iCamera::SetPerspectiveCenter ( float  x,
float  y 
) [pure virtual]

Set the shift amount.

The parameter specified the desired projection center of the camera on screen.

Deprecated:
Deprecated in 1.3. Use iPerspectiveCamera instead
virtual void iCamera::SetSector ( iSector  )  [pure virtual]

Move to another sector.

virtual void iCamera::SetTransform ( const csOrthoTransform tr  )  [pure virtual]

Set the transform corresponding to this camera.

In this transform, 'other' is world space and 'this' is camera space.

virtual void iCamera::SetViewportSize ( int  width,
int  height 
) [pure virtual]

Set the size of the viewport this camera is associated with.

Deprecated:
Deprecated in 2.2. Use iView instead

The documentation for this struct was generated from the following file:

Generated for Crystal Space 2.1 by doxygen 1.6.1