foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
{
pass.Begin();
device.VertexDeclaration = myVertexDeclaration;
device.DrawUserPrimitives<VertexPositionTexture>
➥
(PrimitiveType.TriangleList, vertices, 0, 1);
pass.End();
}
basicEffect.End();
base.Draw(gameTime);
}
5-3. Remove Redundant Vertices Using Indices
The Problem
The triangles you want to render share a lot of vertices. Figure 5-7 shows such a situation.
0
1
2
3
4
5
6
7
8
(0-2)
(3-5)
(6-8) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.