addVertex method

dynamic addVertex(
  1. dynamic position,
  2. dynamic u,
  3. dynamic v
)

Implementation

addVertex(position, u, v) {
  listSetter(vertices, currentCoordinate, position.x);

  // vertices[ currentCoordinate + 1 ] = position.y;
  listSetter(vertices, currentCoordinate + 1, position.y);

  // vertices[ currentCoordinate + 2 ] = 0;
  listSetter(vertices, currentCoordinate + 2, 0.0);

  listSetter(normals, currentCoordinate, 0.0);

  // normals[ currentCoordinate + 1 ] = 0;
  listSetter(normals, currentCoordinate + 1, 0.0);

  // normals[ currentCoordinate + 2 ] = 1;
  listSetter(normals, currentCoordinate + 2, 1.0);

  currentCoordinate += 3;

  listSetter(uvs, currentCoordinateUV, u.toDouble());

  // uvs[ currentCoordinateUV + 1 ] = v;
  listSetter(uvs, currentCoordinateUV + 1, v.toDouble());

  currentCoordinateUV += 2;

  numVertices += 3;
}