|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object glapp.GLCamera
public class GLCamera
Camera class by Philipp Crocoll at CodeColony (codecolony.de). Ported from C++ to Java by mark napier (potatoland.org). Can move camera position forward/back, pan left/right, shift up/down, and rotate around X, Y, Z axes. Uses gluLookat() to orient scene to camera position. See Camera.render(). To use: renderScene() { GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); camera.Render(); // render scene ... } Requires GL_Vector to perform vector operations. jul13,2006: added move(x,y,z). added ctor(pos,dir,up).
Field Summary | |
---|---|
GL_Vector |
Position
|
GL_Vector |
RightVector
|
float |
RotatedX
|
float |
RotatedY
|
float |
RotatedZ
|
GL_Vector |
UpVector
|
GL_Vector |
ViewDir
|
Constructor Summary | |
---|---|
GLCamera()
|
|
GLCamera(float posx,
float posy,
float posz,
float dirx,
float diry,
float dirz,
float upx,
float upy,
float upz)
|
Method Summary | |
---|---|
GL_Vector |
getViewDir()
Return the current camera view direction |
void |
Move(float x,
float y,
float z)
Move camera position in the given direction |
void |
Move(GL_Vector Direction)
Move camera position in the given direction |
void |
MoveForward(float Distance)
|
void |
MoveTo(float x,
float y,
float z)
Move camera to the given xyz |
void |
MoveUpward(float Distance)
|
void |
Render()
Call GLU.gluLookAt() to set view position, direction and orientation. |
void |
RotateV(float Angle)
Rotate the camera around the absolute vertical axis (0,1,0), NOT around the cameras Y axis. |
void |
RotateX(float Angle)
|
void |
RotateY(float Angle)
|
void |
RotateZ(float Angle)
|
void |
setCamera(float targetX,
float targetY,
float targetZ,
float distance)
Set the camera to look at a target. |
void |
setCamera(float posx,
float posy,
float posz,
float dirx,
float diry,
float dirz,
float upx,
float upy,
float upz)
Set the camera position, view direction and up vector. |
void |
StrafeRight(float Distance)
|
void |
viewDir(GL_Vector direction)
Move camera position in the given direction |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public GL_Vector ViewDir
public GL_Vector RightVector
public GL_Vector UpVector
public GL_Vector Position
public float RotatedX
public float RotatedY
public float RotatedZ
Constructor Detail |
---|
public GLCamera()
public GLCamera(float posx, float posy, float posz, float dirx, float diry, float dirz, float upx, float upy, float upz)
Method Detail |
---|
public void setCamera(float posx, float posy, float posz, float dirx, float diry, float dirz, float upx, float upy, float upz)
posx
- Position of cameraposy
- posz
- dirx
- Direction camera is facingdiry
- dirz
- upx
- Up vectorupy
- upz
- public void setCamera(float targetX, float targetY, float targetZ, float distance)
targetX
- camera will face this XYZtargetY
- targetZ
- distance
- distance from targetpublic void viewDir(GL_Vector direction)
public void Move(GL_Vector Direction)
public void Move(float x, float y, float z)
public void MoveTo(float x, float y, float z)
public void RotateX(float Angle)
public void RotateY(float Angle)
public void RotateZ(float Angle)
public void RotateV(float Angle)
Angle
- the angle to rotate around the vertical axis in degreespublic void MoveForward(float Distance)
public void MoveUpward(float Distance)
public void StrafeRight(float Distance)
public void Render()
public GL_Vector getViewDir()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |