|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.proteinshader.gui.Renderer
public class Renderer
Knows how to render a protein image onto a GLCanvas.
Field Summary | |
---|---|
static float[] |
BACKGROUND
The background color for the canvas is white (1, 1, 1, 0). |
Constructor Summary | |
---|---|
Renderer(Mediator mediator)
Constructs a Renderer. |
Method Summary | |
---|---|
void |
blendObjectEdges(boolean b)
Turns on or off the ability of the halftoning shaders to soften aliasing (jagged edges) by rendering translucent black silhouettes of tube and ribbon segments (and using jitter) before calling on the halftoning shaders. |
void |
cacheGeometricObject(GeometricListInfo info)
Stores a request to cache a new geomtric object so that the request can be processed the next time display() is called. |
void |
cacheTextLabels(List<String> textLabels)
Informs the Renderer that new textLabels should be cached because a new Structure has been loaded. |
void |
display(GLAutoDrawable canvas)
Draws the currently selected Model on the canvas. |
void |
displayChanged(GLAutoDrawable canvas,
boolean modeChanged,
boolean deviceChanged)
Called on if the display mode or display device is changed while the program is running. |
StructureToGraphics |
getGraphics()
Returns a reference to the StructureToGraphics object used by the Renderer. |
String |
getGraphicsCardInfo()
Returns information on the graphics card that was gathered when the init() method was called. |
double |
getScale()
Returns the scale factor for the image. |
void |
init(GLAutoDrawable canvas)
This method is called by the canvas immediately after the OpenGL state is initialized. |
boolean |
isAnimating()
Returns true if an animation (model rotation) is in progress. |
void |
jitterScene(JitterEnum jitter)
Draws the scene multiple times to an accumulation buffer while jittering the xy-coordinates a fraction of a pixel. |
void |
moveCameraXY(int x,
int y)
Moves the camera in the x and y directions. |
void |
moveCameraZ(int z)
Moves the camera in the z-direction. |
void |
printAngstroms(boolean b)
Setting print angstroms to true will cause object to camera distances to be printed to standard out for testing and debugging purposes (and will also cause tiling numbers to be printed if automatic tiling is in use). |
void |
reshape(GLAutoDrawable canvas,
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 |
rotateAboutXY(double deltaX,
double deltaY)
Rotates the model about the x-axis and y-axis. |
void |
rotateAboutZ(double deltaZ)
Rotates the model about the z-axis. |
void |
setBackgroundColor(float red,
float green,
float blue)
Sets the background color for the canvas. |
void |
setImageOrientation(OrientationEnum orientation)
Resets the orientation of the image by resetting the angle of rotation about the x-axis and the angle of rotation about the y-axis. |
void |
setNewStructureFlag(boolean flag)
Informs the Renderer if a new Structure has been loaded so that the camera distance can be reset before the image is shown. |
void |
setScale(double scale)
Sets the scale factor for the image. |
void |
setVisibleDrawables(Model model,
StyleEnum style)
An array of opaque Segments, and array of opaque Atoms and Bonds, and an array of translucent Drawable objects will be obtained from the Model. |
void |
showAminoAcids(boolean b)
Controls whether the Renderer will display AminoAcids. |
void |
showHeterogens(boolean b)
Controls whether the Renderer will display Heterogens. |
void |
showWaters(boolean b)
Controls whether the Renderer will display Waters. |
void |
startAnimation(double xAxisSpeed,
double yAxisSpeed,
GLCanvas canvas)
Uses an Animator object to rotate the protein image about its x-axis and/or y-axis. |
void |
stopAnimation()
Stops the rotation animation that is started with startAnimation(). |
void |
takeScreenShot(ImageFormatEnum format,
File file)
Sets up a screen shot so that the next call to display() will cause the current image on the canvas to be saved to a JPEG, PNG or GIF file. |
void |
toggleBlendObjectEdges()
Toggles the boolean value that is set with the blendObjectsEdges() method. |
void |
togglePrintAngstroms()
Toggles the memory of whether object to camera distances in angstroms (and tiling numbers) should be printed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float[] BACKGROUND
Constructor Detail |
---|
public Renderer(Mediator mediator)
mediator
- the central Mediator that allows communication with the
GUI classes.Method Detail |
---|
public void init(GLAutoDrawable canvas)
init
in interface GLEventListener
canvas
- the canvas to draw on.public void display(GLAutoDrawable canvas)
display
in interface GLEventListener
canvas
- the canvas to draw on.public void reshape(GLAutoDrawable canvas, int x, int y, int width, int height)
reshape
in interface GLEventListener
canvas
- the canvas to draw on.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 displayChanged(GLAutoDrawable canvas, boolean modeChanged, boolean deviceChanged)
displayChanged
in interface GLEventListener
canvas
- the canvas to draw on.modeChanged
- a mode change (e.g. 32-bit to 16-bit color).deviceChanged
- a device change (moving to second monitor).public StructureToGraphics getGraphics()
public void cacheGeometricObject(GeometricListInfo info)
info
- describes the geometric object to cache.public void moveCameraXY(int x, int y)
x
- the value to add to the x-coordinate of the camera.y
- the value to add to the y-coordinate of the camera.public void moveCameraZ(int z)
z
- the value to add to the z-coordinate of the camera.public void rotateAboutXY(double deltaX, double deltaY)
deltaX
- the change in angle of rotation about the x-axis.deltaY
- the change in angle of rotation about the y-axis.public void rotateAboutZ(double deltaZ)
deltaZ
- the change in angle of rotation.public void setBackgroundColor(float red, float green, float blue)
red
- the red component of the background color.green
- the green component of the background color.blue
- the blue component of the background color.public void setImageOrientation(OrientationEnum orientation)
orientation
- the desired view of the structure (original, front,
back, left, right, top, bottom).public void setNewStructureFlag(boolean flag)
flag
- boolean to set true if a new Structure is seen.public void cacheTextLabels(List<String> textLabels)
textLabels
- the residueIDs for AminoAcids.public void setVisibleDrawables(Model model, StyleEnum style) throws VisitorException
SPACE_FILLING: Atoms, but not Bonds.
BALLS_AND_STICKS: Both Atoms and Bonds.
STICKS: Bonds, but not Atoms.
model
- the currently selected Model.style
- the style as an enum.
VisitorException
- if an error occurs while getting the
Drawables.public void showAminoAcids(boolean b)
b
- boolean value indicating if AminoAcids should be displayed.public void showHeterogens(boolean b)
b
- boolean value indicating if Heterogens should be displayed.public void showWaters(boolean b)
b
- boolean value indicating if Waters should be displayed.public void startAnimation(double xAxisSpeed, double yAxisSpeed, GLCanvas canvas)
xAxisSpeed
- the x-axis speed in degrees per second.yAxisSpeed
- the y-axis speed in degrees per second.canvas
- the GLCanvas to create an Animator for.public void stopAnimation()
public boolean isAnimating()
public void jitterScene(JitterEnum jitter)
jitter
- the JitterEnum object contains a list of xy-coordinate pairs.public double getScale()
public void setScale(double scale)
scale
- the scale factor as a double.public void takeScreenShot(ImageFormatEnum format, File file)
format
- the screen shot image format.file
- the file to save the screen shot to.public void blendObjectEdges(boolean b)
b
- boolean value to determine if object edges should be smoothed.public void toggleBlendObjectEdges()
public void printAngstroms(boolean b)
b
- true to print to standard out.public void togglePrintAngstroms()
public String getGraphicsCardInfo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |