|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jinx.video.View3D net.jinx.video.Camera
public class Camera
Camera represents a point of view within the Renderer. Cameras consist of
the following: position, point of focus, direction of up, and name.
Position is the camera's position in three-dimensional space.
Point of focus is the point in three-dimensional space that the camera is
looking at.
Direction of up refers to which way is up for the camera.
Name referes to the name of the camera. This can be used for whatever
you like. In previous projects, I used this for the window title; there were
multiple cameras each with their own window, all within a JDesktopPane.
API Stability: Stable.
Constructor Summary | |
---|---|
Camera()
Builds a camera at origin, looking along positive z axis, up is y axis. |
|
Camera(double[] pos)
Builds a camera at given position, looking at origin, up is y axis. |
|
Camera(double[] pos,
double[] lookAt)
Builds a camera at given position, looking at lookAt, up is y axis. |
|
Camera(double[] pos,
double[] lookAt,
double[] up)
Builds a camera at given position, looking at lookAt, up specified by up. |
|
Camera(float[] pos,
float[] lookAt,
float[] up)
|
Method Summary | |
---|---|
double[] |
getLookAt()
Returns the point that the camera is focused on. |
java.lang.String |
getName()
Returns the name of the camera. |
double[] |
getPosition()
Returns the position of the camera. |
double[] |
getUp()
Returns the vector that tells the camera which way is up. |
void |
optimize(double radius,
double fov)
Puts this camera at an optimal distance from the lookat coordinates to view an object with the given radius. |
void |
optimize(Model model,
double fov)
Puts this Camera at an optimal distance from a Model (assuming it's at the origin), using the current position as a direction vector. |
void |
setLookAt(double[] lookingAt)
Sets the point of focus. |
void |
setName(java.lang.String name)
Sets the name of the camera. |
void |
setPosition(double[] position)
Sets the position of the camera. |
void |
setUp(double[] up)
Sets the vector that tells the camera which way is up. |
void |
view(Context options,
java.awt.Rectangle viewport)
Prepares the view. |
Methods inherited from class net.jinx.video.View3D |
---|
deinit, getVisible, init, setVisible |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Camera()
public Camera(double[] pos)
pos
- the position of the camera.public Camera(double[] pos, double[] lookAt)
pos
- the position of the camera.lookAt
- the point to look at.public Camera(double[] pos, double[] lookAt, double[] up)
pos
- the position of the camera.lookAt
- the point to look at.up
- specifies which way is up.public Camera(float[] pos, float[] lookAt, float[] up)
Method Detail |
---|
public void view(Context options, java.awt.Rectangle viewport)
View
view
in interface View
view
in class View3D
options
- the Context object providing data on how rendering should
proceed.viewport
- the rectangle within the window that this View will be
rendered into. NOTE: The origin in OpenGL is the lower left hand corner,
not the upper left hand corner.public double[] getPosition()
public void setPosition(double[] position)
position
- the position vector.public double[] getLookAt()
public void setLookAt(double[] lookingAt)
lookingAt
- the point to have the camera look at.public double[] getUp()
public void setUp(double[] up)
up
- the vector describing which way is up.public java.lang.String getName()
public void setName(java.lang.String name)
name
- the name.public void optimize(Model model, double fov)
model
- the Model to optimize for.public void optimize(double radius, double fov)
radius
- the radius of the object to optimize for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |