public void AddTriangleStrip(
IList<Point3D> stripPositions,
IList<Vector3D> stripNormals = null,
IList<Point> stripTextureCoordinates = null)
{
if (stripPositions == null)
{
throw new ArgumentNullException("stripPositions");
}
if (this.normals != null && stripNormals == null)
{
throw new ArgumentNullException("stripNormals");
}
if (this.textureCoordinates != null && stripTextureCoordinates == null)
{
throw new ArgumentNullException("stripTextureCoordinates");
}
if (stripNormals != null && stripNormals.Count != stripPositions.Count)
{
throw new InvalidOperationException(WrongNumberOfNormals);
}
if (stripTextureCoordinates != null && stripTextureCoordinates.Count != stripPositions.Count)
{
throw new InvalidOperationException(WrongNumberOfTextureCoordinates);
}
int index0 = this.positions.Count;
for (int i = 0; i < stripPositions.Count; i++)
{
this.positions.Add(stripPositions[i]);
if (this.normals != null && stripNormals != null)
{
this.normals.Add(stripNormals[i]);
}
if (this.textureCoordinates != null && stripTextureCoordinates != null)
{
this.textureCoordinates.Add(stripTextureCoordinates[i]);
}
}
int indexEnd = this.positions.Count;
for (int i = index0; i + 2 < indexEnd; i += 2)
{
this.triangleIndices.Add(i);
this.triangleIndices.Add(i + 1);
this.triangleIndices.Add(i + 2);
if (i + 3 < indexEnd)
{
this.triangleIndices.Add(i + 1);
this.triangleIndices.Add(i + 3);
this.triangleIndices.Add(i + 2);
}
}
}