I'm creating an array of vertex formats which I know will always come in groups of 3 as models are generally made for triangles which have 3 vertices.
My loop was originally
for (int i = 0; i < batchVertices.Length; ++i)
{
batchVertices[i] = new VertexFormat(vertices[i], normals[i], textureCoordinates[i]);
}
I have now optimised it to the best of my ability
for (int i = 0; i < batchVertices.Length; i += 3)
{
int i1 = i + 1;
int i2 = i + 2;
batchVertices[i] = new VertexFormat(vertices[i], normals[i], textureCoordinates[i], textureIndex);
batchVertices[i1] = new VertexFormat(vertices[i1], normals[i1], textureCoordinates[i1], textureIndex);
batchVertices[i2] = new VertexFormat(vertices[i2], normals[i2], textureCoordinates[i2], textureIndex);
}
Is there anything else I can do and is the method above a good way of optimising (in your opinion)?