API Reference

Class List

pc.VertexIterator

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

Summary

Methods

endNotifies the vertex buffer being iterated that writes are complete.
nextMoves the vertex iterator on to the next vertex.

Details

Constructor

VertexIterator(vertexBuffer)

Returns a new pc.VertexIterator object.

Parameters

vertexBufferpc.VertexBufferThe vertex buffer to be iterated.

Methods

end()

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

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