org.osm2world.core.target.common
Class AbstractTarget<R extends Renderable>

Object
  extended by AbstractTarget<R>
All Implemented Interfaces:
Target<R>
Direct Known Subclasses:
FaceTarget, POVRayTarget, PrimitiveTarget

public abstract class AbstractTarget<R extends Renderable>
extends Object
implements Target<R>

superclass for Target implementations that defines some of the required methods using others. Extending it reduces the number of methods that have to be provided by the implementation


Field Summary
protected static List<VectorXZ> BOX_TEX_COORDS_1
           
protected static List<VectorXZ> BOX_TEX_COORDS_2
           
protected  Configuration config
           
 
Constructor Summary
AbstractTarget()
           
 
Method Summary
 void beginObject(WorldObject object)
          announces the begin of the draw* calls for a WorldObject.
 void drawBox(Material material, VectorXYZ bottomCenter, VectorXZ faceDirection, double height, double width, double depth)
          draws a box with outward-facing polygons.
 void drawColumn(Material material, Integer corners, VectorXYZ base, double height, double radiusBottom, double radiusTop, boolean drawBottom, boolean drawTop)
          draws a column with outward-facing polygons around a point.
 void drawConvexPolygon(Material material, List<VectorXYZ> vs, List<List<VectorXZ>> texCoordLists)
          draws a convex polygon
 void drawTriangleFan(Material material, List<VectorXYZ> vs, List<List<VectorXZ>> texCoordLists)
          draws a triangle fan.
 void drawTriangleStrip(Material material, List<VectorXYZ> vs, List<List<VectorXZ>> texCoordLists)
          draws a triangle strip.
 void finish()
          gives the target the chance to perform finish/cleanup operations after all objects have been drawn.
 void setConfiguration(Configuration config)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Target
drawTriangles, drawTrianglesWithNormals, getRenderableType, render
 

Field Detail

config

protected Configuration config

BOX_TEX_COORDS_1

protected static final List<VectorXZ> BOX_TEX_COORDS_1

BOX_TEX_COORDS_2

protected static final List<VectorXZ> BOX_TEX_COORDS_2
Constructor Detail

AbstractTarget

public AbstractTarget()
Method Detail

setConfiguration

public void setConfiguration(Configuration config)
Specified by:
setConfiguration in interface Target<R extends Renderable>

beginObject

public void beginObject(WorldObject object)
Description copied from interface: Target
announces the begin of the draw* calls for a WorldObject. This allows targets to group them, if desired. Otherwise, this can be ignored.

Specified by:
beginObject in interface Target<R extends Renderable>

drawBox

public void drawBox(Material material,
                    VectorXYZ bottomCenter,
                    VectorXZ faceDirection,
                    double height,
                    double width,
                    double depth)
Description copied from interface: Target
draws a box with outward-facing polygons.

Specified by:
drawBox in interface Target<R extends Renderable>
faceDirection - direction for the "front" of the box

drawColumn

public void drawColumn(Material material,
                       Integer corners,
                       VectorXYZ base,
                       double height,
                       double radiusBottom,
                       double radiusTop,
                       boolean drawBottom,
                       boolean drawTop)
Description copied from interface: Target
draws a column with outward-facing polygons around a point. A column is a polygon with > 3 corners extruded upwards. The implementation may decide to reduce the number of corners in order to improve performance (or make rendering possible when a perfect cylinder isn't supported).

Specified by:
drawColumn in interface Target<R extends Renderable>
corners - number of corners; null creates a cylinder for radiusBottom == radiusTop or (truncated) cone otherwise

drawTriangleStrip

public void drawTriangleStrip(Material material,
                              List<VectorXYZ> vs,
                              List<List<VectorXZ>> texCoordLists)
Description copied from interface: Target
draws a triangle strip.

Specified by:
drawTriangleStrip in interface Target<R extends Renderable>
vs - vertices of the triangle strip
texCoordLists - one texture coordinate list per texture. Each must have the same length as the "vs" parameter. Can be null if no texturing information is available.

drawTriangleFan

public void drawTriangleFan(Material material,
                            List<VectorXYZ> vs,
                            List<List<VectorXZ>> texCoordLists)
Description copied from interface: Target
draws a triangle fan.

Specified by:
drawTriangleFan in interface Target<R extends Renderable>
See Also:
Target.drawTriangleStrip(Material, List, List)

drawConvexPolygon

public void drawConvexPolygon(Material material,
                              List<VectorXYZ> vs,
                              List<List<VectorXZ>> texCoordLists)
Description copied from interface: Target
draws a convex polygon

Specified by:
drawConvexPolygon in interface Target<R extends Renderable>
See Also:
Target.drawTriangleStrip(Material, List, List)

finish

public void finish()
Description copied from interface: Target
gives the target the chance to perform finish/cleanup operations after all objects have been drawn.

Specified by:
finish in interface Target<R extends Renderable>