|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Camera defines an interface that encapsulates viewport
management. Provided are convenience methods for setting up the view port and
the camera model. The frustum is also maintained here to allow for easy
frustum culling.
| Field Summary | |
static int |
INSIDE_FRUSTUM
defines a constant assigned to spatials that are completely inside the camera's view frustum. |
static int |
INTERSECTS_FRUSTUM
defines a constant assigned to spatials that are intersecting one of the six planes that define the view frustum. |
static int |
OUTSIDE_FRUSTUM
defines a constant assigned to spatials that are outside of this camera's view frustum. |
| Method Summary | |
int |
contains(BoundingVolume bound)
culled tests a bounding volume against the planes of the
camera's frustum. |
Vector3f |
getDirection()
getDirection returns the direction the camera is facing. |
float |
getFrustumBottom()
getFrustumBottom returns the value of the bottom frustum
plane. |
float |
getFrustumFar()
getFrustumFar gets the value of the far frustum plane. |
float |
getFrustumLeft()
getFrustumLeft gets the value of the left frustum plane. |
float |
getFrustumNear()
getFrustumNear gets the value of the near frustum plane. |
float |
getFrustumRight()
getFrustumRight gets the value of the right frustum plane. |
float |
getFrustumTop()
getFrustumTop gets the value of the top frustum plane. |
Vector3f |
getLeft()
getLeft returns the left axis of the camera. |
Vector3f |
getLocation()
getLocation returns the position of the camera. |
int |
getPlaneState()
getPlaneState returns the state of the frustum planes. |
Vector3f |
getUp()
getUp returns the up axis of the camera. |
float |
getViewPortBottom()
getViewPortBottom gets the bottom boundary of the viewport |
float |
getViewPortLeft()
getViewPortLeft gets the left boundary of the viewport |
float |
getViewPortRight()
getViewPortRight gets the right boundary of the viewport |
float |
getViewPortTop()
getViewPortTop gets the top boundary of the viewport |
void |
lookAt(Vector3f pos)
lookAt is a convienence method for auto-setting the frame. |
void |
onFrameChange()
onFrameChange is an update callback that is activated if
the frame changes. |
void |
onFrustumChange()
onFrustumChange is an update callback that is activated if
the frustum values change. |
void |
onViewPortChange()
onViewPortChange is an update callback that is activated
if the view port changes. |
void |
resize(int width,
int height)
resize resizes this cameras view with the given width/height. |
void |
setAxes(Quaternion axes)
setAxes sets the camera's orientation via a rotational
matrix. |
void |
setAxes(Vector3f left,
Vector3f up,
Vector3f direction)
setAxes sets the axes that define the camera's
orientation. |
void |
setDirection(Vector3f direction)
setDirection sets the direction the camera is facing. |
void |
setFrame(Vector3f location,
Quaternion axes)
setFrame sets the view frame of the camera by setting the
location and the orientation of the camera model. |
void |
setFrame(Vector3f location,
Vector3f left,
Vector3f up,
Vector3f direction)
setFrame sets the view frame of the camera by setting the
location and orientation of the camera model. |
void |
setFrustum(float near,
float far,
float left,
float right,
float top,
float bottom)
setFrustum defines the frustum planes of the camera. |
void |
setFrustumBottom(float frustumBottom)
setFrustumBottom sets the value of the bottom frustum
plane. |
void |
setFrustumFar(float frustumFar)
setFrustumFar sets the value of the far frustum plane. |
void |
setFrustumLeft(float frustumLeft)
setFrustumLeft sets the value of the left frustum plane. |
void |
setFrustumNear(float frustumNear)
setFrustumNear sets the value of the near frustum plane. |
void |
setFrustumPerspective(float fovY,
float aspect,
float near,
float far)
setFrustumPerspective defines the frustum for the camera. |
void |
setFrustumRight(float frustumRight)
setFrustumRight sets the value of the right frustum plane. |
void |
setFrustumTop(float frustumTop)
setFrustumTop sets the value of the top frustum plane. |
void |
setLeft(Vector3f left)
setLeft sets the left axis of the camera. |
void |
setLocation(Vector3f location)
setLocation the position of the camera. |
void |
setPlaneState(int planeState)
setPlaneState sets the state to keep track of tested
planes for culling. |
void |
setUp(Vector3f up)
setUp sets the up axis of the camera. |
void |
setViewPort(float left,
float right,
float bottom,
float top)
setViewPort sets the boundaries of the viewport |
void |
setViewPortBottom(float bottom)
setViewPortBottom sets the bottom boundary of the viewport |
void |
setViewPortLeft(float left)
setViewPortLeft sets the left boundary of the viewport |
void |
setViewPortRight(float right)
setViewPortRight sets the right boundary of the viewport |
void |
setViewPortTop(float top)
setViewPortTop sets the top boundary of the viewport |
void |
update()
update updates the frustum viewport and frame of the
camera checking for any possible change in the position or orientation of
the camera. |
| Field Detail |
public static final int OUTSIDE_FRUSTUM
public static final int INTERSECTS_FRUSTUM
public static final int INSIDE_FRUSTUM
| Method Detail |
public Vector3f getLocation()
getLocation returns the position of the camera.
public Vector3f getDirection()
getDirection returns the direction the camera is facing.
public Vector3f getLeft()
getLeft returns the left axis of the camera.
public Vector3f getUp()
getUp returns the up axis of the camera.
public void setLocation(Vector3f location)
setLocation the position of the camera.
location - the position of the camera.public void setDirection(Vector3f direction)
setDirection sets the direction the camera is facing.
direction - the new direction of the camera.public void setLeft(Vector3f left)
setLeft sets the left axis of the camera.
left - the new left axis of the camera.public void setUp(Vector3f up)
setUp sets the up axis of the camera.
up - the new up axis of the camera.
public void setAxes(Vector3f left,
Vector3f up,
Vector3f direction)
setAxes sets the axes that define the camera's
orientation.
left - the new left axis of the camera.up - the new up axis of the camera.direction - the new direction of the camera.public void setAxes(Quaternion axes)
setAxes sets the camera's orientation via a rotational
matrix.
axes - the matrix that defines the camera orientation.
public void setFrustum(float near,
float far,
float left,
float right,
float top,
float bottom)
setFrustum defines the frustum planes of the camera. This
frustum is defined by a six-sided box.
near - the frustum plane closest to the eye point.far - the frustum plane furthest from the eye point.left - the frustum plane left of the eye point.right - the frustum plane right of the eye point.top - the frustum plane above the eye point.bottom - the frustum plane below the eye point.
public void setFrustumPerspective(float fovY,
float aspect,
float near,
float far)
setFrustumPerspective defines the frustum for the camera. This
frustum is defined by a viewing angle, aspect ratio, and near/far planes
fovY - Frame of view angle along the Y.aspect - Width:Height rationear - Near view plane distancefar - Far view plane distancepublic float getFrustumBottom()
getFrustumBottom returns the value of the bottom frustum
plane.
public void setFrustumBottom(float frustumBottom)
setFrustumBottom sets the value of the bottom frustum
plane.
frustumBottom - the value of the bottom frustum plane.public float getFrustumFar()
getFrustumFar gets the value of the far frustum plane.
public void setFrustumFar(float frustumFar)
setFrustumFar sets the value of the far frustum plane.
frustumFar - the value of the far frustum plane.public float getFrustumLeft()
getFrustumLeft gets the value of the left frustum plane.
public void setFrustumLeft(float frustumLeft)
setFrustumLeft sets the value of the left frustum plane.
frustumLeft - the value of the left frustum plane.public float getFrustumNear()
getFrustumNear gets the value of the near frustum plane.
public void setFrustumNear(float frustumNear)
setFrustumNear sets the value of the near frustum plane.
frustumNear - the value of the near frustum plane.public float getFrustumRight()
getFrustumRight gets the value of the right frustum plane.
public void setFrustumRight(float frustumRight)
setFrustumRight sets the value of the right frustum plane.
frustumRight - the value of the right frustum plane.public float getFrustumTop()
getFrustumTop gets the value of the top frustum plane.
public void setFrustumTop(float frustumTop)
setFrustumTop sets the value of the top frustum plane.
frustumTop - the value of the top frustum plane.
public void setFrame(Vector3f location,
Vector3f left,
Vector3f up,
Vector3f direction)
setFrame sets the view frame of the camera by setting the
location and orientation of the camera model.
location - the position of the camera.left - the left axis of the camera.up - the up axis of the camera.direction - the direction the camera is facing.
public void setFrame(Vector3f location,
Quaternion axes)
setFrame sets the view frame of the camera by setting the
location and the orientation of the camera model.
location - the position of the camera.axes - the matrix that defines the orientation of the camera.public void update()
update updates the frustum viewport and frame of the
camera checking for any possible change in the position or orientation of
the camera.
public int getPlaneState()
getPlaneState returns the state of the frustum planes. So
checks can be made as to which frustum plane has been examined for
culling thus far.
public void setPlaneState(int planeState)
setPlaneState sets the state to keep track of tested
planes for culling.
planeState - the updated state.public float getViewPortLeft()
getViewPortLeft gets the left boundary of the viewport
public void setViewPortLeft(float left)
setViewPortLeft sets the left boundary of the viewport
left - the left boundary of the viewportpublic float getViewPortRight()
getViewPortRight gets the right boundary of the viewport
public void setViewPortRight(float right)
setViewPortRight sets the right boundary of the viewport
right - the right boundary of the viewportpublic float getViewPortTop()
getViewPortTop gets the top boundary of the viewport
public void setViewPortTop(float top)
setViewPortTop sets the top boundary of the viewport
top - the top boundary of the viewportpublic float getViewPortBottom()
getViewPortBottom gets the bottom boundary of the viewport
public void setViewPortBottom(float bottom)
setViewPortBottom sets the bottom boundary of the viewport
bottom - the bottom boundary of the viewport
public void setViewPort(float left,
float right,
float bottom,
float top)
setViewPort sets the boundaries of the viewport
left - the left boundary of the viewportright - the right boundary of the viewportbottom - the bottom boundary of the viewporttop - the top boundary of the viewportpublic int contains(BoundingVolume bound)
culled tests a bounding volume against the planes of the
camera's frustum. The frustums planes are set such that the normals all
face in towards the viewable scene. Therefore, if the bounding volume is
on the negative side of the plane is can be culled out. If the object
should be culled (i.e. not rendered) true is returned, otherwise, false
is returned.
bound - the bound to check for culling
public void onFrustumChange()
onFrustumChange is an update callback that is activated if
the frustum values change.
public void onViewPortChange()
onViewPortChange is an update callback that is activated
if the view port changes.
public void onFrameChange()
onFrameChange is an update callback that is activated if
the frame changes.
public void lookAt(Vector3f pos)
lookAt is a convienence method for auto-setting the frame.
pos - Vector3f
public void resize(int width,
int height)
resize resizes this cameras view with the given width/height.
This is similar to constructing a new camera, but reusing the same
Object.
width - intheight - int
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||