|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimogl.camera.Camera
public class Camera
This class represents the camera. It is pretend to move the camera through the world, but actually the world is moved, when a method to move the camera is called. The camera always stays at the same position. By pressing the specified key, the camera can be switched into an orthographic viewing mode (2D mode).
Constructor Summary | |
---|---|
Camera(float x,
float y,
float z,
float heightOverGround,
float angle,
float near,
float far)
Creates a camera object. |
Method Summary | |
---|---|
float |
getAspectRatio()
Returns the current aspect ratio of the camera (as used in gluPerspective()-method) |
java.util.ArrayList<Triangle> |
getCollisionTrigs()
Returns the triangle(s) the camera is actually over |
float |
getFarPlane()
Returns the far plane of camera |
float |
getHeightOverGround()
Returns the height at that the camera hovers over the ground |
float |
getNearPlane()
Returns the near plane of the camera |
Point3D |
getPosition()
Returns the current position of the camera as a Point3D object. |
float |
getRotX()
Returns the x-rotation of the camera |
float |
getRotY()
Returns the y-rotation of the camera |
float |
getViewingAngle()
Returns the viewing angle of the camera (as used in gluPerspective()-method) |
boolean |
isInFreeLook()
Returns whether the 3D cam is in free look mode or attached to the ground. |
void |
moveBackward(float amount,
long elapsedTime)
Moves the cam backward by the specified amount |
void |
moveDown(float amount,
long elapsedTime)
Moves the cam down by the specified amount |
void |
moveForward(float amount,
long elapsedTime)
Moves the cam forward by the specified amount |
void |
moveLeft(float amount,
long elapsedTime)
Moves the cam left by the specified amount |
void |
moveRight(float amount,
long elapsedTime)
Moves the cam right by the specified amount |
void |
moveUp(float amount,
long elapsedTime)
Moves the cam up by the specified amount |
void |
rotateDown(float amount,
long elapsedTime)
Rotates the cam down by the specified degrees |
void |
rotateLeft(float amount,
long elapsedTime)
Rotates the cam left by the specified degrees |
void |
rotateRight(float amount,
long elapsedTime)
Rotates the cam right by the specified degrees |
void |
rotateUp(float amount,
long elapsedTime)
Rotates the cam up by the specified degrees |
void |
setCamPosition(float x,
float y,
float z)
Sets the position of the camera |
void |
setFarPlane(float far)
Sets the far plane of the camera to the specified value |
void |
SetHeightOverGround(float height)
|
void |
setMouseSensitivity(float sensitivity)
Sets the mouse sensitivity. |
void |
setNearPlane(float near)
Sets the near plane of the camera to the specified value |
void |
setViewingAngle(float angle)
Sets the viewing angle of the camera to the specified value. |
void |
setX(float x)
Sets the x-coordinate of the camera's position |
void |
setY(float y)
Sets the y-coordinate of the camera's position |
void |
setZ(float z)
Sets the z-coordinate of the camera's position |
void |
switchProjectionMode()
Switches camera from projection mode to ortho mode, or vice versa. |
void |
toggleFreeLook()
Switches the movement mode of the camera from planar to free look and vice versa. |
void |
use(javax.media.opengl.GL gl,
javax.media.opengl.glu.GLU glu,
float aspect)
Applies the camera with its current properties. |
void |
zoomIn2D(float amount)
Zooms the camera in by the specified amount, if in 2D camera mode |
void |
zoomOut2D(float amount)
Zooms the camera out by the specified amount, if in 2D camera mode |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Camera(float x, float y, float z, float heightOverGround, float angle, float near, float far)
x
- x-coordinatey
- y-coordinatez
- z-coordinateheightOverGround
- specifies the height at that the camera
ought to hover over the ground when not in free look modeangle
- the viewing angle of the camera (45f is a good value)near
- the near plane of the camerafar
- far plane of the cameraMethod Detail |
---|
public void setCamPosition(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic void setX(float x)
x
- x-coordinatepublic void setY(float y)
y
- y-coordinatepublic void setZ(float z)
z
- z-coordinatepublic Point3D getPosition()
public float getRotX()
public float getRotY()
public void use(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu, float aspect)
gl
- glu
- aspect
- apect ratio of the display windowpublic void setMouseSensitivity(float sensitivity)
sensitivity
- public void moveForward(float amount, long elapsedTime)
amount
- amount of movementelapsedTime
- time between two framespublic void moveBackward(float amount, long elapsedTime)
amount
- amount of movementeelapsedTime
- time between two framespublic void moveLeft(float amount, long elapsedTime)
amount
- amount of movementelapsedTime
- time between two framespublic void moveRight(float amount, long elapsedTime)
amount
- amount of movementelapsedTime
- time between two framespublic void moveUp(float amount, long elapsedTime)
amount
- amount of movementelapsedTime
- time between two framespublic void moveDown(float amount, long elapsedTime)
amount
- amount of movementelapsedTime
- time between two framespublic void rotateUp(float amount, long elapsedTime)
amount
- amount of movementelapsedTime
- time between two framespublic void rotateDown(float amount, long elapsedTime)
amount
- amount of movementelapsedTime
- time between two framespublic void rotateLeft(float amount, long elapsedTime)
amount
- amount of movementelapsedTime
- time between two framespublic void rotateRight(float amount, long elapsedTime)
amount
- amount of movementelapsedTime
- time between two framespublic void switchProjectionMode()
public void zoomIn2D(float amount)
amount
- amount of zoompublic void zoomOut2D(float amount)
amount
- amount of zoompublic void SetHeightOverGround(float height)
public float getHeightOverGround()
public float getFarPlane()
public void setFarPlane(float far)
far
- far plane of the camerapublic float getNearPlane()
public void setNearPlane(float near)
near
- near plane of the camerapublic float getAspectRatio()
public float getViewingAngle()
public void setViewingAngle(float angle)
angle
- viewing angle for the camerapublic void toggleFreeLook()
public boolean isInFreeLook()
public java.util.ArrayList<Triangle> getCollisionTrigs()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |