addVertex method

int addVertex(
  1. Vector3 position
)

Adds a vertex at position carrying the current sticky attributes and returns its index.

Implementation

int addVertex(Vector3 position) {
  if (deduplicate) {
    final key = _vertexKey(position);
    final existing = _vertexLookup[key];
    if (existing != null) return existing;
    final index = vertexCount;
    _vertexLookup[key] = index;
    _appendVertex(position);
    return index;
  }
  final index = vertexCount;
  _appendVertex(position);
  return index;
}