A vertex iterator simplifies the process of writing vertex data to a vertex buffer.

Constructors

Properties

Methods

Constructors

Properties

element: {}

The vertex buffer elements.

Methods

  • Notifies the vertex buffer being iterated that writes are complete. Internally the vertex buffer is unlocked and vertex data is uploaded to video memory.

    Returns void

    const iterator = new pc.VertexIterator(vertexBuffer);
    iterator.element[pc.SEMANTIC_POSITION].set(-0.9, -0.9, 0.0);
    iterator.element[pc.SEMANTIC_COLOR].set(255, 0, 0, 255);
    iterator.next();
    iterator.element[pc.SEMANTIC_POSITION].set(0.9, -0.9, 0.0);
    iterator.element[pc.SEMANTIC_COLOR].set(0, 255, 0, 255);
    iterator.next();
    iterator.element[pc.SEMANTIC_POSITION].set(0.0, 0.9, 0.0);
    iterator.element[pc.SEMANTIC_COLOR].set(0, 0, 255, 255);
    iterator.end();
  • Moves the vertex iterator on to the next vertex.

    Parameters

    • Optionalcount: number = 1

      Optional number of steps to move on when calling next. Defaults to 1.

    Returns void

    const iterator = new pc.VertexIterator(vertexBuffer);
    iterator.element[pc.SEMANTIC_POSITION].set(-0.9, -0.9, 0.0);
    iterator.element[pc.SEMANTIC_COLOR].set(255, 0, 0, 255);
    iterator.next();
    iterator.element[pc.SEMANTIC_POSITION].set(0.9, -0.9, 0.0);
    iterator.element[pc.SEMANTIC_COLOR].set(0, 255, 0, 255);
    iterator.next();
    iterator.element[pc.SEMANTIC_POSITION].set(0.0, 0.9, 0.0);
    iterator.element[pc.SEMANTIC_COLOR].set(0, 0, 255, 255);
    iterator.end();