|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.proteinshader.gui.viewing.Camera
public class Camera
Used to store and manipulate camera information.
Field Summary | |
---|---|
static double |
FOVY
The fovy (field of view on y-axis) for the camera is 60 degrees. |
static double |
HALF_FOVY
Half the fovy is useful for some calculations. |
static double |
HALF_FOVY_RADIANS
Half the fovy needs to be in radians for Java trig functions. |
static int |
MIN_INITIAL_CAMERA_DISTANCE
The minimum initial camera distance is 20. |
static double |
SIN_HALF_FOVY
The sine of HALF_FOVY_RADIANS is used in pixel-angstrom conversions. |
static double |
TAN_HALF_FOVY
The tangent of HALF_FOVY_RADIANS is used in pixel-angstrom conversions. |
Constructor Summary | |
---|---|
Camera()
Constructs a Renderer. |
Method Summary | |
---|---|
void |
aim(GL gl)
Uses gluLookAt() to position and aim the camera. |
double |
calculateDepth(double x,
double y,
double z)
Calculates the depth (z-coordinate in camera space) of the xyz-center of the Drawable object. |
double |
calculateDepth(Drawable d)
Calculates the depth (z-coordinate in camera space) of the xyz-center of the Drawable object. |
double |
calculateDistance(double x,
double y,
double z)
Calculates the distance between the camera and the xyz-center of the Drawable object by using the Pythagorean theorem. |
double |
calculateDistance(Drawable d)
Calculates the distance between the camera and the xyz-center of the Drawable object by using the Pythagorean theorem. |
double |
convertToAngstroms(double pixels,
double cameraDepth)
Converts pixels to angstroms based on depth in camera space. |
void |
initializeViewport(GLAutoDrawable canvas,
GL gl)
Sets the viewport so that the origin (0, 0, 0) is in its center. |
void |
moveX(int x)
Add to the camera x position. |
void |
moveY(int y)
Add to the camera y position. |
void |
moveZ(int z)
Add to the camera z position. |
void |
printModelViewMatrix()
This debugging method prints the copy of the ModelViewMatrix stored n m_modelViewMatrix. |
void |
printXYZ()
Prints the xyz-coordinates for the camera. |
void |
resetDistance()
Sets the camera position based on the initial camera distance calculated when a new Structure is loaded. |
void |
reshape(GL gl,
int x,
int y,
int width,
int height)
Called on when the GLAutoDrawable object has changed its size so that the perspective and viewport can be recalculated. |
void |
setAccPerspective(GLAutoDrawable canvas,
GL gl,
double dxPixels,
double dyPixels)
Sets the projection matrix by using the glFrustrum() method of OpenGL. |
void |
setGluPerspective(GLAutoDrawable canvas,
GL gl)
Sets the projection matrix by using the gluPerspective() method of OpenGL. |
void |
setInitialCameraDistance(int z)
Sets the initial camera distance on the z-axis. |
void |
updateModelViewMatrix(GL gl)
Updates a copy of the OpenGL model view matrix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double FOVY
public static final double HALF_FOVY
public static final double HALF_FOVY_RADIANS
public static final double SIN_HALF_FOVY
public static final double TAN_HALF_FOVY
public static final int MIN_INITIAL_CAMERA_DISTANCE
Constructor Detail |
---|
public Camera()
Method Detail |
---|
public void updateModelViewMatrix(GL gl)
gl
- the current GL object.public double calculateDistance(Drawable d)
d
- the Drawable object.
public double calculateDistance(double x, double y, double z)
x
- the x-coordinate of a drawable object in world space.y
- the y-coordinate of a drawable object in world space.z
- the z-coordinate of a drawable object in world space.
public double calculateDepth(Drawable d)
d
- the Drawable object.
public double calculateDepth(double x, double y, double z)
x
- the x-coordinate of a drawable object in world space.y
- the y-coordinate of a drawable object in world space.z
- the z-coordinate of a drawable object in world space.
public double convertToAngstroms(double pixels, double cameraDepth)
pixels
- the number of pixels to convert to angstroms.cameraDepth
- the z-value of an object in camera space.
public void initializeViewport(GLAutoDrawable canvas, GL gl)
canvas
- the canvas to draw on.gl
- the current GL object.public void setGluPerspective(GLAutoDrawable canvas, GL gl)
canvas
- the canvas to draw on.gl
- the current GL object.public void setAccPerspective(GLAutoDrawable canvas, GL gl, double dxPixels, double dyPixels)
canvas
- the canvas to draw on.gl
- the current GL object.dxPixels
- the x-coordinate jitter in pixels.dyPixels
- the y-coordinate jitter in pixels.public void aim(GL gl)
public void resetDistance()
public void setInitialCameraDistance(int z)
z
- the distance in anstroms along the z axis.public void reshape(GL gl, int x, int y, int width, int height)
gl
- the current GL object.x
- the x-coordinate of the canvas.y
- the y-coordinate of the canvas.width
- the width of the canvas.height
- the height of the canvas.public void moveX(int x)
x
- value to add to camera x-coordinate.public void moveY(int y)
y
- value to add to camera y-coordinate.public void moveZ(int z)
z
- value to add to camera z-coordinate.public void printXYZ()
public void printModelViewMatrix()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |