API Reference

Class List

pc.VertexIterator

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

Summary

Properties

element

The vertex buffer elements.

Methods

end

Notifies the vertex buffer being iterated that writes are complete.

next

Moves the vertex iterator on to the next vertex.

Details

Constructor

VertexIterator(vertexBuffer)

Returns a new pc.VertexIterator object.

Parameters

vertexBufferpc.VertexBuffer

The vertex buffer to be iterated.

Properties

objectelement

The vertex buffer elements.

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();