com.brackeen.javagamebook.graphics3D
Class PolygonRenderer

java.lang.Object
  extended bycom.brackeen.javagamebook.graphics3D.PolygonRenderer
Direct Known Subclasses:
FastTexturedPolygonRenderer, SimpleTexturedPolygonRenderer, SolidPolygonRenderer

public abstract class PolygonRenderer
extends java.lang.Object

The PolygonRenderer class is an abstract class that transforms and draws polygons onto the screen.


Constructor Summary
PolygonRenderer(Transform3D camera, ViewWindow viewWindow)
          Creates a new PolygonRenderer with the specified Transform3D (camera) and ViewWindow.
PolygonRenderer(Transform3D camera, ViewWindow viewWindow, boolean clearViewEveryFrame)
          Creates a new PolygonRenderer with the specified Transform3D (camera) and ViewWindow.
 
Method Summary
 boolean draw(java.awt.Graphics2D g, Polygon3D poly)
          Transforms and draws a polygon.
 void endFrame(java.awt.Graphics2D g)
          Indicates the end of rendering of a frame.
 Transform3D getCamera()
          Gets the camera used for this PolygonRenderer.
 void startFrame(java.awt.Graphics2D g)
          Indicates the start of rendering of a frame.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonRenderer

public PolygonRenderer(Transform3D camera,
                       ViewWindow viewWindow)
Creates a new PolygonRenderer with the specified Transform3D (camera) and ViewWindow. The view is cleared when startFrame() is called.


PolygonRenderer

public PolygonRenderer(Transform3D camera,
                       ViewWindow viewWindow,
                       boolean clearViewEveryFrame)
Creates a new PolygonRenderer with the specified Transform3D (camera) and ViewWindow. If clearViewEveryFrame is true, the view is cleared when startFrame() is called.

Method Detail

getCamera

public Transform3D getCamera()
Gets the camera used for this PolygonRenderer.


startFrame

public void startFrame(java.awt.Graphics2D g)
Indicates the start of rendering of a frame. This method should be called every frame before any polygons are drawn.


endFrame

public void endFrame(java.awt.Graphics2D g)
Indicates the end of rendering of a frame. This method should be called every frame after all polygons are drawn.


draw

public boolean draw(java.awt.Graphics2D g,
                    Polygon3D poly)
Transforms and draws a polygon.