crystalspace.jbind.impl.engine.camera
Class csCamera

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.engine.camera.csCamera
All Implemented Interfaces:
iBase, iCamera, iPointer

public class csCamera
extends csBase
implements iCamera

Author:
qan To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code and Comments

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csCamera(iPointer nPointer)
           
 
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.
static java.lang.Class getInterfaceClass()
           
static java.lang.String getInterfaceName()
           
static int getInterfaceVersion()
           
 float getInvFOV()
          Return the inverse flield of view (1/FOV) in pixels.
 java.lang.String getName()
          Return the name of the interface
 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.
 int getVersion()
          Return the version of the interface
static void initSCF()
           
 void invPerspective(csVector2 p, float z, csVector3 v)
          Calculate inverse perspective corrected point for this camera.
 boolean isMirrored()
          Return true if space is mirrored.
protected  boolean isNativePointerValidSafe()
           
 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 class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, isNativePointerValidSafe, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csCamera

public csCamera(iPointer nPointer)
Parameters:
nPointer -
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase

getName

public java.lang.String getName()
Description copied from interface: iBase
Return the name of the interface

Specified by:
getName in interface iBase
Specified by:
getName in class csBase

initSCF

public static void initSCF()

getInterfaceVersion

public static int getInterfaceVersion()

getInterfaceName

public static java.lang.String getInterfaceName()

getInterfaceClass

public static java.lang.Class getInterfaceClass()

getTransform

public csOrthoTransform getTransform()
Description copied from interface: iCamera
Get the transform corresponding to this camera.
In this transform, 'other' is world space and 'this' is camera space.

Specified by:
getTransform in interface iCamera
Returns:

setSector

public void setSector(iSector sector)
Description copied from interface: iCamera
Move to another sector.

Specified by:
setSector in interface iCamera
Parameters:
sector -

isNativePointerValidSafe

protected boolean isNativePointerValidSafe()

Clone

public iCamera Clone()
Description copied from interface: iCamera
Create a clone of this camera.

Specified by:
Clone in interface iCamera
Returns:
See Also:
iCamera.Clone()

correct

public void correct(int n)
Description copied from interface: iCamera
Eliminate roundoff error by snapping the camera orientation to a grid of density n.

Specified by:
correct in interface iCamera
Parameters:
n -
See Also:
iCamera.correct(int)

getCameraNumber

public long getCameraNumber()
Description copied from interface: iCamera
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.

Specified by:
getCameraNumber in interface iCamera
Returns:
See Also:
iCamera.getCameraNumber()

getFarPlane

public csPlane3 getFarPlane()
Description copied from interface: iCamera
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.

Specified by:
getFarPlane in interface iCamera
Returns:
See Also:
iCamera.getFarPlane()

getFOV

public int getFOV()
Description copied from interface: iCamera
Return the FOV (field of view) in pixels.

Specified by:
getFOV in interface iCamera
Returns:
See Also:
iCamera.getFOV()

getFOVAngle

public float getFOVAngle()
Description copied from interface: iCamera
Return the FOV (field of view) in degrees.

Specified by:
getFOVAngle in interface iCamera
Returns:
See Also:
iCamera.getFOVAngle()

getInvFOV

public float getInvFOV()
Description copied from interface: iCamera
Return the inverse flield of view (1/FOV) in pixels.

Specified by:
getInvFOV in interface iCamera
Returns:
See Also:
iCamera.getInvFOV()

getOnlyPortals

public boolean getOnlyPortals()
Description copied from interface: iCamera
Get the hit-only-portals flag.

Specified by:
getOnlyPortals in interface iCamera
Returns:
See Also:
iCamera.getOnlyPortals()

getSector

public iSector getSector()
Description copied from interface: iCamera
Get the current sector.

Specified by:
getSector in interface iCamera
Returns:
See Also:
iCamera.getSector()

getShiftX

public float getShiftX()
Description copied from interface: iCamera
Get the X shift amount.
The parameter specified the desired X coordinate on screen of the projection center of the camera.

Specified by:
getShiftX in interface iCamera
Returns:
See Also:
iCamera.getShiftX()

getShiftY

public float getShiftY()
Description copied from interface: iCamera
Get the Y shift amount.
The parameter specified the desired Y coordinate on screen of the projection center of the camera.

Specified by:
getShiftY in interface iCamera
Returns:
See Also:
iCamera.getShiftY()

invPerspective

public void invPerspective(csVector2 p,
                           float z,
                           csVector3 v)
Description copied from interface: iCamera
Calculate inverse perspective corrected point for this camera.

Specified by:
invPerspective in interface iCamera
Parameters:
p -
z -
v -
See Also:
iCamera.invPerspective(crystalspace.jbind.impl.csgeom.vector2.csVector2, float, crystalspace.jbind.impl.csgeom.vector3.csVector3)

isMirrored

public boolean isMirrored()
Description copied from interface: iCamera
Return true if space is mirrored.

Specified by:
isMirrored in interface iCamera
Returns:
See Also:
iCamera.isMirrored()

move

public void move(csVector3 v,
                 boolean cd)
Description copied from interface: iCamera
Moves the camera a relative amount in camera coordinates.

Specified by:
move in interface iCamera
Parameters:
v -
cd -
See Also:
iCamera.move(crystalspace.jbind.impl.csgeom.vector3.csVector3, boolean)

move

public void move(csVector3 v)
Description copied from interface: iCamera
Moves the camera a relative amount in camera coordinates.

Specified by:
move in interface iCamera
Parameters:
v -
See Also:
iCamera.move(crystalspace.jbind.impl.csgeom.vector3.csVector3)

moveUnrestricted

public void moveUnrestricted(csVector3 v)
Description copied from interface: iCamera
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.

Specified by:
moveUnrestricted in interface iCamera
Parameters:
v -
See Also:
iCamera.moveUnrestricted(crystalspace.jbind.impl.csgeom.vector3.csVector3)

moveWorld

public void moveWorld(csVector3 v,
                      boolean cd)
Description copied from interface: iCamera
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).

Specified by:
moveWorld in interface iCamera
Parameters:
v -
cd -
See Also:
iCamera.moveWorld(crystalspace.jbind.impl.csgeom.vector3.csVector3, boolean)

moveWorld

public void moveWorld(csVector3 v)
Description copied from interface: iCamera
Moves the camera a relative amount in world coordinates.

Specified by:
moveWorld in interface iCamera
Parameters:
v -
See Also:
iCamera.moveWorld(crystalspace.jbind.impl.csgeom.vector3.csVector3)

moveWorldUnrestricted

public void moveWorldUnrestricted(csVector3 v)
Description copied from interface: iCamera
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.

Specified by:
moveWorldUnrestricted in interface iCamera
Parameters:
v -
See Also:
iCamera.moveWorldUnrestricted(crystalspace.jbind.impl.csgeom.vector3.csVector3)

onlyPortals

public void onlyPortals(boolean hop)
Description copied from interface: iCamera
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.

Specified by:
onlyPortals in interface iCamera
Parameters:
hop -
See Also:
iCamera.onlyPortals(boolean)

perspective

public void perspective(csVector3 v,
                        csVector2 p)
Description copied from interface: iCamera
Calculate perspective corrected point for this camera.

Specified by:
perspective in interface iCamera
Parameters:
v -
p -
See Also:
iCamera.perspective(crystalspace.jbind.impl.csgeom.vector3.csVector3, crystalspace.jbind.impl.csgeom.vector2.csVector2)

setFarPlane

public void setFarPlane(csPlane3 fp)
Description copied from interface: iCamera
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).

Specified by:
setFarPlane in interface iCamera
Parameters:
fp -
See Also:
iCamera.setFarPlane(crystalspace.jbind.impl.csgeom.plane3.csPlane3)

setFOV

public void setFOV(int fov,
                   int width)
Description copied from interface: iCamera
Set the FOV in pixels.
'fov' is the desired FOV in pixels. 'width' is the display width, also in pixels.

Specified by:
setFOV in interface iCamera
Parameters:
fov -
width -
See Also:
iCamera.setFOV(int, int)

setFOVAngle

public void setFOVAngle(float fov,
                        int width)
Description copied from interface: iCamera
Set the FOV in radians.
'fov' is the desired FOV in degrees. 'width' is the display width in pixels.

Specified by:
setFOVAngle in interface iCamera
Parameters:
fov -
width -
See Also:
iCamera.setFOVAngle(float, int)

setMirrored

public void setMirrored(boolean m)
Description copied from interface: iCamera
Set mirrored state.

Specified by:
setMirrored in interface iCamera
Parameters:
m -
See Also:
iCamera.setMirrored(boolean)

setPerspectiveCenter

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

Specified by:
setPerspectiveCenter in interface iCamera
Parameters:
x -
y -
See Also:
iCamera.setPerspectiveCenter(float, float)

setTransform

public void setTransform(csOrthoTransform tr)
Description copied from interface: iCamera
Set the transform corresponding to this camera.
In this transform, 'other' is world space and 'this' is camera space.

Specified by:
setTransform in interface iCamera
Parameters:
tr -
See Also:
iCamera.setTransform(crystalspace.jbind.impl.csgeom.transfrm.csOrthoTransform)