|
Flight Club |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--flightclub.framework3d.CameraMan
This class implements camera functionality such as cutting smoothly
between different camera subjects and mapping (x, y, z) onto the
screen (y_, z_)). The projection from (x, y, z) onto the screen
(y_, z_) is determined by two vectors, eye and
focus.
Using these two vectors we calculate the rotation and translation needed to position the eye on the (+ve) x_ axis looking towards the focus at origin_. Given a point (x, y, z) we translate it and apply the rotation to get (x_, y_, z_). We then scale the y_ and z_ by 1/x_ to complete the perspective projection by forshortening y_ and z_ according to their distance from the camera.
ModelViewer.createCameraMan(),
ModelCanvas.paintModel()| Field Summary | |
static int |
CUT_LEN
|
protected float |
depthOfVision
|
protected float |
LENS_ANGLE_INVERSE
This field tells us how far away from a 1 unit tall object must the camera be in order for it to fill the height of the screen. |
protected ModelViewer |
modelViewer
|
protected static float |
ZOOM_STEP
|
| Constructor Summary | |
CameraMan(ModelViewer modelViewer)
Creates a CameraMan. |
|
| Method Summary | |
float |
getDistance()
|
float[] |
getEye()
|
float[] |
getFocus()
|
float[][] |
getMatrix()
|
void |
init()
Sets the scale according to the canvas height. |
void |
pullIn()
Move eye closer to the focus. |
void |
pullOut()
Move eye further away from the focus. |
void |
rotate(float dtheta,
float dz)
Rotates the eye about the focus by dtheta (L/R) and moves the eye up or down by dz. |
void |
scaleToScreen(float[] v_)
Scales the y_ and z_ co-ords so a 1 unit tall tree fills the screen height when viewed from a distance of LENS_ANGLE_INVERSE away. |
void |
setSubject(CameraSubject cameraSubject,
boolean track)
Sets the camera subject. |
void |
setSubjectNow(CameraSubject cameraSubject,
boolean track)
Sets the camera subject. |
void |
tick()
Update camera position, only if we are mid cut or the subject is moving. |
java.lang.String |
toString()
Returns a string that may be handy for debugging. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected ModelViewer modelViewer
protected float depthOfVision
public static final int CUT_LEN
protected float LENS_ANGLE_INVERSE
protected static final float ZOOM_STEP
| Constructor Detail |
public CameraMan(ModelViewer modelViewer)
modelViewer - an instance of ModelViewer.| Method Detail |
public void init()
public void tick()
ModelViewer.tick(float, float)
public void setSubject(CameraSubject cameraSubject,
boolean track)
cameraSubject - the subject to film.track - if true then track the subject as it moves.
public void setSubjectNow(CameraSubject cameraSubject,
boolean track)
public float getDistance()
public float[][] getMatrix()
public float[] getFocus()
public float[] getEye()
public void rotate(float dtheta,
float dz)
public final void scaleToScreen(float[] v_)
Also translates y_ and z_ so that (x_, 0, 0) appears center screen.
Obj3d.transform()public void pullIn()
public void pullOut()
public java.lang.String toString()
toString in class java.lang.Object
|
Dan Burton <danb@dircon.co.uk> | latest update: 20 Sep 2002; | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||