|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.threed.jpct.Camera
public class Camera
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 z-axis) 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 zoom-in/zoom-out effect. |
void |
align(Object3D object)
Aligns the camera with the (transformed) positive z-axis 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 |
getBack()
Returns the Matrix that is used as the backbuffer matrix. |
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 x-direction. |
float |
getFrustumOffsetY()
Returns the current frustum offset in y-direction. |
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 fills 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) x-axis of the camera. |
SimpleVector |
getYAxis()
Returns the (virtual) y-axis of the camera. |
float |
getYFOV()
Returns the fov in y-direction. |
SimpleVector |
getZAxis()
Returns the (virtual) z-axis 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 world-space. |
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 |
rotateAxis(SimpleVector axis,
float angle)
Rotates the backbuffer matrix around an arbitrary axis. |
void |
rotateCameraAxis(SimpleVector axis,
float angle)
Rotates the camera around an arbitrary axis. |
void |
rotateCameraX(float angle)
Rotates the camera around the x-axis. |
void |
rotateCameraY(float angle)
Rotates the camera around the y-axis. |
void |
rotateCameraZ(float angle)
Rotates the camera around the z-axis. |
void |
rotateX(float angle)
Rotates the camera around the x-axis. |
void |
rotateY(float angle)
Rotates the camera around the y-axis. |
void |
rotateZ(float angle)
Rotates the camera around the z-axis. |
void |
setBack(Matrix mat)
Sets the backbuffer matrix. |
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 y-direction. |
void |
setOrientation(SimpleVector dir,
SimpleVector up)
Sets the orientation of the camera by giving a direction and an up-vector. |
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 y-direction (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 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 y-FOV (default is -1, which means that its derived from
the x-FOV)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 up-vectorpublic 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 direction-vector 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 rotateAxis(SimpleVector axis, float angle)
axis
- a direction-vector pointing into the axis directionangle
- the angle of the rotationpublic void rotateX(float angle)
angle
- the anglepublic void rotateY(float angle)
angle
- the anglepublic void rotateZ(float angle)
angle
- the anglepublic Matrix getBack()
public void setBack(Matrix mat)
mat
- the new backbuffer matrixpublic 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 setFrustumOffset(float frustumOffsetX, float frustumOffsetY)
frustumOffsetX
- the new frustum offset in x-directionfrustumOffsetY
- the new frustum offset in y-directionpublic float getFrustumOffsetX()
public float getFrustumOffsetY()
public void setClippingPlanes(float near, float far)
near
- the near planefar
- the far planeConfig.farPlane
,
Config.nearPlane
public float getNearClippingPlane()
public float getFarClippingPlane()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |