net.jinx.video.model
Class LineLoop

java.lang.Object
  extended by net.jinx.video.model.MeshElement
      extended by net.jinx.video.model.LineElement
          extended by net.jinx.video.model.LineLoop

public final class LineLoop
extends LineElement

LineLoop represents a set of lines based on OpenGL's GL_LINE_LOOP drawing mode. The first vertex is the starting point. The next vertex forms a line between the two. Each vertex after that forms a line from the new one and the previous one. Finally, when there are no vertices left, a line is drawn from the last vertex to the first.

API Stability: Stable.


Constructor Summary
LineLoop(float[][] vertices, float width)
          Constructs a new LineLoop using the given vertex array and line width.
 
Method Summary
 int draw(Context opt, float[][] normals, float[][] texCoord, Coloration coloration, int offset)
          Draws the mesh, using the given array of Materials.
 Face[] getFaces()
          Lines have no faces, so this returns an empty array.
 
Methods inherited from class net.jinx.video.model.LineElement
getWidth
 
Methods inherited from class net.jinx.video.model.MeshElement
getVertices, toLineElement, vertexCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineLoop

public LineLoop(float[][] vertices,
                float width)
Constructs a new LineLoop using the given vertex array and line width.

Parameters:
vertices - the vertex array.
width - the width of line to draw.
Method Detail

getFaces

public Face[] getFaces()
Lines have no faces, so this returns an empty array.

Specified by:
getFaces in class MeshElement
Returns:
an empty Face array.

draw

public int draw(Context opt,
                float[][] normals,
                float[][] texCoord,
                Coloration coloration,
                int offset)
Description copied from class: MeshElement
Draws the mesh, using the given array of Materials. One Material will be used per vertex, unless there is only one, in which case the same color will be used for each vertex. The offset into the array will be incremented with each vertex and then returned once the Mesh has finished drawing.

Specified by:
draw in class MeshElement
Parameters:
opt - the rendering options to use.
normals - vectors in a vertex array for per-vertex normals. If null, this indicates that per-face normals should be used instead.
coloration - the Coloration object to use to color the vertices.
offset - the index into normal array to start at. This is also the current vertex number.
Returns:
the index of the next normal to use, once this method has completed. This is also the number of the next vertex.