|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjwo.landserf.gui3d.Camera
public class Camera
A 'camera' that can be moved within a 3D space. Allows different movement types such as hovering and flying. Camera has a 3d location, a direction of view, field of view and a speed. Note that all coordinates are in rendering space, usually around a volume with origin at (0,0,0) and dimensions of +-10.
| Constructor Summary | |
|---|---|
Camera()
Creates a new camera for transforming a 3d view. |
|
| Method Summary | |
|---|---|
void |
addCameraListener(CameraListener cameraListener)
Adds a camera listener to be informed when camera properties change. |
void |
changeView(float deltaX,
float deltaY)
Changes the camera view. |
void |
doRoute(float[][] routeCoords)
Moves the camera along the route defined by the given collection of coordinates. |
float |
getDistanceSq()
Reports the current squared distance from the origin. |
float |
getForwardSpeed()
Reports the current camera speed in direction of travel. |
float[] |
getForwardView()
Reports the 3d view direction vector. |
float |
getFOV()
Reports the camera field of view. |
float |
getHeading()
Reports the current heading of the camera. |
float |
getPitch()
Reports the current pitch of the camera. |
float[] |
getPosition()
Reports the current position of the camera. |
float |
getRotationStyle()
Reports the rotation style of the camera. |
void |
move(javax.media.opengl.GL gl,
javax.media.opengl.glu.GLU glu)
Calculates the new camera position based on movement type and speed. |
void |
raise(javax.media.opengl.GL gl,
float z)
Raises camera by a given amount. |
void |
removeCameraListener(CameraListener cameraListener)
Removes the given camera listener. |
void |
reset()
Sets the camera position, orientation, field of view and speed to their default values. |
void |
setAspectRatio(float aspectRatio)
Sets the aspect ratio of the camera view. |
void |
setForwardSpeed(float speed)
Sets a new camera speed in direction of travel. |
void |
setFOV(javax.media.opengl.GL gl,
javax.media.opengl.glu.GLU glu,
float fov)
Sets the camera's field of view. |
void |
setLateralSpeed(float speed)
Sets a new lateral camera speed (for rotation). |
void |
setLoop(boolean isLooping)
Allows a route to be looped if set to true. |
void |
setMoveCamera(boolean move)
Controls the changing camera view. |
void |
setMoveContinuously(boolean isMoving)
Controls whether the camera moves continuously or not. |
void |
setPosition(javax.media.opengl.GL gl,
javax.media.opengl.glu.GLU glu,
float x,
float y,
float z,
float heading,
float pitch,
float fov)
Explicitly sets the position and direction of the camera. |
void |
setRotationStyle(float bankingCoeff)
Sets the rotation style of the camera. |
void |
setVerticalDisplacement(float heightChange)
Sets the vertical displacement of the camera. |
void |
stopRoute()
Stops the replay of a route. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Camera()
| Method Detail |
|---|
public void reset()
public void move(javax.media.opengl.GL gl,
javax.media.opengl.glu.GLU glu)
gl - OpenGL pipeline.glu - OpenGL utilities pipeline.
public void changeView(float deltaX,
float deltaY)
deltaX - Controls the lateral speed if moving, or the amount of roll
and yaw if rotating. Typically controlled by a movement of mouse
or controller in the X-direction.deltaY - Controls the forward speed if moving, or the amount of
pitching. Typically controlled by a movement of mouse or controller
in the Y-direction.
public void setPosition(javax.media.opengl.GL gl,
javax.media.opengl.glu.GLU glu,
float x,
float y,
float z,
float heading,
float pitch,
float fov)
gl - OpenGL pipeline.glu - GL Utilities.x - X coordinate of camera position in rendering space.y - Y coordinate of camera position in rendering space.z - Elevation of camera position in rendering space.heading - Azimuthal direction of camera view in degrees clockwise from north.pitch - Pitch of camera view in degrees, where negative is down, 0 horizontal, positive up.fov - Field of view.
public void raise(javax.media.opengl.GL gl,
float z)
gl - OpenGL pipeline.z - Amount by which to raise camera (render coordinates).public void doRoute(float[][] routeCoords)
routeCoords - An array of route coordinates. Each row in the
array is an array holding {x,y,z,heading,pitch}. (x,y,z) are
in rendering coordinates, not geographic.public void setLoop(boolean isLooping)
isLooping - Route will be repeated if true.public void stopRoute()
public void addCameraListener(CameraListener cameraListener)
cameraListener - Class listening for camera changes.public void removeCameraListener(CameraListener cameraListener)
cameraListener - Camera listener to be removed.public float getFOV()
public void setAspectRatio(float aspectRatio)
aspectRatio - New aspect ratio.
public void setFOV(javax.media.opengl.GL gl,
javax.media.opengl.glu.GLU glu,
float fov)
gl - OpenGL pipeline.glu - GL Utilities.fov - New field of view.public float[] getPosition()
public float getDistanceSq()
public float[] getForwardView()
public float getPitch()
public float getHeading()
public void setForwardSpeed(float speed)
speed - New camera speed.public float getForwardSpeed()
public void setLateralSpeed(float speed)
speed - New camera speed.public void setMoveCamera(boolean move)
move - Camera will move if true, rotate if false.public void setVerticalDisplacement(float heightChange)
heightChange - Change in height in rendering coordinates.public void setMoveContinuously(boolean isMoving)
setMoveCamera() to allow flying cameras to move and
rotate simultaneously.
isMoving - Camera will move continuously if true.public void setRotationStyle(float bankingCoeff)
bankingCoeff - Controls amount and direction of banking with rotation.public float getRotationStyle()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||