SGCamera
Class SGCamera

java.lang.Object
  extended by SGCamera.SGCamera
Direct Known Subclasses:
KeyMoveCam

public class SGCamera
extends java.lang.Object


Field Summary
 float aspect
           
static int DOLLY
           
 Tuple.Tuple3f forward
           
 float fov
          Field of view of the camera in radians
protected  float maxPhi
          upper bounds on camera angle
protected  float minPhi
           
static int MOUSELOOK
           
static int MOVE
           
static int ORBIT
           
protected  processing.core.PApplet parent
           
 float phi
           
 Tuple.Tuple3f pos
           
 float rho
           
 Tuple.Tuple3f right
           
 Tuple.Tuple3f target
           
 float theta
           
static int UNBOUND
           
 Tuple.Tuple3f up
           
static int WSAD
           
static int ZOOM
           
 
Constructor Summary
SGCamera(processing.core.PApplet parent, float cx, float cy, float cz, float tx, float ty, float tz)
          Creates the camera
SGCamera(processing.core.PApplet parent, float cx, float cy, float cz, float tx, float ty, float tz, float ux, float uy, float uz, int leftMouseMode, int rightMouseMode)
           
SGCamera(processing.core.PApplet parent, float cx, float cy, float cz, float tx, float ty, float tz, int leftMouseMode, int rightMouseMode)
          Create the camera and assign mouse behaviors.
 
Method Summary
 void dolly(float amt)
           
 void feed()
           
 void forward(float amt)
           
 int getKeyRegistered()
           
 Tuple.Tuple3f getPos()
           
 Tuple.Tuple3f getRay(float curX, float curY)
          Give the ray direction from the origin through the pixel on the camera view plane.
 void lookAt(float tx, float ty, float tz)
           
 void lookZ(float amt)
           
 void mouseEvent(java.awt.event.MouseEvent e)
          Handles mouseEvents.
 void render(float size)
           
 void right(float amt)
           
 void roll(float amt)
          This is broken, don't use it.
 void rotY(float rads)
           
 void setFOV(float fov)
          Set the camera FOV
 void setMouseMode(int mouseButton, int mode)
          Tell camera how to handle mouse drag input
 void setPosition(float x, float y, float z)
          Set the camera position
 void setTarget(float x, float y, float z)
          Set the camera position
 void setTheta(float theta)
           
 void setUpVector()
           
 void setUpVector(float ux, float uy, float uz)
           
 void setVerticalLimits(float minPhi, float maxPhi)
          Sets the vertical bounds of the camera's motion.
 void translate(float x, float y, float z)
           
 void zoom(float amt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNBOUND

public static final int UNBOUND
See Also:
Constant Field Values

ORBIT

public static final int ORBIT
See Also:
Constant Field Values

MOUSELOOK

public static final int MOUSELOOK
See Also:
Constant Field Values

ZOOM

public static final int ZOOM
See Also:
Constant Field Values

MOVE

public static final int MOVE
See Also:
Constant Field Values

WSAD

public static final int WSAD
See Also:
Constant Field Values

DOLLY

public static final int DOLLY
See Also:
Constant Field Values

pos

public Tuple.Tuple3f pos

target

public Tuple.Tuple3f target

up

public Tuple.Tuple3f up

right

public Tuple.Tuple3f right

forward

public Tuple.Tuple3f forward

rho

public float rho

phi

public float phi

theta

public float theta

maxPhi

protected float maxPhi
upper bounds on camera angle


minPhi

protected float minPhi

parent

protected processing.core.PApplet parent

fov

public float fov
Field of view of the camera in radians


aspect

public float aspect
Constructor Detail

SGCamera

public SGCamera(processing.core.PApplet parent,
                float cx,
                float cy,
                float cz,
                float tx,
                float ty,
                float tz)
Creates the camera

Parameters:
parent - the containing processing PApplet
cx - camera x position
cy - camera y position
cz - camera z position
tx - target x position
ty - target y position
tz - target z position

SGCamera

public SGCamera(processing.core.PApplet parent,
                float cx,
                float cy,
                float cz,
                float tx,
                float ty,
                float tz,
                int leftMouseMode,
                int rightMouseMode)
Create the camera and assign mouse behaviors.

Parameters:
parent - the containing processing PApplet
cx - camera x position
cy - camera y position
cz - camera z position
tx - target x position
ty - target y position
tz - target z position
leftMouseMode - Assigns mouse behaviour to the left button drag
rightMouseMode - Assigns mouse behaviour to the right button drag

SGCamera

public SGCamera(processing.core.PApplet parent,
                float cx,
                float cy,
                float cz,
                float tx,
                float ty,
                float tz,
                float ux,
                float uy,
                float uz,
                int leftMouseMode,
                int rightMouseMode)
Method Detail

getKeyRegistered

public int getKeyRegistered()

getPos

public Tuple.Tuple3f getPos()

setVerticalLimits

public void setVerticalLimits(float minPhi,
                              float maxPhi)
Sets the vertical bounds of the camera's motion.

Parameters:
minPhi -
maxPhi -

getRay

public Tuple.Tuple3f getRay(float curX,
                            float curY)
Give the ray direction from the origin through the pixel on the camera view plane.

Parameters:
curX - X pixel coordinate
curY - Y pixel coordinate
Returns:
Ray passing from the camera origin through the passed in screen pixel

setUpVector

public void setUpVector(float ux,
                        float uy,
                        float uz)

setUpVector

public void setUpVector()

roll

public void roll(float amt)
This is broken, don't use it.


setTarget

public void setTarget(float x,
                      float y,
                      float z)
Set the camera position


setPosition

public void setPosition(float x,
                        float y,
                        float z)
Set the camera position


setTheta

public void setTheta(float theta)

lookAt

public void lookAt(float tx,
                   float ty,
                   float tz)

feed

public void feed()

lookZ

public void lookZ(float amt)

rotY

public void rotY(float rads)

translate

public void translate(float x,
                      float y,
                      float z)

forward

public void forward(float amt)

right

public void right(float amt)

dolly

public void dolly(float amt)

zoom

public void zoom(float amt)

setFOV

public void setFOV(float fov)
Set the camera FOV

Parameters:
fov - desired camera FOV in radians

setMouseMode

public void setMouseMode(int mouseButton,
                         int mode)
Tell camera how to handle mouse drag input

Parameters:
mouseButton - which button to bind
mode - action to bind to button. Default is UNBOUND, or nothing.

mouseEvent

public void mouseEvent(java.awt.event.MouseEvent e)
Handles mouseEvents. Called by the parent applet automatically and should never be called by the user.

Parameters:
e -

render

public void render(float size)