|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.renderer.AbstractCamera
AbstractCamera implments the Camera interface
implementing all non-API specific camera calculations. Those requiring API
(LWJGL, JOGL, etc) specific calls are not implemented making this class
abstract. API specific classes are expected to extend this class and handle
renderer viewport setting.
| Field Summary | |
static int |
BOTTOM_PLANE
BOTTOM_PLANE represents the bottom plane of the camera frustum. |
protected float[] |
coeffBottom
|
protected float[] |
coeffLeft
|
protected float[] |
coeffRight
|
protected float[] |
coeffTop
|
protected Vector3f |
direction
Direction the camera is facing. |
static int |
FAR_PLANE
FAR_PLANE represents the far plane of the camera frustum. |
static int |
FRUSTUM_PLANES
FRUSTUM_PLANES represents the number of planes of the camera frustum. |
protected float |
frustumBottom
Distance from camera to bottom frustum plane. |
protected float |
frustumFar
Distance from camera to far frustum plane. |
protected float |
frustumLeft
Distance from camera to left frustum plane. |
protected float |
frustumNear
Distance from camera to near frustum plane. |
protected float |
frustumRight
Distance from camera to right frustum plane. |
protected float |
frustumTop
Distance from camera to top frustum plane. |
protected Vector3f |
left
Direction of camera's 'left' |
static int |
LEFT_PLANE
LEFT_PLANE represents the left plane of the camera frustum. |
protected Vector3f |
location
Camera's location |
protected Vector3f |
lookAt
Optional Vector3f representing a point this camera is looking at. |
static int |
MAX_WORLD_PLANES
MAX_WORLD_PLANES holds the maximum planes allowed by the system. |
static int |
NEAR_PLANE
NEAR_PLANE represents the near plane of the camera frustum. |
protected boolean |
overrideLookAt
If true, the lookAt vector is used. |
protected int |
planeQuantity
|
static int |
RIGHT_PLANE
RIGHT_PLANE represents the right plane of the camera frustum. |
static int |
TOP_PLANE
TOP_PLANE represents the top plane of the camera frustum. |
protected Vector3f |
up
Direction of 'up' for camera. |
protected float |
viewPortBottom
Percent value on display where vertical viewing begins for this camera. |
protected float |
viewPortLeft
Percent value on display where horizontal viewing starts for this camera. |
protected float |
viewPortRight
Percent value on display where horizontal viewing ends for this camera. |
protected float |
viewPortTop
Percent value on display where vertical viewing ends for this camera. |
protected Plane[] |
worldPlane
Array holding the planes that this camera will check for culling. |
| Fields inherited from interface com.jme.renderer.Camera |
INSIDE_FRUSTUM, INTERSECTS_FRUSTUM, OUTSIDE_FRUSTUM |
| Constructor Summary | |
AbstractCamera()
Constructor instantiates a new AbstractCamera object. |
|
| Method Summary | |
int |
contains(BoundingVolume bound)
culled tests a bounding volume against the planes of the
camera's frustum. |
Vector3f |
getDirection()
getDirection retrieves the direction vector 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 retrieves the left axis of the camera. |
Vector3f |
getLocation()
getLocation retrieves the location vector of the camera. |
int |
getPlaneState()
getPlaneState returns the state of the frustum planes. |
Vector3f |
getUp()
getUp retrieves 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 updates the view frame of the camera. |
void |
onFrustumChange()
onFrustumChange updates the frustum to reflect any changes
made to the planes. |
void |
setAxes(Quaternion axes)
setAxes uses a rotational matrix to set the axes of the
camera. |
void |
setAxes(Vector3f left,
Vector3f up,
Vector3f direction)
setAxes sets the axes (left, up and direction) for this
camera. |
void |
setDirection(Vector3f direction)
setDirection sets the direction this camera is facing. |
void |
setFrame(Vector3f location,
Quaternion axes)
setFrame sets the orientation and location of the camera. |
void |
setFrame(Vector3f location,
Vector3f left,
Vector3f up,
Vector3f direction)
setFrame sets the orientation and location of the camera. |
void |
setFrustum(float near,
float far,
float left,
float right,
float top,
float bottom)
setFrustum sets the frustum of this camera object. |
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 this camera. |
void |
setLocation(Vector3f location)
setLocation sets 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 this 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 camera parameters by calling
onFrustumChange,onViewPortChange and
onFrameChange. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.jme.renderer.Camera |
onViewPortChange, resize |
| Field Detail |
public static final int LEFT_PLANE
public static final int RIGHT_PLANE
public static final int BOTTOM_PLANE
public static final int TOP_PLANE
public static final int FAR_PLANE
public static final int NEAR_PLANE
public static final int FRUSTUM_PLANES
public static final int MAX_WORLD_PLANES
protected Vector3f location
protected Vector3f left
protected Vector3f up
protected Vector3f direction
protected float frustumNear
protected float frustumFar
protected float frustumLeft
protected float frustumRight
protected float frustumTop
protected float frustumBottom
protected float[] coeffLeft
protected float[] coeffRight
protected float[] coeffBottom
protected float[] coeffTop
protected int planeQuantity
protected float viewPortLeft
protected float viewPortRight
protected float viewPortTop
protected float viewPortBottom
protected Plane[] worldPlane
protected Vector3f lookAt
protected boolean overrideLookAt
| Constructor Detail |
public AbstractCamera()
AbstractCamera object. All
values of the camera are set to default.
| Method Detail |
public float getFrustumBottom()
getFrustumBottom returns the value of the bottom frustum
plane.
getFrustumBottom in interface Camerapublic void setFrustumBottom(float frustumBottom)
setFrustumBottom sets the value of the bottom frustum
plane.
setFrustumBottom in interface CamerafrustumBottom - the value of the bottom frustum plane.public float getFrustumFar()
getFrustumFar gets the value of the far frustum plane.
getFrustumFar in interface Camerapublic void setFrustumFar(float frustumFar)
setFrustumFar sets the value of the far frustum plane.
setFrustumFar in interface CamerafrustumFar - the value of the far frustum plane.public float getFrustumLeft()
getFrustumLeft gets the value of the left frustum plane.
getFrustumLeft in interface Camerapublic void setFrustumLeft(float frustumLeft)
setFrustumLeft sets the value of the left frustum plane.
setFrustumLeft in interface CamerafrustumLeft - the value of the left frustum plane.public float getFrustumNear()
getFrustumNear gets the value of the near frustum plane.
getFrustumNear in interface Camerapublic void setFrustumNear(float frustumNear)
setFrustumNear sets the value of the near frustum plane.
setFrustumNear in interface CamerafrustumNear - the value of the near frustum plane.public float getFrustumRight()
getFrustumRight gets the value of the right frustum plane.
getFrustumRight in interface Camerapublic void setFrustumRight(float frustumRight)
setFrustumRight sets the value of the right frustum plane.
setFrustumRight in interface CamerafrustumRight - the value of the right frustum plane.public float getFrustumTop()
getFrustumTop gets the value of the top frustum plane.
getFrustumTop in interface Camerapublic void setFrustumTop(float frustumTop)
setFrustumTop sets the value of the top frustum plane.
setFrustumTop in interface CamerafrustumTop - the value of the top frustum plane.public Vector3f getLocation()
getLocation retrieves the location vector of the camera.
getLocation in interface CameraCamera.getLocation()public Vector3f getDirection()
getDirection retrieves the direction vector the camera is
facing.
getDirection in interface CameraCamera.getDirection()public Vector3f getLeft()
getLeft retrieves the left axis of the camera.
getLeft in interface CameraCamera.getLeft()public Vector3f getUp()
getUp retrieves the up axis of the camera.
getUp in interface CameraCamera.getUp()public void setLocation(Vector3f location)
setLocation sets the position of the camera.
setLocation in interface Cameralocation - the position of the camera.Camera.setLocation(com.jme.math.Vector3f)public void setDirection(Vector3f direction)
setDirection sets the direction this camera is facing. In
most cases, this changes the up and left vectors of the camera. If your
left or up vectors change, you must updates those as well for correct
culling.
setDirection in interface Cameradirection - the direction this camera is facing.Camera.setDirection(com.jme.math.Vector3f)public void setLeft(Vector3f left)
setLeft sets the left axis of this camera. In most cases,
this changes the up and direction vectors of the camera. If your
direction or up vectors change, you must updates those as well for
correct culling.
setLeft in interface Cameraleft - the left axis of this camera.Camera.setLeft(com.jme.math.Vector3f)public void setUp(Vector3f up)
setUp sets the up axis of this camera. In most cases, this
changes the direction and left vectors of the camera. If your left or up
vectors change, you must updates those as well for correct culling.
setUp in interface Cameraup - the up axis of this camera.Camera.setUp(com.jme.math.Vector3f)
public void setAxes(Vector3f left,
Vector3f up,
Vector3f direction)
setAxes sets the axes (left, up and direction) for this
camera.
setAxes in interface Cameraleft - the left axis of the camera.up - the up axis of the camera.direction - the direction the camera is facing.Camera.setAxes(com.jme.math.Vector3f,com.jme.math.Vector3f,com.jme.math.Vector3f)public void setAxes(Quaternion axes)
setAxes uses a rotational matrix to set the axes of the
camera.
setAxes in interface Cameraaxes - the matrix that defines the orientation of the camera.
public void setFrustum(float near,
float far,
float left,
float right,
float top,
float bottom)
setFrustum sets the frustum of this camera object.
setFrustum in interface Cameranear - the near plane.far - the far plane.left - the left plane.right - the right plane.top - the top plane.bottom - the bottom plane.Camera.setFrustum(float, float, float, float,
float, float)
public void setFrustumPerspective(float fovY,
float aspect,
float near,
float far)
CamerasetFrustumPerspective defines the frustum for the camera. This
frustum is defined by a viewing angle, aspect ratio, and near/far planes
setFrustumPerspective in interface CamerafovY - Frame of view angle along the Y.aspect - Width:Height rationear - Near view plane distancefar - Far view plane distance
public void setFrame(Vector3f location,
Vector3f left,
Vector3f up,
Vector3f direction)
setFrame sets the orientation and location of the camera.
setFrame in interface Cameralocation - the point position of the camera.left - the left axis of the camera.up - the up axis of the camera.direction - the facing of the camera.Camera.setFrame(com.jme.math.Vector3f,
com.jme.math.Vector3f, com.jme.math.Vector3f, com.jme.math.Vector3f)public void lookAt(Vector3f pos)
lookAt is a convienence method for auto-setting the frame.
Unlike its name, this function doesn't totally "look at" a position
mostly because left and up vectors are not updated.
lookAt in interface Camerapos - Vector3f
public void setFrame(Vector3f location,
Quaternion axes)
setFrame sets the orientation and location of the camera.
setFrame in interface Cameralocation - the point position of the camera.axes - the orientation of the camera.public void update()
update updates the camera parameters by calling
onFrustumChange,onViewPortChange and
onFrameChange.
update in interface CameraCamera.update()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.
getPlaneState in interface Camerapublic void setPlaneState(int planeState)
setPlaneState sets the state to keep track of tested
planes for culling.
setPlaneState in interface CameraplaneState - the updated state.public float getViewPortLeft()
getViewPortLeft gets the left boundary of the viewport
getViewPortLeft in interface Camerapublic void setViewPortLeft(float left)
setViewPortLeft sets the left boundary of the viewport
setViewPortLeft in interface Cameraleft - the left boundary of the viewportpublic float getViewPortRight()
getViewPortRight gets the right boundary of the viewport
getViewPortRight in interface Camerapublic void setViewPortRight(float right)
setViewPortRight sets the right boundary of the viewport
setViewPortRight in interface Cameraright - the right boundary of the viewportpublic float getViewPortTop()
getViewPortTop gets the top boundary of the viewport
getViewPortTop in interface Camerapublic void setViewPortTop(float top)
setViewPortTop sets the top boundary of the viewport
setViewPortTop in interface Cameratop - the top boundary of the viewportpublic float getViewPortBottom()
getViewPortBottom gets the bottom boundary of the viewport
getViewPortBottom in interface Camerapublic void setViewPortBottom(float bottom)
setViewPortBottom sets the bottom boundary of the viewport
setViewPortBottom in interface Camerabottom - the bottom boundary of the viewport
public void setViewPort(float left,
float right,
float bottom,
float top)
setViewPort sets the boundaries of the viewport
setViewPort in interface Cameraleft - 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. If bound is null, false is returned and the object will not
be culled.
contains in interface Camerabound - the bound to check for culling
public void onFrustumChange()
onFrustumChange updates the frustum to reflect any changes
made to the planes. The new frustum values are kept in a temporary
location for use when calculating the new frame. It should be noted that
the abstract implementation of this class only updates the data, and does
not make any rendering calls. As such, any impelmenting subclass should
insure to override this method call it with super and then call the
rendering specific code.
onFrustumChange in interface Camerapublic void onFrameChange()
onFrameChange updates the view frame of the camera. It
should be noted that the abstract implementation of this class only
updates the data, and does not make any rendering calls. As such, any
implementing subclass should insure to override this method call it with
super and then call the rendering specific code.
onFrameChange in interface Camera
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||