gestalt.render.plugin
Class Camera

java.lang.Object
  extended by gestalt.shape.AbstractDrawable
      extended by gestalt.render.plugin.Camera
All Implemented Interfaces:
Drawable, java.lang.Cloneable
Direct Known Subclasses:
JoglCamera, JoglOrthoSetup

public abstract class Camera
extends AbstractDrawable
implements java.lang.Cloneable


Field Summary
 int culling
          culling modes as found in 'Gestalt'.
 float farclipping
          distance of the far clipping plane.
 float fovy
          field of vision (Y) in degrees(!).
 Vector2f frustumoffset
          defines the percentage in which the frustum is offset from a simetric position.
 float nearclipping
          distance of the near clipping plane.
 
Constructor Summary
Camera()
           
 
Method Summary
 void add(Drawable theDrawable)
          this method is commonly used to store children of a drawable.
 java.lang.Object clone()
           
 Camera copy()
          returns a cloned instance of this camera.
like in set(Camera) plugins are not copied.
 void forward(float theSpeed)
          move the camera along its forward direction.
 float getDistanceToZeroPlane()
           
static float getDistanceToZeroPlane(float theFOVY, int theViewPortHeight)
           
 Vector3f getForward()
           
 Matrix3f getInversRotationMatrix()
           
 int getMode()
          get the camera rotation mode.
 Matrix3f getRotationMatrix()
           
 Vector3f getSide()
           
 Vector3f getUp()
           
 boolean isActive()
          returns whether the drawable is active.
 Vector3f lookat()
           
 float[] modelviewmatrix()
           
 java.util.Vector<CameraPlugin> plugins()
           
 Vector3f position()
           
 float[] projectionmatrix()
           
 void reset()
          reset the camera to some more or less meaningful values.
 void reset(DisplayCapabilities displaycapabilities)
          reset the camera to some more or less meaningful values.
 void reset(int theWidth, int theHeight)
          reset the camera to some more or less meaningful values.
 Vector3f rotation()
           
 void set(Camera theCamera)
          copies properties from one camera.
 void setActive(boolean theActive)
           
 void setLookAtRef(Vector3f theRef)
           
 void setMode(int theCameraMode)
          set the cameras rotation mode.
 void setPositionRef(Vector3f thePosition)
           
 void setRotationRef(Vector3f theRef)
           
 void setUpVectorRef(Vector3f theRef)
           
 void side(float theSpeed)
          move the camera along its side direction.
 java.lang.String toString()
           
 Vector3f toWorld(float theMouseX, float theMouseY)
           
 void up(float theSpeed)
          move the camera along its up direction.
 void updateRotationMatrix()
          the camera matrix needs to be updated after every modification of position or rotation.
 Vector3f upvector()
           
 Viewport viewport()
           
 
Methods inherited from class gestalt.shape.AbstractDrawable
getSortData, getSortValue, isSortable, setSortValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gestalt.render.Drawable
draw
 

Field Detail

frustumoffset

public Vector2f frustumoffset
defines the percentage in which the frustum is offset from a simetric position.


nearclipping

public float nearclipping
distance of the near clipping plane.


farclipping

public float farclipping
distance of the far clipping plane.


fovy

public float fovy
field of vision (Y) in degrees(!).


culling

public int culling
culling modes as found in 'Gestalt'. currently there are the following modes.
Gestalt.CAMERA_CULLING_BACKFACE
Gestalt.CAMERA_CULLING_FRONTFACE
Gestalt.CAMERA_CULLING_FRONT_AND_BACKFACE
Gestalt.CAMERA_CULLING_NONE

Constructor Detail

Camera

public Camera()
Method Detail

reset

public void reset(DisplayCapabilities displaycapabilities)
reset the camera to some more or less meaningful values.

Parameters:
displaycapabilities - DisplayCapabilities

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

copy

public Camera copy()
returns a cloned instance of this camera.
like in set(Camera) plugins are not copied.

Returns:
Camera

reset

public void reset(int theWidth,
                  int theHeight)
