crystalspace.jbind.interfaces.iengine.camera
Interface iCamera

All Superinterfaces:
iBase, iPointer
All Known Implementing Classes:
csCamera

public interface iCamera
extends iBase

Camera class.

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

A camera has the following properties:

Author:
java wrapper - Quentin Anciaux, c++ version - http://crystal.sourceforge.net/docs/online/pubapi/structiCamera.php

Method Summary
 iCamera Clone()
          Create a clone of this camera.
 void correct(int n)
          Eliminate roundoff error by snapping the camera orientation to a grid of density n.
 long getCameraNumber()
          Get the camera number.
 csPlane3 getFarPlane()
          Get the 3D far plane that should be used to clip all geometry.
 int getFOV()
          Return the FOV (field of view) in pixels.
 float getFOVAngle()
          Return the FOV (field of view) in degrees.
 float getInvFOV()
          Return the inverse flield of view (1/FOV) in pixels.
 boolean getOnlyPortals()
          Get the hit-only-portals flag.
 iSector getSector()
          Get the current sector.
 float getShiftX()
          Get the X shift amount.
 float getShiftY()
          Get the Y shift amount.
 csOrthoTransform getTransform()
          Get the transform corresponding to this camera.
 void invPerspective(csVector2 p, float z, csVector3 v)
          Calculate inverse perspective corrected point for this camera.
 boolean isMirrored()
          Return true if space is mirrored.
 void move(csVector3 v)
          Moves the camera a relative amount in camera coordinates.
 void move(csVector3 v, boolean cd)
          Moves the camera a relative amount in camera coordinates.
 void moveUnrestricted(csVector3 v)
          Moves the camera a relative amount in camera coordinates, ignoring portals and walls.
 void moveWorld(csVector3 v)
          Moves the camera a relative amount in world coordinates.
 void moveWorld(csVector3 v, boolean cd)
          Moves the camera a relative amount in world coordinates.
 void moveWorldUnrestricted(csVector3 v)
          Moves the camera a relative amount in world coordinates, ignoring portals and walls.
 void onlyPortals(boolean hop)
          If the hit-only-portals flag is true then only portals will be checked with the 'MoveWorld()' function.
 void perspective(csVector3 v, csVector2 p)
          Calculate perspective corrected point for this camera.
 void setFarPlane(csPlane3 fp)
          Set the 3D far plane used to clip all geometry.
 void setFOV(int fov, int width)
          Set the FOV in pixels.
 void setFOVAngle(float fov, int width)
          Set the FOV in radians.
 void setMirrored(boolean m)
          Set mirrored state.
 void setPerspectiveCenter(float x, float y)
          Set the shift amount.
 void setSector(iSector sector)
          Move to another sector.
 void setTransform(csOrthoTransform tr)
          Set the transform corresponding to this camera.
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getName, getRefCount, getVersion, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Method Detail

Clone

public iCamera Clone()
Create a clone of this camera.

Returns:

getFOV

public int getFOV()
Return the FOV (field of view) in pixels.

Returns:

getInvFOV

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

Returns:

getFOVAngle

public float getFOVAngle()
Return the FOV (field of view) in degrees.

Returns:

setFOV

public void setFOV(int fov,
                   int width)
Set the FOV in pixels.
'fov' is the desired FOV in pixels. 'width' is the display width, also in pixels.

Parameters:
fov -
width -

setFOVAngle

public void setFOVAngle(float fov,
                        int width)
Set the FOV in radians.
'fov' is the desired FOV in degrees. 'width' is the display width in pixels.

Parameters:
fov -
width -

getShiftX

public float getShiftX()
Get the X shift amount.
The parameter specified the desired X coordinate on screen of the projection center of the camera.

Returns:

getShiftY

public float getShiftY()
Get the Y shift amount.
The parameter specified the desired Y coordinate on screen of the projection center of the camera.

Returns:

setPerspectiveCenter

public void setPerspectiveCenter(float x,
                                 float y)
Set the shift amount.
The parameter specified the desired projection center of the camera on screen.

Parameters:
x -
y -

getTransform

public csOrthoTransform getTransform()
Get the transform corresponding to this camera.
In this transform, 'other' is world space and 'this' is camera space.

Returns:

setTransform

public void setTransform(csOrthoTransform tr)
Set the transform corresponding to this camera.
In this transform, 'other' is world space and 'this' is camera space.

Parameters:
tr -

moveWorld

public void moveWorld(csVector3 v)
Moves the camera a relative amount in world coordinates.

Parameters:
v -

moveWorld

public void moveWorld(csVector3 v,
                      boolean cd)
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).

Parameters:
v -
cd -

move

public void move(csVector3 v)
Moves the camera a relative amount in camera coordinates.

Parameters:
v -

move

public void move(csVector3 v,
                 boolean cd)
Moves the camera a relative amount in camera coordinates.

Parameters:
v -
cd -

moveWorldUnrestricted

public void moveWorldUnrestricted(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.

Parameters:
v -

moveUnrestricted

public void moveUnrestricted(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.

Parameters:
v -

getSector

public iSector getSector()
Get the current sector.

Returns:

setSector

public void setSector(iSector sector)
Move to another sector.

Parameters:
sector -

correct

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

Parameters:
n -

isMirrored

public boolean isMirrored()
Return true if space is mirrored.

Returns:

setMirrored

public void setMirrored(boolean m)
Set mirrored state.

Parameters:
m -

getFarPlane

public csPlane3 getFarPlane()
Get the 3D far plane that should be used to clip all geometry. If this function returns 0 no far clipping is required. Otherwise it must be used to clip the object before drawing.

Returns:

setFarPlane

public void setFarPlane(csPlane3 fp)
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).

Parameters:
fp -

getCameraNumber

public long getCameraNumber()
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.

Returns:

perspective

public void perspective(csVector3 v,
                        csVector2 p)
Calculate perspective corrected point for this camera.

Parameters:
v -
p -

invPerspective

public void invPerspective(csVector2 p,
                           float z,
                           csVector3 v)
Calculate inverse perspective corrected point for this camera.

Parameters:
p -
z -
v -

onlyPortals

public void onlyPortals(boolean hop)
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.

Parameters:
hop -

getOnlyPortals

public boolean getOnlyPortals()
Get the hit-only-portals flag.

Returns: