

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object com.threed.jpct.BufferedMatrix com.threed.jpct.Camera
The Camera represents the position and direction of the camera/viewer in the current scene. It also contains information about the current field of view (FOV). This class extends BufferedMatrix, so the methods for rotating the camera can be found there. One should keep in mind that the rotation matrix of the camera is actually a rotation matrix which will be aplied to all objects in the world. This is important when chosing the rotation angle for the camera: A (virtual) rotation of the camera around an axis using the angle w leads to the same results as if the world would rotate around this axis using w. So the angle given to the rotate?()methods is actually the angle by which the world rotates around the camera when the camera is viewed as static. If you dislike this behaviour, you may use the rotateCamera?()methods instead which will take care of it.
Field Summary  
static int 
CAMERA_DONT_MOVE
Don't move the camera before checking for a collision. 
static int 
CAMERA_MOVEDOWN
Move the camera down (relative to its current direction) 
static int 
CAMERA_MOVEIN
Move the camera forward (relative to its current direction) 
static int 
CAMERA_MOVELEFT
Move the camera left (relative to its current direction) 
static int 
CAMERA_MOVEOUT
Move the camera backwards (relative to its current direction) 
static int 
CAMERA_MOVERIGHT
Move the camera right (relative to its current direction) 
static int 
CAMERA_MOVEUP
Move the camera up (relative to its current direction) 
static boolean 
DONT_SLIDE
Camera stops in front of obstacles 
static int 
ELLIPSOID_ALIGNED
The camera's ellipsoid won't be transformed when performing collision detection (default). 
static int 
ELLIPSOID_TRANSFORMED
The camera's ellipsoid will be transformed when performing collision detection. 
static boolean 
SLIDE
Camera slides along obstacles. 
Constructor Summary  
Camera()
Creates a new Camera with default viewing direction (along the zaxis) and position (at the origin) as well as default FOV (as configured, 1.25 is default). 
Method Summary  
void 
adjustFovToNearPlane()
Adjusts the fov so that a changed near plane doesn't cause a zoomin/zoomout effect. 
void 
align(Object3D object)
Aligns the camera with the (transformed) positive zaxis of an Object3D. 
float 
convertDEGAngleIntoFOV(float angle)
Converts an angle in degrees into a FOV value that jPCT can handle. 
float 
convertRADAngleIntoFOV(float angle)
Converts an angle in radians into a FOV value that jPCT can handle (=2*tan(angle/2)). 
void 
decreaseFOV(float dec)
Decreases the FOV. 
Matrix 
getBillBoardMatrix()
Returns the bill board matrix or null if none has been set. 
SimpleVector 
getDirection()
Returns the direction vector of the camera in world space. 
SimpleVector 
getDirection(SimpleVector toFill)
Returns the direction vector of the camera in world space and fills the given SimpleVector with the result. 
int 
getEllipsoidMode()
Returns the current ellipsoid mode. 
float 
getFarClippingPlane()
Returns the far clipping plane. 
float 
getFOV()
Returns the FOV. 
float 
getFrustumOffsetX()
Returns the current frustum offset in xdirection. 
float 
getFrustumOffsetY()
Returns the current frustum offset in ydirection. 
float 
getMaxFOV()
Gets the highest possible FOV. 
float 
getMinFOV()
Gets the lowest possible FOV. 
float 
getNearClippingPlane()
Returns the near clipping plane. 
SimpleVector 
getPosition()
Gets the current position of the camera. 
SimpleVector 
getPosition(SimpleVector toFill)
Gets the current position of the camera and fill the given SimpleVector with the result. 
Matrix 
getProjectionMatrix(FrameBuffer buffer)
Returns the projection matrix. 
Matrix 
getProjectionMatrix(FrameBuffer buffer,
float nearPlane,
float farPlane)
Returns the projection matrix with arbitrary values for near and far clipping plane. 
SimpleVector 
getSideVector()
Returns the side vector of the camera in world space. 
SimpleVector 
getUpVector()
Returns the up vector of the camera in world space. 
SimpleVector 
getXAxis()
Returns the (virtual) xaxis of the camera. 
SimpleVector 
getYAxis()
Returns the (virtual) yaxis of the camera. 
float 
getYFOV()
Returns the fov in ydirection. 
SimpleVector 
getZAxis()
Returns the (virtual) zaxis of the camera. 
void 
increaseFOV(float inc)
Increases the FOV. 
void 
lookAt(SimpleVector lookAt)
Rotates the camera so that is looks at the given position in worldspace. 
void 
moveCamera(int mode,
float speed)
Moves (translates) the camera with a given speed into "mode" direction relative to its current direction. 
void 
moveCamera(SimpleVector direction,
float speed)
Moves (translates) the camera with a given speed in an arbitrary direction (should be a normalized vector). 
void 
rotateCameraAxis(SimpleVector axis,
float angle)
Rotates the camera around an arbitrary axis. 
void 
rotateCameraX(float angle)
Rotates the camera around the xaxis. 
void 
rotateCameraY(float angle)
Rotates the camera around the yaxis. 
void 
rotateCameraZ(float angle)
Rotates the camera around the zaxis. 
void 
setBillBoardMatrix(Matrix billBoardMatrix)
Sets a special matrix used for the bill board calculations. 
void 
setClippingPlanes(float near,
float far)
If set, this overrides the settings in Config for the near and the far clipping plane for this world. 
void 
setEllipsoidMode(int mode)
When doing ellipsoid collision detection with a camera, the ellipsoid can be transformed according to the camera's transformation in camera space or it remains static in object space (i.e. 
void 
setFOV(float tanFOV)
Sets the FOV (within the limits set by setFOVLimits). 
void 
setFovAngle(float radians)
An alternative to setFOV, which works directly with the angle. 
void 
setFOVLimits(float lower,
float higher)
Sets the limits for FOV jPCT should permit. 
void 
setFOVtoDefault()
Resets the FOV to the default value configured in Config. 
void 
setFrustumOffset(float frustumOffsetX,
float frustumOffsetY)
Sets relative offsetss to view frustum in x and ydirection. 
void 
setOrientation(SimpleVector dir,
SimpleVector up)
Sets the orientation of the camera by giving a direction and an upvector. 
void 
setPosition(float x,
float y,
float z)
Sets the camera to a position in worldspace. 
void 
setPosition(SimpleVector pos)
Sets the camera to a position in worldspace. 
void 
setPositionToCenter(Object3D object)
Sets the camera to the position of the transformed center of an Object3D. 
void 
setYFOV(float tanFOV)
Sets the FOV in ydirection (within the limits set by setFOVLimits). 
void 
setYFovAngle(float radians)
An alternative to setYFOV, which works directly with the angle. 
SimpleVector 
transform(SimpleVector vertex)
Transforms a vertex from world into camera space. 
SimpleVector 
transform(SimpleVector vertex,
SimpleVector toFill)
Transforms a vertex from world into camera space. 
Methods inherited from class com.threed.jpct.BufferedMatrix 
copyBackToFront, getBack, getFront, matMul, rotateAxis, rotateX, rotateY, rotateZ, setBack 
Methods inherited from class java.lang.Object 
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 
public static final int CAMERA_MOVEIN
public static final int CAMERA_MOVEOUT
public static final int CAMERA_MOVEDOWN
public static final int CAMERA_MOVEUP
public static final int CAMERA_MOVELEFT
public static final int CAMERA_MOVERIGHT
public static final int CAMERA_DONT_MOVE
public static final boolean SLIDE
public static final boolean DONT_SLIDE
public static final int ELLIPSOID_ALIGNED
public static final int ELLIPSOID_TRANSFORMED
Constructor Detail 
public Camera()
Method Detail 
public SimpleVector getPosition()
public SimpleVector getPosition(SimpleVector toFill)
toFill
 the vector that should contain the position