reset the camera to some more or less meaningful values.

Parameters:
theWidth - int
theHeight - int

reset

public void reset()
reset the camera to some more or less meaningful values.


set

public void set(Camera theCamera)
copies properties from one camera. note that the plugins are only copied by reference.
this is no deep copy.

Parameters:
theCamera - Camera

setMode

public void setMode(int theCameraMode)
set the cameras rotation mode. currently there are three modes.

Gestalt.CAMERA_MODE_LOOK_AT
the camera adjusts its rotation so that it looks at a point defined by the vector 'lookat'.
Gestalt.CAMERA_MODE_ROTATE_XYZ
the camera rotation is defined by a vector 'rotation' in the order X, Y and Z axis. note that this order profoundly matters.
Gestalt.CAMERA_MODE_ROTATION_AXIS
the camera rotation matrix is set directly by the client.

Parameters:
theCameraMode - int

getMode

public int getMode()
get the camera rotation mode.

Returns:
int

side

public void side(float theSpeed)
move the camera along its side direction.

Parameters:
theSpeed - float

up

public void up(float theSpeed)
move the camera along its up direction.

Parameters:
theSpeed - float

forward

public void forward(float theSpeed)
move the camera along its forward direction.

Parameters:
theSpeed - float

updateRotationMatrix

public void updateRotationMatrix()
the camera matrix needs to be updated after every modification of position or rotation. the obligation to do so is on client side: you. it makes sense to include an 'updateRotationMatrix()' method in every camera implementation so that the matrix gets updated at least every frame.


plugins

public java.util.Vector<CameraPlugin> plugins()

getForward

public Vector3f getForward()
Returns:
Vector3f

getUp

public Vector3f getUp()
Returns:
Vector3f

getSide

public Vector3f getSide()
Returns:
Vector3f

getRotationMatrix

public Matrix3f getRotationMatrix()
Returns:
Matrix3f

getInversRotationMatrix

public Matrix3f getInversRotationMatrix()
Returns:
Matrix3f

position

public Vector3f position()
Returns:
Vector3f

setPositionRef

public void setPositionRef(Vector3f thePosition)
Parameters:
thePosition - Vector3f

lookat

public Vector3f lookat()
Returns:
Vector3f

setLookAtRef

public void setLookAtRef(Vector3f theRef)
Parameters:
theLookAtRef - Vector3f

rotation

public Vector3f rotation()
Returns:
Vector3f

setRotationRef

public void setRotationRef(Vector3f theRef)
Parameters:
theRef - Vector3f

upvector

public Vector3f upvector()
Returns:
Vector3f

setUpVectorRef

public void setUpVectorRef(Vector3f theRef)
Parameters:
theRef - Vector3f

viewport

public Viewport viewport()
Returns:
Viewport

isActive

public boolean isActive()
Description copied from interface: Drawable
returns whether the drawable is active. it is commonly implemented so that the drawables 'draw' method will be ommitted if 'isActive' return false, although this behavior can vary depending on the implementation.

Specified by:
isActive in interface Drawable
Overrides:
isActive in class AbstractDrawable
Returns:
boolean

setActive

public void setActive(boolean theActive)
Parameters:
theActive - boolean

toWorld

public Vector3f toWorld(float theMouseX,
                        float theMouseY)
Parameters:
theMouseX - float
theMouseY - float
Returns:
Vector3f

getDistanceToZeroPlane

public float getDistanceToZeroPlane()

getDistanceToZeroPlane

public static float getDistanceToZeroPlane(float theFOVY,
                                           int theViewPortHeight)

add

public void add(Drawable theDrawable)
Description copied from interface: Drawable
this method is commonly used to store children of a drawable.

Specified by:
add in interface Drawable
Overrides:
add in class AbstractDrawable
Parameters:
theDrawable - Drawable

projectionmatrix

public float[] projectionmatrix()

modelviewmatrix

public float[] modelviewmatrix()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


processing library gestalt_p5 by Patrick Kochlik + Dennis Paul. (c) 2009