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

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

public abstract class FaceTarget<R extends Renderable>
extends AbstractTarget<R>

a target that relies on faces to represent geometry. The faces used by this target are polygons with three or more coplanar vertices. TODO: this currently produces faces that are not convex


Nested Class Summary
protected static class FaceTarget.Face
          mutable representation of a face
protected static class FaceTarget.IsolatedTriangle
           
 
Field Summary
 
Fields inherited from class AbstractTarget
BOX_TEX_COORDS_1, BOX_TEX_COORDS_2, config
 
Constructor Summary
FaceTarget()
           
 
Method Summary
 void beginObject(WorldObject object)
          announces the begin of the draw* calls for a WorldObject.
protected static Collection<FaceTarget.Face> combineTrianglesToFaces(Collection<FaceTarget.IsolatedTriangle> isolatedTriangles)
           
protected static FaceTarget.Face createFaceFromTriangle(FaceTarget.IsolatedTriangle t)
           
 void drawConvexPolygon(Material material, List<VectorXYZ> vs, List<List<VectorXZ>> texCoordLists)
          draws a convex polygon
abstract  void drawFace(Material material, List<VectorXYZ> vs, List<VectorXYZ> normals, List<List<VectorXZ>> texCoordLists)
           
 void drawTriangles(Material material, Collection<? extends TriangleXYZ> triangles, List<List<VectorXZ>> texCoordLists)
          draws triangles.
 void drawTrianglesWithNormals(Material material, Collection<? extends TriangleXYZWithNormals> triangles, List<List<VectorXZ>> texCoordLists)
          draws triangles with explicitly defined normal vectors.
 void finish()
          gives the target the chance to perform finish/cleanup operations after all objects have been drawn.
 void flushReconstructedFaces()
          prevents triangles from before the call to be connected with triangles after this call when faces are reconstructed.
protected static boolean normalAlmostEquals(VectorXYZ n1, VectorXYZ n2)
           
abstract  boolean reconstructFaces()
          decides whether faces should be reconstructed from triangulations and other primitives.
 
Methods inherited from class AbstractTarget
drawBox, drawColumn, drawTriangleFan, drawTriangleStrip, setConfiguration
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Target
getRenderableType, render
 

Constructor Detail

FaceTarget

public FaceTarget()
Method Detail

drawFace

public abstract void drawFace(Material material,
                              List<VectorXYZ> vs,
                              List<VectorXYZ> normals,
                              List<List<VectorXZ>> texCoordLists)

reconstructFaces

public abstract boolean reconstructFaces()
decides whether faces should be reconstructed from triangulations and other primitives.


flushReconstructedFaces

public void flushReconstructedFaces()
prevents triangles from before the call to be connected with triangles after this call when faces are reconstructed. This is automatically done at the beginning of each new object. It only has any effect if reconstructFaces() is enabled. Calling this method at appropriate times can also help to speed up performance by lowering the number of candidates for merging.


drawTriangles

public void drawTriangles(Material material,
                          Collection<? extends TriangleXYZ> triangles,
                          List<List<VectorXZ>> texCoordLists)
Description copied from interface: Target
draws triangles.

texCoordLists - one texture coordinate list per texture. Each must have three coordinates per triangle. Can be null if no texturing information is available.

drawTrianglesWithNormals

public void drawTrianglesWithNormals(Material material,
                                     Collection<? extends TriangleXYZWithNormals> triangles,
                                     List<List<VectorXZ>> texCoordLists)
Description copied from interface: Target
draws triangles with explicitly defined normal vectors.

See Also:
Target.drawTriangles(Material, Collection, 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>
Overrides:
drawConvexPolygon in class AbstractTarget<R extends Renderable>
See Also:
Target.drawTriangleStrip(Material, List, List)

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>
Overrides:
beginObject in class AbstractTarget<R extends Renderable>

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>
Overrides:
finish in class AbstractTarget<R extends Renderable>

combineTrianglesToFaces

protected static Collection<FaceTarget.Face> combineTrianglesToFaces(Collection<FaceTarget.IsolatedTriangle> isolatedTriangles)
Parameters:
isolatedTriangles - non-empty collection of triangles

normalAlmostEquals

protected static boolean normalAlmostEquals(VectorXYZ n1,
                                            VectorXYZ n2)

createFaceFromTriangle

protected static FaceTarget.Face createFaceFromTriangle(FaceTarget.IsolatedTriangle t)