|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--Renderer
|
+--FlatRenderer
Renders mesh objects using visible-surface determination and constant shading. Uses the scan-line with a single-line z-buffer algorithm. When at least one Light object exist in the metafile, it renders using the constant-shading method, otherwise it renders with an ambient light of RGB = (1F,1F,1F).
| Inner Class Summary | |
protected static class |
FlatRenderer.ActiveEdgeTable
The current edge table for the scan line. |
protected static class |
FlatRenderer.EdgeBucket
The Edge table bucket for the EdgeTable. |
protected static class |
FlatRenderer.EdgeEntry
The entry for an edge in an EdgeBucket. |
protected static class |
FlatRenderer.EdgeTable
The global Edge Table for each polygon. |
protected static class |
FlatRenderer.PolygonInfo
Information about a polygon in process. |
| Field Summary | |
protected Color[] |
colorBuffer
The colors of the current scan line. |
protected double[] |
depthBuffer
The depths(Z) of the current scan line. |
protected List |
lights
The list of Light objects, transformed onto viewplane coordinates, but not projected. |
protected List |
polygonTable
The polygon table, containing PolygonInfo instances |
protected List |
projectedMeshes
The list of meshes which are already projected onto the viewplane, ready for scan-conversion. |
protected int |
xmin
The minimum x scan line value. |
| 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 | |
FlatRenderer(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 Jama.Matrix |
getProjectionMatrix()
Returns the current projection matrix -- parallel or perspective. |
protected void |
initLineBuffers(int width)
Initializes the line buffers: depthBuffer and colorBuffer. |
protected void |
initPolygonTable()
Initializes the polygon table with PolygonInfo instances using the current meshes in projectedMeshes. |
protected Jama.Matrix |
makeCoorSysMatrices(CoorSys cs)
Retrieves coorsys transformation matrices up to the root, and returns the composite transformation matrix. |
protected Mesh |
normalizeMesh(Mesh mesh)
Normalizes the mesh into viewplane coordinates. |
protected void |
normalizeMeshes()
Normalizes all the mesh objects and put into projectedMeshes. |
protected void |
notifyDataChanged()
Called when there are changes to the Renderer data. |
void |
paint(Graphics2D graphic)
Renders the 3-D scene. |
protected void |
processPolygon(FlatRenderer.PolygonInfo info,
int y)
Draws a polygon at the current scan line. |
protected void |
processScanLine(Graphics2D g)
Scan-line converts the projected meshes. |
protected Jama.Matrix |
projectMatrix(Jama.Matrix normalized)
Project matrix to viewplane matrix and projection matrix. |
protected void |
projectMesh(Mesh m)
Projects all the meshes in projectedMeshes |
protected void |
projectMeshes()
Projects the mesh objects in projectedMeshes |
void |
render()
Called to re-render the image internally. |
protected static int |
roundCoord(double coord)
Rounds a coordinate value from world units to device units. |
protected void |
transformLights()
Transforms all the Light objects onto the viewplane and store them into the lights List. |
| 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 |
|
| Field Detail |
protected List lights
protected double[] depthBuffer
protected Color[] colorBuffer
protected int xmin
protected List projectedMeshes
protected List polygonTable
| Constructor Detail |
public FlatRenderer(Component owner)
| Method Detail |
public void render()
public void paint(Graphics2D graphic)
g - the graphics context.protected void notifyDataChanged()
protected void initLineBuffers(int width)
width - the width (length) of the line buffersdepthBuffer,
colorBufferprotected void transformLights()
protected void initPolygonTable()
projectedMeshes,
polygonTable,
FlatRenderer.PolygonInfoprotected void processScanLine(Graphics2D g)
g - the graphic context to draw the image;
must already be set to the cartesian coordinate system.
protected void processPolygon(FlatRenderer.PolygonInfo info,
int y)
info - the polygon to draw.y - the y-coordinate of the current scan line.
protected void fillPixels(FlatRenderer.PolygonInfo info,
FlatRenderer.ActiveEdgeTable AET,
int xmin,
int y)
AET - the current active-edge table.g - the drawing surface.xmin - the minimum x-coordinate.y - the current y-coordinate of the line.depthBuffer,
colorBufferprotected void normalizeMeshes()
projectedMeshesprotected void projectMeshes()
protected void projectMesh(Mesh m)
projectedMeshesprotected Jama.Matrix makeCoorSysMatrices(CoorSys cs)
cs - the coordinate system.protected Jama.Matrix projectMatrix(Jama.Matrix normalized)
normalized - the normalized matrix in world coordinatesprotected Jama.Matrix getProjectionMatrix()
protected Mesh normalizeMesh(Mesh mesh)
mesh - the source mesh to project.protected static final int roundCoord(double coord)
coord - a coordinate value in world units.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||