org.osm2world.core.target.common
public abstract class AbstractTarget<R extends Renderable> extends Object implements Target<R>
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 implementationModifier and Type | Field and Description |
---|---|
protected static List<VectorXZ> |
BOX_TEX_COORDS_1 |
protected static List<VectorXZ> |
BOX_TEX_COORDS_2 |
protected Configuration |
config |
Constructor and Description |
---|
AbstractTarget() |
Modifier and Type | Method and Description |
---|---|
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)
|
void |
drawConvexPolygon(Material material,
List<VectorXYZ> vs,
List<List<VectorXZ>> texCoordLists)
draws a convex polygon
|
void |
drawExtrudedShape(Material material,
ShapeXZ shape,
List<VectorXYZ> path,
List<VectorXYZ> upVectors,
List<Double> scaleFactors,
List<List<VectorXZ>> texCoordLists,
EnumSet<ExtrudeOption> options)
draws an extruded shape using
drawTriangleStrip(Material, List, List) calls. |
void |
drawShape(Material material,
SimpleClosedShapeXZ shape,
VectorXYZ point,
VectorXYZ frontVector,
VectorXYZ upVector)
draws a flat shape in 3D space, at an arbitrary rotation.
|
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
drawTriangles, drawTrianglesWithNormals, getRenderableType, render
protected Configuration config
protected static final List<VectorXZ> BOX_TEX_COORDS_1
protected static final List<VectorXZ> BOX_TEX_COORDS_2
public void setConfiguration(Configuration config)
setConfiguration
in interface Target<R extends Renderable>
public void beginObject(WorldObject object)
Target
WorldObject
.
This allows targets to group them, if desired.
Otherwise, this can be ignored.beginObject
in interface Target<R extends Renderable>
public void drawShape(Material material, SimpleClosedShapeXZ shape, VectorXYZ point, VectorXYZ frontVector, VectorXYZ upVector)
Target
drawShape
in interface Target<R extends Renderable>
material
- the material used for the extruded shape; != nullshape
- the shape to be drawn; != nullpoint
- position where the shape is drawn; != nullfrontVector
- direction the shape is facing.
Defines the shape's rotation along with upVector; != nullupVector
- up direction of the shape.
Defines the shape's rotation along with frontVector; != nullpublic void drawExtrudedShape(Material material, ShapeXZ shape, List<VectorXYZ> path, List<VectorXYZ> upVectors, List<Double> scaleFactors, List<List<VectorXZ>> texCoordLists, EnumSet<ExtrudeOption> options)
drawTriangleStrip(Material, List, List)
calls.
See Target.drawExtrudedShape(Material, ShapeXZ, List, List, List, List, EnumSet)
for documentation of the implemented interface method.drawExtrudedShape
in interface Target<R extends Renderable>
material
- the material used for the extruded shape; != nullshape
- the shape to be extruded; != nullpath
- the path along which the shape is extruded. Implicitly,
this also defines a rotation for the shape at each point.
Must have at least two points; != null.upVectors
- defines the rotation (along with the path) at each point.
Must have the same number of elements as path; != null.
You can use Collections.nCopies(int, Object)
if you want the same up vector for all points of the path.scaleFactors
- optionally allows the shape to be scaled at each point.
Must have the same number of elements as path.
Can be set to null for a constant scale factor of 1texCoordLists
- one texture coordinate list per texture.
The number of vectors in each must be equal to the number of
vertices of the shape, multiplied by the length of the path.
Can be null, in which case it falls back to a default.options
- flags setting additional options; can be null for no options.public void drawBox(Material material, VectorXYZ bottomCenter, VectorXZ faceDirection, double height, double width, double depth)
Target
drawBox
in interface Target<R extends Renderable>
faceDirection
- direction for the "front" of the boxpublic void drawColumn(Material material, Integer corners, VectorXYZ base, double height, double radiusBottom, double radiusTop, boolean drawBottom, boolean drawTop)
Target.drawColumn(Material, Integer, VectorXYZ, double, double, double, boolean, boolean)
.
Implemented using drawExtrudedShape(Material, ShapeXZ, List, List, List, List, EnumSet)
.drawColumn
in interface Target<R extends Renderable>
corners
- number of corners; null creates a cylinder
for radiusBottom == radiusTop or (truncated) cone otherwisepublic void drawTriangleStrip(Material material, List<VectorXYZ> vs, List<List<VectorXZ>> texCoordLists)
Target
drawTriangleStrip
in interface Target<R extends Renderable>
vs
- vertices of the triangle striptexCoordLists
- 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.public void drawTriangleFan(Material material, List<VectorXYZ> vs, List<List<VectorXZ>> texCoordLists)
Target
drawTriangleFan
in interface Target<R extends Renderable>
Target.drawTriangleStrip(Material, List, List)
public void drawConvexPolygon(Material material, List<VectorXYZ> vs, List<List<VectorXZ>> texCoordLists)
Target
drawConvexPolygon
in interface Target<R extends Renderable>
Target.drawTriangleStrip(Material, List, List)
public void finish()
Target
finish
in interface Target<R extends Renderable>