Class PhongRenderer

java.lang.Object
  |
  +--Renderer
        |
        +--FlatRenderer
              |
              +--GouraudRenderer
                    |
                    +--PhongRenderer

public class PhongRenderer
extends GouraudRenderer

Renders Phong; normal-vector interpolation algorithm proposed by Phong Bui-Tong.

This class defines inner subclasses of FlatRenderer.EdgeEntry, GouraudRenderer.PolygonInfoEx and GouraudRenderer.EdgeTableEx.

class EdgeEntryEx (subclass of FlatRenderer.EdgeEntry) contains the normal vector for the starting and ending vertice of the edge.

class EdgeTableEx (subclass of GouraudRenderer.EdgeTableEx) is required to construct instances of EdgeEntryEx. It also contains a MeshInfo instance for the owning mesh of the polygon edges in the table. The MeshInfo instance is required to feed EdgeTableEx constructor with vertice normals.

class PolygonInfoEx (subclass of GouraudRenderer.PolygonInfoEx ) is only required to construct instances of EdgeTableEx.

Author:
Sasmito Adibowo
See Also:
PhongRenderer.PolygonInfoEx, PhongRenderer.EdgeEntryEx, PhongRenderer.EdgeTableEx

Inner Class Summary
protected  class PhongRenderer.EdgeEntryEx
          Extended edge information containing normal vectors for each entry.
protected  class PhongRenderer.EdgeTableEx
          The Edge table for each polygon.
protected  class PhongRenderer.PolygonInfoEx
          Polygon information -- only functions to create instances of PhongRenderer.EdgeTableEx and ActiveEdgeTable.
 
Inner classes inherited from class GouraudRenderer
GouraudRenderer.EdgeEntryEx, GouraudRenderer.EdgeTableEx, GouraudRenderer.MeshInfo, GouraudRenderer.PolygonInfoEx
 
Inner classes inherited from class FlatRenderer
FlatRenderer.ActiveEdgeTable, FlatRenderer.EdgeBucket, FlatRenderer.EdgeEntry, FlatRenderer.EdgeTable, FlatRenderer.PolygonInfo
 
Fields inherited from class GouraudRenderer
meshTable
 
Fields inherited from class FlatRenderer
colorBuffer, depthBuffer, lights, polygonTable, projectedMeshes, xmin
 
Fields inherited from class Renderer
AMBIENT_BLUE, AMBIENT_GREEN, AMBIENT_RED, backingStore, CS_REALWORLD, FATT_C1, FATT_C2, FATT_C3, metafile, owner, viewPlane
 
Constructor Summary
PhongRenderer(Component owner)
           
 
Method Summary
protected  void fillPixels(FlatRenderer.PolygonInfo info, FlatRenderer.ActiveEdgeTable AET, int xmin, int y)
          Fills a line of pixels from the AET.
protected  void initPolygonTable()
          Initializes the polygon table with PolygonInfoEx instances using the current meshes in projectedMeshes.
 
Methods inherited from class GouraudRenderer
normalizeMesh, normalizeMeshes, notifyDataChanged, paintLights
 
Methods inherited from class FlatRenderer
getProjectionMatrix, initLineBuffers, makeCoorSysMatrices, paint, processPolygon, processScanLine, projectMatrix, projectMesh, projectMeshes, render, roundCoord, transformLights
 
Methods inherited from class Renderer
drawGrid, getMetafile, getSize, initBackingStore, makeParallelProjection, makePerspectiveProjection, moveCamera, overlaps, parallelProjection, rotateCameraX, rotateCameraY, rotateCameraZ, rotateCoorSysX, rotateCoorSysY, rotateCoorSysZ, setMetafile, setupCartesian, translateCoorSys
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

PhongRenderer

public PhongRenderer(Component owner)
Method Detail

initPolygonTable

protected void initPolygonTable()
Initializes the polygon table with PolygonInfoEx instances using the current meshes in projectedMeshes.
Overrides:
initPolygonTable in class GouraudRenderer
See Also:
FlatRenderer.projectedMeshes, FlatRenderer.polygonTable, FlatRenderer.PolygonInfo

fillPixels

protected void fillPixels(FlatRenderer.PolygonInfo info,
                          FlatRenderer.ActiveEdgeTable AET,
                          int xmin,
                          int y)
Fills a line of pixels from the AET. Updates depthBuffer and colorBuffer.
Overrides:
fillPixels in class GouraudRenderer
Parameters:
AET - the current active-edge table.
g - the drawing surface.
xmin - the minimum x-coordinate.
y - the current y-coordinate of the line.
See Also:
FlatRenderer.depthBuffer, FlatRenderer.colorBuffer