public SimpleVector getXAxis()
public SimpleVector getYAxis()
public SimpleVector getZAxis()
public SimpleVector getDirection()
public SimpleVector getDirection(SimpleVector toFill)
toFill
 the vector that should contain the position
public SimpleVector getUpVector()
public SimpleVector getSideVector()
public float convertRADAngleIntoFOV(float angle)
angle
 the angle in radians
public float convertDEGAngleIntoFOV(float angle)
angle
 the angle in degrees
public void setFOVLimits(float lower, float higher)
lower
 the lowest possible FOV (default is 0.5)higher
 the highest possible FOV (default is 1.5)public float getMaxFOV()
public float getMinFOV()
public void setFOV(float tanFOV)
tanFOV
 the FOV (default is 1.25).setFOVLimits(float,float)
public void setFovAngle(float radians)
radians
 the fov angle (between 0 and PI/2)public void setYFOV(float tanFOV)
tanFOV
 the yFOV (default is 1, which means that its derived from
the xFOV)setFOVLimits(float,float)
public void setYFovAngle(float radians)
radians
 the fov angle (between 0 and PI/2)public float getFOV()
public float getYFOV()
public void adjustFovToNearPlane()
public void increaseFOV(float inc)
inc
 the amount by which FOV should be increasedpublic void decreaseFOV(float dec)
dec
 the amount by which FOV should be decreasedpublic void setFOVtoDefault()
Config.defaultCameraFOV
public void lookAt(SimpleVector lookAt)
lookAt
 the position vector to look atpublic void align(Object3D object)
object
 the object the camera should be aligned withpublic void setPositionToCenter(Object3D object)
object
 the objectpublic void setPosition(SimpleVector pos)
pos
 the position vectorpublic void setPosition(float x, float y, float z)
x
 the x component of the position vectory
 the y component of the position vectorz
 the z component of the position vectorpublic void setOrientation(SimpleVector dir, SimpleVector up)
dir
 the directionup
 the upvectorpublic SimpleVector transform(SimpleVector vertex)
vertex
 the vertex in world space
public SimpleVector transform(SimpleVector vertex, SimpleVector toFill)
vertex
 the vertex in world spacetoFill
 the vertex to fill with the result. This will be returned as
well.
public void moveCamera(int mode, float speed)
mode
 the directionspeed
 the speed (positional change in units)CAMERA_MOVEDOWN
,
CAMERA_MOVEUP
,
CAMERA_MOVEIN
,
CAMERA_MOVEOUT
,
CAMERA_MOVELEFT
,
CAMERA_MOVERIGHT
public void moveCamera(SimpleVector direction, float speed)
direction
 the directionspeed
 the speed (positional change in units)public void rotateCameraAxis(SimpleVector axis, float angle)
axis
 a directionvector pointing into the axis directionangle
 the angle of the rotationpublic void rotateCameraX(float angle)
angle
 the anglepublic void rotateCameraY(float angle)
angle
 the anglepublic void rotateCameraZ(float angle)
angle
 the anglepublic void setEllipsoidMode(int mode)
mode
 int the modeELLIPSOID_ALIGNED
,
ELLIPSOID_TRANSFORMED
public int getEllipsoidMode()
ELLIPSOID_ALIGNED
,
ELLIPSOID_TRANSFORMED
public Matrix getProjectionMatrix(FrameBuffer buffer)
buffer
 the framebuffer
public Matrix getProjectionMatrix(FrameBuffer buffer, float nearPlane, float farPlane)
buffer
 the framebuffernearPlane
 the near planefarPlane
 the far plane
public void setClippingPlanes(float near, float far)
near
 the near planefar
 the far planeConfig.farPlane
,
Config.nearPlane
public float getNearClippingPlane()
public float getFarClippingPlane()
public void setBillBoardMatrix(Matrix billBoardMatrix)
billBoardMatrix
 the new matrix, set it to null to erase it.public Matrix getBillBoardMatrix()
public void setFrustumOffset(float frustumOffsetX, float frustumOffsetY)
frustumOffsetX
 the new frustum offset in xdirectionfrustumOffsetY
 the new frustum offset in ydirectionpublic float getFrustumOffsetX()
public float getFrustumOffsetY()


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 