|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.rico.engine.camera.Camera
public class Camera
This class represents a camera and is making use of the sigleton design pattern. There can be only one camera object in the application, but that camera object can have several camera perspectives.
Field Summary | |
---|---|
static float |
NORMAL_FOV
Normal field of view (viewing angle) |
static float |
SENSITIVITY
Normal (mouse-)rotation sensitivity factor |
Method Summary | |
---|---|
void |
addCameraPerspective(CameraPerspective setting,
int id)
Adds a camera perspective (identified by the id) to the camera. |
void |
addCameraPerspectives(java.util.LinkedHashMap<java.lang.Integer,CameraPerspective> perspectives)
Adds a map of camera perspectives to the camera. |
void |
apply(javax.media.opengl.GL gl)
Applies the camera transformations to the scene. |
void |
clearCameraPerspectives()
Removes all the camera perspectives from this camera. |
float |
getAspectRatio()
Returns the current aspect ratio of the camera (as used in gluPerspective()-method) |
CameraPerspective |
getCameraPerspective(int id)
Returns the camera perspective with the specified id, if available, else null |
java.util.LinkedList<java.lang.Integer> |
getCameraPerspectiveIds()
Returns a list with ids of the camera perspectives. |
CameraPerspective |
getCurrentCamPerspective()
Returns the current camera perspective object |
int |
getCurrentCamPerspectiveId()
Returns the id of the current camera perspective. |
float |
getFieldOfView()
Returns the field of view (viewing angle) of the camera (as used in gluPerspective()-method) |
ViewingFrustum |
getFrustum()
Returns the viewing frustum couppled to the camera |
static Camera |
getInstance()
Returns the only camera instance according to the singleton design pattern. |
Point3D |
getPosition()
Returns the position of the camera (as a copy) |
Point3D |
getRightVector()
Returns the right vector from the camera. |
float |
getRotX()
Returns the rotation angle of the current camera perspective around the x-axis. |
float |
getRotY()
Returns the rotation angle around the y-axis of the current camera perspective. |
float |
getSensitivity()
Returns the current sensitivity factor (mouse-)rotations of the camera. |
Point3D |
getUpVector()
Returns the up vector of the camera. |
CameraViewPort |
getViewPort()
Returns the viewport of this camera |
Point3D |
getViewVector()
Returns the view vector of the camera. |
void |
init(CameraPerspective perspec,
CameraViewPort viewport)
Initializes the camera. |
void |
moveBackward(float dz)
Moves the camera into backward direction along the z-axis. |
void |
moveBackward(float dz,
long elapsedTime)
Moves the camera into backward direction along the z-axis in a framerate independent way. |
void |
moveDown(float dy)
Moves the camera into down direction along the y-axis. |
void |
moveDown(float dy,
long elapsedTime)
Moves the camera into down direction along the y-axis in a framerate independent way. |
void |
moveForeward(float dz)
Moves the camera into foreward direction along the z-axis. |
void |
moveForeward(float dz,
long elapsedTime)
Moves the camera into foreward direction along the z-axis in a framerate independent way. |
void |
moveLeft(float dx)
Moves the camera to the left along the x-axis. |
void |
moveLeft(float dx,
long elapsedTime)
Moves the camera to the left along the x-axis in a framerate independent way. |
void |
moveRight(float dx)
Moves the camera to the right along the x-axis. |
void |
moveRight(float dx,
long elapsedTime)
Moves the camera left along the x-axis in a framerate independent way. |
void |
moveUp(float dy)
Moves the camera into up direction along the y-axis. |
void |
moveUp(float dy,
long elapsedTime)
Moves the camera into up direction along the y-axis in a framerate independent way. |
void |
removeCameraPerspective(int id)
Remove the camera perspective that is refered to by the specified id. |
void |
rotateDown(float rot)
Rotates the camera down around the x-axis. |
void |
rotateLeft(float rot)
Rotates the camera to the left around the y-axis. |
void |
rotateRight(float rot)
Rotates the camera to the right around the y-axis. |
void |
rotateUp(float rot)
Rotates the camera up around the x-axis. |
void |
setAspectRatio(float ratio)
Sets the window's aspect ratio |
void |
setAttachedToLight(PositionalLightIface light)
Attaches a light object to the camera that implements the PositionalLightIface interface. |
void |
setCameraViewPort(CameraViewPort viewport)
Sets the viewport of the camera to the specified viewport. |
void |
setFieldOfView(float angle)
Sets the field of view (viewing angle) of the camera to the specified value. |
void |
setPosition(Point3D pos)
Sets the position of the camera (current perspective) |
void |
setRotX(float angleX)
Sets the x-axis rotation angle of the current camera perspective to the specified value. |
void |
setRotY(float angleY)
Sets the y-axis rotation angle of the current camera perspective to the specified value. |
void |
setSensitivity(float sensi)
Sets the sensitivity factor for the (mouse-)rotations of the camera. |
void |
setToCameraPerspective(int id)
Sets which camera perspective shall be enabled |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float NORMAL_FOV
public static final float SENSITIVITY
Method Detail |
---|
public static Camera getInstance()
public void init(CameraPerspective perspec, CameraViewPort viewport)
perspec
- initial camera perspectiveviewport
- the viewport to use with the camerapublic void addCameraPerspective(CameraPerspective setting, int id)
setting
- further camera settingid
- id for identifying the camera perspectivepublic void addCameraPerspectives(java.util.LinkedHashMap<java.lang.Integer,CameraPerspective> perspectives)
perspectives
- map of camera perspectivespublic void clearCameraPerspectives()
public void removeCameraPerspective(int id)
id
- id of the camera perspective to removepublic java.util.LinkedList<java.lang.Integer> getCameraPerspectiveIds()
public void setToCameraPerspective(int id)
id
- id of the camera perspectve to enable, 0 is the original base
camera perspective.public int getCurrentCamPerspectiveId()
public CameraPerspective getCurrentCamPerspective()
public CameraPerspective getCameraPerspective(int id)
null
id
- id of the camera perspective
public void apply(javax.media.opengl.GL gl)
gl
- public void rotateUp(float rot)
rot
- degree of rotationpublic void rotateDown(float rot)
rot
- degree of rotationpublic void rotateLeft(float rot)
rot
- degree of rotationpublic void rotateRight(float rot)
rot
- degree of rotationpublic void moveForeward(float dz)
dz
parameter by the elapsed
time between two frames before passing it over to the method or just call
the overloaded method method with the elapsedTime
parameter.
dz
- change in z directionpublic void moveForeward(float dz, long elapsedTime)
dz
- change in z directionelapsedTime
- time between two framespublic void moveBackward(float dz)
dz
parameter by the elapsed
time between two frames before passing it over to the method or just call
the overloaded method method with the elapsedTime
parameter.
dz
- change in z directionpublic void moveBackward(float dz, long elapsedTime)
dz
- change in z directionelapsedTime
- time between two framespublic void moveLeft(float dx)
dx
parameter by the elapsed
time between two frames before passing it over to the method or just call
the overloaded method method with the elapsedTime
parameter.
dx
- change in x directionpublic void moveLeft(float dx, long elapsedTime)
dx
- change in x directionelapsedTime
- time between two framespublic void moveRight(float dx)
dx
parameter by the elapsed
time between two frames before passing it over to the method or just call
the overloaded method method with the elapsedTime
parameter.
dx
- change in x directionpublic void moveRight(float dx, long elapsedTime)
dx
- change in x directionelapsedTime
- time between two framespublic void moveUp(float dy)
dy
parameter by the elapsed
time between two frames before passing it over to the method or just call
the overloaded method method with the elapsedTime
parameter.
dy
- change in y directionpublic void moveUp(float dy, long elapsedTime)
dy
- change in y directionelapsedTime
- time between two framespublic void moveDown(float dy)
dy
parameter by the elapsed
time between two frames before passing it over to the method or just call
the overloaded method method with the elapsedTime
parameter.
dy
- change in y directionpublic void moveDown(float dy, long elapsedTime)
dy
- change in y directionelapsedTime
- time between two framespublic float getRotX()
public void setRotX(float angleX)
angleX
- new x-axis rotation anglepublic float getRotY()
public void setRotY(float angleY)
angleY
- new y-axis rotation anglepublic void setSensitivity(float sensi)
sensi
- sensitivity factor for (mouse-)rotationspublic float getSensitivity()
public Point3D getPosition()
public void setPosition(Point3D pos)
pos
- position to the the camera topublic void setAttachedToLight(PositionalLightIface light)
light
- positional light to attach (must have implemented the
PositionalLightIface interface)public void setAspectRatio(float ratio)
ratio
- window aspect ration to use for the camerapublic CameraViewPort getViewPort()
public void setCameraViewPort(CameraViewPort viewport)
viewport
- new viewport for the camerapublic ViewingFrustum getFrustum()
public float getAspectRatio()
public float getFieldOfView()
public void setFieldOfView(float angle)
angle
- field of view (viewing angle) for the camerapublic Point3D getViewVector()
public Point3D getUpVector()
public Point3D getRightVector()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |