|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjme.entity.Entity
jme.entity.camera.Camera
Camera
defines a camera in three dimensional space. The camera
has three aspects. A position defines where the camera is located, the view
defines what point the camera is looking at and the up defines the orientation
of the camera. To set the viewport a single call to look
is all
that is required.
Field Summary | |
protected Sky |
sky
sky the sky representation. |
Fields inherited from class jme.entity.Entity |
boundingVolume, children, geometry, VISIBILITY_CUBE, VISIBILITY_POINT, VISIBILITY_SPHERE |
Constructor Summary | |
Camera(int id)
Default constructor sets all three attributes to (0, 0, 0). |
|
Camera(int id,
Entity child)
Constructor instantiates a new Camera object with
a given entity as a child. |
|
Camera(int id,
float positionX,
float positionY,
float positionZ,
float viewX,
float viewY,
float viewZ,
float upX,
float upY,
float upZ)
Constructor takes the nine parameters that make up the three attributes and initializes the camera's vectors to them. |
|
Camera(int id,
Vector position,
Vector view,
Vector up)
Constructor takes three Vector3 parameters and sets them
to the camera's attributes. |
Method Summary | |
Frustum |
getFrustum()
getFrustum returns the view frustum of the camera. |
Vector |
getStrafe()
getStrafe returns the strafe vector of the camera. |
Vector |
getUp()
getUp returns the "up" orientation of the camera. |
Vector |
getView()
getView returns the three dimensional point that the
camera is looking at. |
void |
render()
look uses the current position, view and up vector of the
camera to determine the view. |
void |
set(Vector position,
Vector view,
Vector up)
set sets the camera's attributes to the three
|
void |
setAttributes(float positionX,
float positionY,
float positionZ,
float viewX,
float viewY,
float viewZ,
float upX,
float upY,
float upZ)
setAttributes sets the camera's attributes to the new nine
parameters that make up the three attributes and initializes the
camera's vectors to them. |
void |
setSky(Sky sky)
setSky sets the sky representation of the terrain. |
void |
setStrafe(Vector strafe)
setStrafe sets the strafe vector of the entity. |
void |
setUp(float x,
float y,
float z)
setUp sets the orientation of the camera. |
void |
setUp(Vector up)
setUp sets the orienation of the camera. |
void |
setView(float x,
float y,
float z)
setView sets the point at which the camera is looking. |
void |
setView(Vector view)
setView sets the point vector at which the camera is
looking. |
java.lang.String |
toString()
toString returns the string representation of this
camera object in the format:jme.entity.camera.Camera@861f24 Position: {VECTOR} View: {VECTOR} Up: {VECTOR} |
void |
update(float time)
update updates the sky parameters if necessary. |
void |
updateFrustum()
updateFrustum sets the view frustum to the newest
values based on the location and orientation of the camera. |
Methods inherited from class jme.entity.Entity |
addChild, checkVisibility, distance, getBoundingVolume, getGeometry, getId, getPhysics, getPosition, hasCollision, hasMoved, isVisible, removeChild, setBoundingVolume, setGeometry, setMoved, setPhysicsModule, setPitch, setPosition, setRoll, setVisibilityType, setYaw |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Sky sky
sky
the sky representation.
Constructor Detail |
public Camera(int id)
public Camera(int id, Entity child)
Camera
object with
a given entity as a child.
id
- the id of the camera.child
- the entity child.public Camera(int id, float positionX, float positionY, float positionZ, float viewX, float viewY, float viewZ, float upX, float upY, float upZ)
positionX
- the x position of the camera.positionY
- the y position of the camera.positionZ
- the z position of the camera.viewX
- the x position of the point viewed.viewY
- the y position of the point viewed.viewZ
- the z position of the point viewed.upX
- the x component of the up vector.upY
- the y component of the up vector.upZ
- the z component of the up vector.public Camera(int id, Vector position, Vector view, Vector up)
Vector3
parameters and sets them
to the camera's attributes.
position
- the position of the camera.view
- the point the camera is looking.up
- the orientation of the camera.Method Detail |
public void setAttributes(float positionX, float positionY, float positionZ, float viewX, float viewY, float viewZ, float upX, float upY, float upZ)
setAttributes
sets the camera's attributes to the new nine
parameters that make up the three attributes and initializes the
camera's vectors to them.
positionX
- the x position of the camera.positionY
- the y position of the camera.positionZ
- the z position of the camera.viewX
- the x position of the point viewed.viewY
- the y position of the point viewed.viewZ
- the z position of the point viewed.upX
- the x component of the up vector.upY
- the y component of the up vector.upZ
- the z component of the up vector.public void updateFrustum()
updateFrustum
sets the view frustum to the newest
values based on the location and orientation of the camera.
public Frustum getFrustum()
getFrustum
returns the view frustum of the camera.
public void set(Vector position, Vector view, Vector up)
set sets the camera's attributes to the three
Vector3
parameters and sets them to the camera's attributes.
- Parameters:
position
- the position of the camera.view
- the point the camera is looking.up
- the orientation of the camera.
public void setView(float x, float y, float z)
setView
sets the point at which the camera is looking.
x
- the x component of the new view.y
- the y component of the new view.z
- the z component of the new view.public void setView(Vector view)
setView
sets the point vector at which the camera is
looking.
view
- the new view point.public void setUp(float x, float y, float z)
setUp
sets the orientation of the camera.
x
- the new x component of the orientation vector.y
- the new y component of the orientation vector.z
- the new z component of the orientation vector.public void setUp(Vector up)
setUp
sets the orienation of the camera.
up
- the new orientation vector of the camera.public void setStrafe(Vector strafe)
setStrafe
sets the strafe vector of the entity.
strafe
- the strafe vector.public Vector getStrafe()
getStrafe
returns the strafe vector of the camera.
public Vector getView()
getView
returns the three dimensional point that the
camera is looking at.
public Vector getUp()
getUp
returns the "up" orientation of the camera.
public void setSky(Sky sky)
setSky
sets the sky representation of the terrain. This
takes an Sky
subclass. The client is reponsible
for calling the sky's render method during the terrain's render call.
public void update(float time)
update
updates the sky parameters if necessary.
update
in interface EntityInterface
update
in class Entity
time
- the time between frames.public void render()
look
uses the current position, view and up vector of the
camera to determine the view.
render
in interface EntityInterface
render
in class Entity
public java.lang.String toString()
toString
returns the string representation of this
camera object in the format:
toString
in class Entity
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |