render
Interface RenderablePanel

All Known Implementing Classes:
RenderApplet, RenderJPanel, RenderPanel, RenderPanelGL

public interface RenderablePanel


Method Summary
 void addKeyListener(java.awt.event.KeyListener l)
           
 void addLight(double x, double y, double z, double r, double g, double b)
          Adds light source with direction (x, y, z) & color (r, g, b).
 Widget addMenu(java.lang.String label, int x, int y)
          adds a menu widget
 void addMenu(Widget menu)
          adds a menu
 void addMouseListener(java.awt.event.MouseListener l)
           
 void addMouseMotionListener(java.awt.event.MouseMotionListener l)
           
 void addMouseWheelListener(java.awt.event.MouseWheelListener l)
           
 java.awt.Image createImage(java.awt.image.ImageProducer producer)
           
 java.awt.Image createImage(int width, int height)
           
 double getCurrentTime()
          returns the current system time in seconds
 double getFL()
          focal length
 double getFOV()
          field of view
 Geometry getGeometry(int x, int y)
          Returns the Geometry of the frontmost object at the point (x, y) in the image (like a z-buffer value of geometries).
 boolean getGeometryBuffer()
          status of the geometry z-buffer, for object picking
 int getHeight()
          returns the height of the component
 int getLod()
          level of detail
 Matrix[] getMatrix()
          the matrix stack
 boolean getOutline()
          get status of flag which produces the sketch-line drawing rendition of the scene
 int[] getPix()
          the pixel array
 boolean getPoint(int x, int y, double[] xyz)
          Returns the location in world space of the point (x, y) on the screen.
 Renderable getRenderable()
          (@link Renderable} Renderable
 Renderer getRenderer()
          Rendererobject
 boolean getTableMode()
          flag that determines whether the normal tables should beprecomputed
 int getWidth()
          the Component's width
 Geometry getWorld()
          the root world geometry
 void identity()
          Sets current matrix to the identity matrix.
 void init()
          Initializes the renderer and internal variables; to initialize your model see Renderable.initialize()
 boolean isDragging()
          Returns whether dragging is active or not.
 Matrix m()
          Returns the matrix at the top of the stack.
 Widget menu(int i)
          returns the menu at index i
 void mouseClicked(java.awt.Event e, int x, int y)
           
 void mouseDragged(java.awt.Event e, int x, int y)
           
 void mouseEntered(java.awt.Event e, int x, int y)
           
 void mouseExited(java.awt.Event e, int x, int y)
           
 void mouseMoved(java.awt.Event e, int x, int y)
           
 void mousePressed(java.awt.Event e, int x, int y)
           
 void mouseReleased(java.awt.Event e, int x, int y)
           
 void mouseWheelMoved(java.awt.event.MouseWheelEvent e, int rotation)
           
 void pause()
          pauses the renderer thread
 void pop()
          Pops the top matrix from the stack.
 boolean processCommand(int key)
          Handles commands received (generally for unicode commands from the KeyListener, but also for commands from any other sources, like buttons from webpages) : various default control keys to modify render style (Use CTRL + key).
 int pull(Geometry s, double x0, double x1, double x2, double y0, double y1, double y2, double z0, double z1, double z2)
          Deforms a geometric shape according to the beginning, middle, and end parameters in each dimension.
 void push()
          Pushes a copy of the top matrix onto the stack.
 void recalculateSize(int width, int height)
          called upon a resize of the component
 void refresh()
          Forces a refresh of the renderer.
 void removeKeyListener(java.awt.event.KeyListener l)
           
 void removeMenu(Widget menu)
          removes a particular menu
 void removeMouseListener(java.awt.event.MouseListener l)
           
 void removeMouseMotionListener(java.awt.event.MouseMotionListener l)
           
 void repaint()
          repaint the component
 void rotateView(double theta, double phi)
          Rotate angle of view.
 void rotateX(double t)
          Rotates the top matrix around the X axis by angle t (radians).
 void rotateY(double t)
          Rotates the top matrix around the Y axis by angle t (radians).
 void rotateZ(double t)
          Rotates the top matrix around the Z axis by angle t (radians).
 void scale(double x, double y, double z)
          Scales the top matrix by x, y, z in their respective dimensions.
 void setBgColor(double r, double g, double b)
          Sets the background color ( RGB values range: 0..1).
 void setDragging(boolean value)
          If the user is interactively dragging the mouse, we want the renderer to know about it, so that any other background process (eg: a material which is building a lookup table) can ask the renderer, and thereby avoid consuming scarce CPU resources simultaneously.
 void setFL(double value)
          Sets the camera's focal length.
 void setFOV(double value)
          Sets the field of view value.
 void setGeometryBuffer(boolean value)
          enables/disables the geometry z-buffer, for object picking
 void setLod(int value)
          set the level of detail
 void setOutline(boolean value)
          toggle outline mode
 void setRenderable(Renderable renderable)
          set the renderable object
 void setTableMode(boolean value)
          toggle table lookup mode and precomputation
 void showMesh(boolean value)
          toggle the wireframe view of the world
 void start()
          starts the renderer thread
 void transform(Geometry s)
          Applies the top transformation matrix to Geometry s.
 void translate(double[] v)
          Translates the top matrix by vector v.
 void translate(double x, double y, double z)
          Translates the top matrix by vector v.
 Widget widgetAt(int x, int y)
          returns the widget at x, y
 

Method Detail

addKeyListener

public void addKeyListener(java.awt.event.KeyListener l)

addLight

public void addLight(double x,
                     double y,
                     double z,
                     double r,
                     double g,
                     double b)
Adds light source with direction (x, y, z) & color (r, g, b). Arguments x,y,z indicate light direction. Arguments r,g,b indicate light direction.

See Also:
Renderer.addLight(double x,double y,double z, double r,double g,double b)

addMenu

public Widget addMenu(java.lang.String label,
                      int x,
                      int y)
adds a menu widget

Parameters:
label -
x -
y -
Returns:

addMenu

public void addMenu(Widget menu)
adds a menu

Parameters:
menu -

addMouseListener

public void addMouseListener(java.awt.event.MouseListener l)

addMouseMotionListener

public void addMouseMotionListener(java.awt.event.MouseMotionListener l)

addMouseWheelListener

public void addMouseWheelListener(java.awt.event.MouseWheelListener l)

createImage

public java.awt.Image createImage(java.awt.image.ImageProducer producer)

createImage

public java.awt.Image createImage(int width,
                                  int height)

getGeometry

public Geometry getGeometry(int x,
                            int y)
Returns the Geometry of the frontmost object at the point (x, y) in the image (like a z-buffer value of geometries).

Parameters:
x - x coordinate in the image
y - y coordinate in the image
Returns:
the geometry of the foremost object at that location

getCurrentTime

public double getCurrentTime()
returns the current system time in seconds

Returns:

getFOV

public double getFOV()
field of view

Returns:

getFL

public double getFL()
focal length

Returns:

getGeometryBuffer

public boolean getGeometryBuffer()
status of the geometry z-buffer, for object picking

Returns:

getHeight

public int getHeight()
returns the height of the component

Returns:

getLod

public int getLod()
level of detail

Returns:

getMatrix

public Matrix[] getMatrix()
the matrix stack

Returns:

getPix

public int[] getPix()
the pixel array

Returns:

getOutline

public boolean getOutline()
get status of flag which produces the sketch-line drawing rendition of the scene

Returns:

getPoint

public boolean getPoint(int x,
                        int y,
                        double[] xyz)
Returns the location in world space of the point (x, y) on the screen.

Parameters:
x - x coordinate in the image
y - y coordinate in the image
Returns:
true if there is an object at x, y , false otherwise

getRenderable

public Renderable getRenderable()
(@link Renderable} Renderable

Returns:

getRenderer

public Renderer getRenderer()
Rendererobject


getTableMode

public boolean getTableMode()
flag that determines whether the normal tables should beprecomputed

Returns:

getWidth

public int getWidth()
the Component's width

Returns:

getWorld

public Geometry getWorld()
the root world geometry

Returns:

identity

public void identity()
Sets current matrix to the identity matrix.


init

public void init()
Initializes the renderer and internal variables; to initialize your model see Renderable.initialize()

See Also:
#Renderable.initialize()

isDragging

public boolean isDragging()
Returns whether dragging is active or not.

Returns:
true when dragging is active, false otherwise

m

public Matrix m()
Returns the matrix at the top of the stack.

Returns:
the top matrix on the stack

menu

public Widget menu(int i)
returns the menu at index i

Parameters:
i -
Returns:

mouseClicked

public void mouseClicked(java.awt.Event e,
                         int x,
                         int y)

mouseDragged

public void mouseDragged(java.awt.Event e,
                         int x,
                         int y)

mouseEntered

public void mouseEntered(java.awt.Event e,
                         int x,
                         int y)

mouseExited

public void mouseExited(java.awt.Event e,
                        int x,
                        int y)

mouseMoved

public void mouseMoved(java.awt.Event e,
                       int x,
                       int y)

mousePressed

public void mousePressed(java.awt.Event e,
                         int x,
                         int y)

mouseReleased

public void mouseReleased(java.awt.Event e,
                          int x,
                          int y)

mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent e,
                            int rotation)

pause

public void pause()
pauses the renderer thread


pop

public void pop()
Pops the top matrix from the stack.


pull

public int pull(Geometry s,
                double x0,
                double x1,
                double x2,
                double y0,
                double y1,
                double y2,
                double z0,
                double z1,
                double z2)
Deforms a geometric shape according to the beginning, middle, and end parameters in each dimension. For each dimesion the three parameters indicate the amount of deformation at each position.

0 - beginning, 1 - middle, 2 - end. To indicate infinity (a constant transformation) set two adjacent parameters to the same value. Setting all three parameters to the same value transforms the shape geometry consistently across the entire axis of the parameters.

Parameters:
s - shape object to be deformed
x0 - location of beginning of deformation along the x axis
x1 - location of beginning of deformation along the x axis
x2 - location of beginning of deformation along the x axis
y0 - location of beginning of deformation along the y axis
y1 - location of beginning of deformation along the y axis
y2 - location of beginning of deformation along the y axis
z0 - location of beginning of deformation along the z axis
z1 - location of beginning of deformation along the z axis
z2 - location of beginning of deformation along the z axis
Returns:
1 if pull operation was successful, 0 otherwise
See Also:
Geometry.pull(render.Matrix, double, double, double, double, double, double, double, double, double)

push

public void push()
Pushes a copy of the top matrix onto the stack.


processCommand

public boolean processCommand(int key)
Handles commands received (generally for unicode commands from the KeyListener, but also for commands from any other sources, like buttons from webpages) : various default control keys to modify render style (Use CTRL + key).

'e' - toggles showMesh(boolean), that just displays the shapes as mesh wireframes
'l' - toggles getOutline() which produces a sketch-line drawing rendition of the scene
'm' - toggles #seeMesh which determines mesh visibility
't' - toggles global texture manipulation method (MIP on/off) (@link Texture#useMIP)

Parameters:
key - value of the key released
Returns:
true if one of the above keys was just released, false otherwise.

removeMenu

public void removeMenu(Widget menu)
removes a particular menu

Parameters:
menu -

recalculateSize

public void recalculateSize(int width,
                            int height)
called upon a resize of the component

Parameters:
width -
height -

refresh

public void refresh()
Forces a refresh of the renderer. Sets isDamage true.


removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener l)

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener l)

removeMouseMotionListener

public void removeMouseMotionListener(java.awt.event.MouseMotionListener l)

repaint

public void repaint()
repaint the component


rotateView

public void rotateView(double theta,
                       double phi)
Rotate angle of view.

Parameters:
theta -
phi -

rotateX

public void rotateX(double t)
Rotates the top matrix around the X axis by angle t (radians).

Parameters:
t - angle in radians

rotateY

public void rotateY(double t)
Rotates the top matrix around the Y axis by angle t (radians).

Parameters:
t - angle in radians

rotateZ

public void rotateZ(double t)
Rotates the top matrix around the Z axis by angle t (radians).

Parameters:
t - angle in radians

scale

public void scale(double x,
                  double y,
                  double z)
Scales the top matrix by x, y, z in their respective dimensions.

Parameters:
x - x scale factor
y - y scale factor
z - z scale factor

setBgColor

public void setBgColor(double r,
                       double g,
                       double b)
Sets the background color ( RGB values range: 0..1).

Parameters:
r - red component 0..1
g - green component 0..1
b - blue component 0..1

setDragging

public void setDragging(boolean value)
If the user is interactively dragging the mouse, we want the renderer to know about it, so that any other background process (eg: a material which is building a lookup table) can ask the renderer, and thereby avoid consuming scarce CPU resources simultaneously.


setFL

public void setFL(double value)
Sets the camera's focal length.

Parameters:
value - focal length

setFOV

public void setFOV(double value)
Sets the field of view value.

Parameters:
value -

setGeometryBuffer

public void setGeometryBuffer(boolean value)
enables/disables the geometry z-buffer, for object picking

Parameters:
value - on/off

setLod

public void setLod(int value)
set the level of detail

Parameters:
value -

setOutline

public void setOutline(boolean value)
toggle outline mode

Parameters:
value -

setRenderable

public void setRenderable(Renderable renderable)
set the renderable object

Parameters:
renderable -

setTableMode

public void setTableMode(boolean value)
toggle table lookup mode and precomputation

Parameters:
value -

showMesh

public void showMesh(boolean value)
toggle the wireframe view of the world

Parameters:
value -

start

public void start()
starts the renderer thread


transform

public void transform(Geometry s)
Applies the top transformation matrix to Geometry s.

Parameters:
s - Geometry object

translate

public void translate(double x,
                      double y,
                      double z)
Translates the top matrix by vector v.

Parameters:
x - translation along the x axis
y - translation along the y axis
z - translation along the z axis

translate

public void translate(double[] v)
Translates the top matrix by vector v.

Parameters:
v - an array of three doubles representing translations in the x,y,z directions.

widgetAt

public Widget widgetAt(int x,
                       int y)
returns the widget at x, y

Parameters:
x -
y -
Returns: