org.osm2world.core.target.primitivebuffer
Class PrimitiveBuffer

Object
  extended by AbstractTarget
      extended by PrimitiveTarget
          extended by PrimitiveBuffer
All Implemented Interfaces:
Target

public class PrimitiveBuffer
extends PrimitiveTarget

Storage for low-level rendering information (vertex and primitive data) that can be displayed using graphics APIs, e.g. OpenGL. Higher-level information, such as object coherence, OSM attributes or representations, isn't present in an OGLBuffer.


Constructor Summary
PrimitiveBuffer()
           
 
Method Summary
 void addWorldObjects(MapData mapData, Camera camera)
           
protected  void drawPrimitive(Primitive.Type type, Material material, List<? extends VectorXYZ> vertices, VectorXYZ[] normals)
           
 Set<Material> getMaterials()
          returns all materials used in the buffer
 Collection<Primitive> getPrimitives(Material material)
          returns all primitives that use a given material
 VectorXYZ getVertex(int index)
           
 List<VectorXYZ> getVertices()
          returns all vertices, in a list where the indices correspond to those used by getVertex(int)
 void optimize()
          optimizes the primitives, for example by merging them into larger primitives.
 
Methods inherited from class PrimitiveTarget
drawPolygon, drawPolygon, drawTriangleFan, drawTriangles, drawTriangleStrip, drawTriangleStrip, drawTrianglesWithNormals
 
Methods inherited from class AbstractTarget
beginObject, drawBox, drawColumn
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimitiveBuffer

public PrimitiveBuffer()
Method Detail

drawPrimitive

protected void drawPrimitive(Primitive.Type type,
                             Material material,
                             List<? extends VectorXYZ> vertices,
                             VectorXYZ[] normals)
Specified by:
drawPrimitive in class PrimitiveTarget
vertices - vertices that form the primitive
normals - normal vector for each vertex; same size as vs

optimize

public void optimize()
optimizes the primitives, for example by merging them into larger primitives.


addWorldObjects

public void addWorldObjects(MapData mapData,
                            Camera camera)

getVertex

public VectorXYZ getVertex(int index)

getVertices

public List<VectorXYZ> getVertices()
returns all vertices, in a list where the indices correspond to those used by getVertex(int)


getMaterials

public Set<Material> getMaterials()
returns all materials used in the buffer


getPrimitives

public Collection<Primitive> getPrimitives(Material material)
returns all primitives that use a given material